I am trying to build a simple chart that graphs amount of powner used over time. I must be missing something very obvious because its not working. I have bound my graph to the observable collection (which has hard coded values in it in the constructor just for testing), set the datamapping..no data. I added axis...still not working. I wanted to do this via scatter line, but I just get the warning about setting parameters (which I do, but it doesn't work). I know I am just missing something. Here is the xaml:
<igChart:XamWebChart Margin="0,0,0,0" DataContext="{Binding PowerPerHour, Source={StaticResource PowerPerHourDataSource}}"> <igChart:XamWebChart.Axes> <igChart:Axis DataContext="{Binding Path=TimeStamp, Mode=OneWay}" x:Name="AxisX"/> <igChart:Axis DataContext="{Binding Path=AmountOfPower, Mode=OneWay}" x:Name="AxisY" AxisType="PrimaryY" AutoRange="False" Maximum="3800" Minimum="2000" Unit="250"/> </igChart:XamWebChart.Axes> <igChart:XamWebChart.Series> <igChart:Series ChartType="Line" AxisX="AxisX" AxisY="AxisY" DataMapping="ValueX=Timestamp; ValueY=AmountOfPower" DataSource="{Binding Path=PowerPerHour, Mode=OneWay}" Label="Power Per Hour"/> </igChart:XamWebChart.Series> </igChart:XamWebChart>
The observable collection exposes a ObservableCollection<PowerDataPoint>
Where PowerDataPoint exposes two fields:
public DateTime Timestap { get;; set; }
public double AmountOfPower { get; set; }
Anybody that could help I would apprieciate it.
Thanks
The line chart is a single value axis chart, ValueX, ValueY are for charts with two numeric axes like Scatter, etc.
Try a DataMapping value that looks like this instead:
DataMapping="Label = Timestamp; Value = AmountOfPower"
see: http://help.infragistics.com/NetAdvantage/DV/2009.2/CLR3.5/?page=SL_DV_xamWebChart_DataMapping_for_Single_Value_Axis_Charts.html
-Graham
Thanks for getting back to me Grahm. I can make line work now so thanks. What I really want is the scatter line. When I changed the datamapping as you said, but it still gives me the error:
"The scatter chart needs ValueX and ValueY. The values have to be set for every data point using ChartParameters collection."
I have defined them in the series ChartParameter collection for both ValueX and ValueY so Im not sure what I am doing wrong.
Thanks again for your help.