I searched the forums and could not find help for what might be causing this exception in my xamChart:
System.OverflowExceptionMessage: "Value was either too large or too small for a Decimal."Source: "mscorlib"at System.Decimal..ctor(Double value)\r\nat System.Convert.ToDecimal(Double value)\r\nat Infragistics.Windows.Chart.AxisLabelsBase.FillLabels()\r\nat Infragistics.Windows.Chart.ScenePane.CreateAxisLabels2D()\r\nat Infragistics.Windows.Chart.ScenePane.Create2DScene()\r\nat Infragistics.Windows.Chart.ScenePane.DrawWithException()\r\nat Infragistics.Windows.Chart.ScenePane.Draw()\r\nat Infragistics.Windows.Chart.ChartCreator.Create2DChart()\r\nat Infragistics.Windows.Chart.Chart.RefreshWithException()\r\nat Infragistics.Windows.Chart.Chart.Refresh()\r\nat Infragistics.Windows.Chart.XamChart.Refresh()\r\nat Infragistics.Windows.Chart.XamChart.RefreshProperty()\r\n
For me, the cause was a Double.PositiveInfinity or Double.NegativeInfinity as a data point ValueY.
Perhaps this will help "the next guy."
I have logged and fixed this issue. The bug report is # 25142; this will be resolved in a future service release. Thanks for reporting this issue.
Hello,
Since version 10.3 is retired we no longer provide fixes for it. Also the XamChart itself is a retired control and since version 12.2 we doesn't provide assemblies for it. I can suggest you either download version 12.1, where there are XamChart assemblies and the issue you described doesn't occur or download 12.2 and use XamDataChart instead, which has more features and functionalities and is way more flexible control.
Thanks for the reply.
I will use XamDataChart infragistics 12.2, but I'm not familiar with this control.
My XAML with old XamChart v10.3 is:
<Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions>
<igCA:XamChart Margin="6,6,6,0" Theme="Default"> <!--Theme="LucidDream">--> <igCA:XamChart.Series> <igCA:Series Label="Active Power" ChartType="ScatterLine" DataSource="{Binding LongTimeActivePowerValues}" DataMapping="ValueX = DateTime; ValueY = Value;" Fill="Navy"> </igCA:Series> <igCA:Series AxisY="LongAxisWind" Label="Wind Speed" ChartType="ScatterLine" DataSource="{Binding LongTimeWindSpeedValues}" DataMapping="ValueX = DateTime; ValueY = Value;" Fill="OrangeRed"> </igCA:Series> </igCA:XamChart.Series>
<igCA:XamChart.Axes>
<igCA:Axis AxisType="PrimaryX"> <igCA:Axis.Label> <igCA:Label DistanceFromAxis="2" Format="{}{0:HH:mm:ss}" /> </igCA:Axis.Label> </igCA:Axis>
<igCA:Axis AxisType="PrimaryY"> <igCA:Axis.Label> <igCA:Label Format="{}{0} MW"/> </igCA:Axis.Label> </igCA:Axis>
<igCA:Axis AxisType="SecondaryY" Name="LongAxisWind"> <igCA:Axis.Label> <igCA:Label Format="{}{0} m/s"/> </igCA:Axis.Label> </igCA:Axis>
</igCA:XamChart.Axes>
<igCA:XamChart.Caption> <igCA:Caption Text="Últimas 24 horas" /> </igCA:XamChart.Caption>
<igCA:XamChart.Legend> <igCA:Legend MarginType="Percent" Margin="80,20,5,20" /> </igCA:XamChart.Legend> </igCA:XamChart>
<igCA:XamChart Grid.Row="1" Margin="6" Theme="Default"> <igCA:XamChart.Series> <igCA:Series Label="Active Power" ChartType="ScatterLine" DataSource="{Binding ActivePowerValues}" DataMapping="ValueX = DateTime; ValueY = Value;" Fill="Navy"> </igCA:Series> <igCA:Series AxisY="AxisWind" Label="Wind Speed" ChartType="ScatterLine" DataSource="{Binding WindSpeedValues}" DataMapping="ValueX = DateTime; ValueY = Value;" Fill="OrangeRed"> </igCA:Series> </igCA:XamChart.Series>
<igCA:Axis AxisType="PrimaryX"> <igCA:Axis.Label> <igCA:Label DistanceFromAxis="2" Format="{}{0:HH:mm:ss}"/> </igCA:Axis.Label> </igCA:Axis>
<igCA:Axis AxisType="SecondaryY" Name="AxisWind"> <igCA:Axis.Label> <igCA:Label Format="{}{0} m/s"/> </igCA:Axis.Label> </igCA:Axis>
<igCA:XamChart.Legend> <igCA:Legend MarginType="Percent" Margin="80,20,5,20" /> </igCA:XamChart.Legend>
<igCA:XamChart.Caption> <igCA:Caption Text="Últimos 5 minutos" /> </igCA:XamChart.Caption>
</igCA:XamChart>
</Grid>
Can someone help me to convert this code to use with XamDataChart v12.2.
Thanks in advance
You should change the LineSeries' ValueMemberPath to ValueX, if that is the name of your datasource's Property.
Thanks for reply.
My doubt is how I can binding values with , like I did in XamChart, because variable LongTimeActivePowerValues as two fields [DateTime and Value]:
DataSource="{Binding LongTimeActivePowerValues}"DataMapping="ValueX = DateTime; ValueY = Value;"
I'm following that example for XamDataChart:
<ig:XamDataChart.Axes> <ig:NumericYAxis x:Name="YAxis" MinimumValue="0" Interval="400" Label="{}{} TWh" /> <ig:CategoryXAxis x:Name="XAxis" ItemsSource="{StaticResource energyProdData}" Label="{}{Country}" /> </ig:XamDataChart.Axes>
<
ig
:
XamDataChart.Axes
>
NumericYAxis
x
Name
="YAxis"
MinimumValue
="0"
Interval
="400"
Label
="{}{} TWh"
/>
CategoryXAxis
="XAxis"
ItemsSource
="{
StaticResource
energyProdData
}"
</
<ig:LineSeries ItemsSource="{StaticResource energyProdData}" ValueMemberPath="Coal" Title="Coal" MarkerType="None" Thickness="5" XAxis="{Binding ElementName=XAxis}" YAxis="{Binding ElementName=YAxis}"> </ig:LineSeries>
LineSeries
ValueMemberPath
="Coal"
Title
MarkerType
="None"
Thickness
="5"
XAxis
Binding
ElementName
=XAxis
YAxis
=YAxis
I can suggest you see the sample in the Samples Browser under xamDataChart / Display – Series / Gallery – Scatter Series section, where there is sample showing how to use the ScatterLine Series. Also if you want to add legend you can see the samples under xamDataChart / Display – Legends section.
Hope this helps you.