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
Hello Page,
I have been looking into your sample taht was attached to a duplicate support request and found a few things that would cause the chart to fail. First and most importantly is the string CurrentTme value you are passing to the ValueY parameter which needs a numeric value in order to place the the DataPoint to the Axis. The XamWebChart can also use a DateTime value for the Scatter and ScatterLine charts using the DateTime’s ToOADate method. That is why I suggest not setting the Axes Minimum and Maximum properties explicitly without the proper conversion.
I have modified your project to work with Scatter and ScatterLine chart types.
I also modified your data and binding in order to work around the binding exceptions in the output.
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support