Jump to content

 

Photo

Binding X axis, from scratch.


  • Please log in to reply
7 replies to this topic

#1 starrycheng

starrycheng

    Advanced Member

  • Members
  • PipPipPip
  • 83 posts
  • Gender:Male
  • Location:Shanghai, China

Posted 10 April 2012 - 07:16 AM

Binding X axis, from scratch.

Question one:
Attached File  1.png   45.15K   11 downloads

The "1" should be "0". Also is the abscissa denotes should from scratch. How can I do it???

Question two:

Attached File  2.png   6.11K   9 downloads

ObservableCollection<MyChartsService.WarnCount> datas = e.Result;

DataMapping dm1 = new DataMapping();
dm1.MemberName = "AxisXLabel";
dm1.Path = "DpHour";
SLChart.Series[0].DataMappings.Add(dm1);

DataMapping dm2 = new DataMapping();
dm2.MemberName = "YValue";
dm2.Path = "DpSumQty";
SLChart.Series[0].DataMappings.Add(dm2);

SLChart.Series[0].DataSource = e.Result;

"DpHour" field can not bound to the "X" axis , why ? How can I do it???


Thank you very much...


I like Visifire ,like silverlight...

#2 shoaib

shoaib

    Advanced Member

  • Members
  • PipPipPip
  • 924 posts
  • Gender:Male
  • Location:Bangalore

Posted 11 April 2012 - 04:52 AM

Hi,

We are not able to reproduce the issue. Can you please provide us the full code to create the above chart?

Regards,
Shoaib

#3 starrycheng

starrycheng

    Advanced Member

  • Members
  • PipPipPip
  • 83 posts
  • Gender:Male
  • Location:Shanghai, China

Posted 11 April 2012 - 07:34 AM

Hi,

We are not able to reproduce the issue. Can you please provide us the full code to create the above chart?

Regards,
Shoaib


Thanks a lot...

All of the code shown as below:

1. XAML
<vc:Chart Theme="Theme1" View3D="False" Height="378" Width="1100" LightingEnabled="False" Background="#FFF5F5DF" Name="SLChart" UniqueColors="False">
<vc:Chart.Titles>
<vc:Title Text="用电线路故障统计" FontColor="#000000" FontSize="20"/>
</vc:Chart.Titles>


<vc:Chart.AxesY>

<vc:Axis LineColor="#000000"
LineThickness="1"
Title="故障数量"
Enabled="True"
StartFromZero="True"
AxisType="Primary"
LineStyle="Solid">
<my:Axis.AxisLabels>
<my:AxisLabels FontSize="13" />
</my:Axis.AxisLabels>
</vc:Axis>
</vc:Chart.AxesY>

<vc:Chart.AxesX>

<vc:Axis LineColor="#000000"
Interval="1"
LineThickness="1"
Title="时间(Hour)"
Enabled="True"
AxisType="Primary"
LineStyle="Solid"
StartFromZero="True"
>
<my:Axis.AxisLabels>
<my:AxisLabels FontSize="13" />
</my:Axis.AxisLabels>
</vc:Axis>
</vc:Chart.AxesX>

<vc:Chart.Series>
<vc:DataSeries RenderAs="Line" AxisYType="Primary" LegendText="故障数量" >


</vc:DataSeries>

</vc:Chart.Series>
</vc:Chart>

2.".cs"

public void ChartDataBind(string DpDay)
{
string weburl = Application.Current.Host.Source.ToString();
weburl = weburl.Substring(0, (weburl.Length - 23)) + "/ChartsService.svc";
MyChartsService.ChartsServiceClient client = new MyChartsService.ChartsServiceClient("CustomBinding_ChartsService1", weburl);
client.GetWarnCountDatasAsync(DpDay);
client.GetWarnCountDatasCompleted += new EventHandler<MyChartsService.GetWarnCountDatasCompletedEventArgs>(client_GetWarnCountDatasCompleted);

}

void client_GetWarnCountDatasCompleted(object sender, MyChartsService.GetWarnCountDatasCompletedEventArgs e)
{
ObservableCollection<MyChartsService.WarnCount> datas = e.Result;

DataMapping dm1 = new DataMapping();
dm1.MemberName = "AxisXLabel";
dm1.Path = "DpHour";
SLChart.Series[0].DataMappings.Add(dm1);

DataMapping dm2 = new DataMapping();
dm2.MemberName = "YValue";
dm2.Path = "DpSumQty";
SLChart.Series[0].DataMappings.Add(dm2);

SLChart.Series[0].DataSource = e.Result;


}

Thanks again.




I like Visifire ,like silverlight...

#4 shoaib

shoaib

    Advanced Member

  • Members
  • PipPipPip
  • 924 posts
  • Gender:Male
  • Location:Bangalore

Posted 12 April 2012 - 05:09 AM

StarryCheng,

We have tried the same code, it's working well here. Can you please tell me which version of Visifire you are using?

Regards,
Shoaib

#5 starrycheng

starrycheng

    Advanced Member

  • Members
  • PipPipPip
  • 83 posts
  • Gender:Male
  • Location:Shanghai, China

Posted 12 April 2012 - 12:04 PM

StarryCheng,

We have tried the same code, it's working well here. Can you please tell me which version of Visifire you are using?

Regards,
Shoaib


Thanks a lot...

Version: "visifire_v4.1.4"

Yes , It can work .
However the abscissa of the first data point is not "0" , but "1" . You can see as above picture shows ...

I like Visifire ,like silverlight...

#6 shoaib

shoaib

    Advanced Member

  • Members
  • PipPipPip
  • 924 posts
  • Gender:Male
  • Location:Bangalore

Posted 16 April 2012 - 06:14 AM

Hi StarryCheng,

We tried to reproduce the issue in 4.1.4.0, but it's working well. We have attached one sample application along with this post. Can you please try to to reproduce the issue and send it back to us?

Regards,
Shoaib

#7 starrycheng

starrycheng

    Advanced Member

  • Members
  • PipPipPip
  • 83 posts
  • Gender:Male
  • Location:Shanghai, China

Posted 16 April 2012 - 09:03 AM

Hi StarryCheng,

We tried to reproduce the issue in 4.1.4.0, but it's working well. We have attached one sample application along with this post. Can you please try to to reproduce the issue and send it back to us?

Regards,
Shoaib


Really?

Can you bring your photos and code fragment show out ?


I like Visifire ,like silverlight...

#8 shoaib

shoaib

    Advanced Member

  • Members
  • PipPipPip
  • 924 posts
  • Gender:Male
  • Location:Bangalore

Posted 17 April 2012 - 05:45 AM

Starrycheng,

Sorry for the inconvenience. Please checkout the sample attached along with this mail.

Regards,
Shoaib

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users