Question

when my X Axis is of a time int it works perfectly. But when i put it as a string an error occurs

My XAML is like this

<telerik:RadChart Name="radChartCAMois">
                    <telerik:RadChart.SeriesMappings>
                        <telerik:SeriesMapping LegendLabel="Chiffre d'affaire en DT">
                            <telerik:SeriesMapping.SeriesDefinition>
                                <telerik:Area3DSeriesDefinition/>
                            </telerik:SeriesMapping.SeriesDefinition>
                            <telerik:SeriesMapping.ItemMappings>
                                <telerik:ItemMapping DataPointMember="XValue" FieldName="IntValue"></telerik:ItemMapping>
                                <telerik:ItemMapping DataPointMember="YValue" FieldName="StringValue"></telerik:ItemMapping>
                            </telerik:SeriesMapping.ItemMappings>
                        </telerik:SeriesMapping>
                    </telerik:RadChart.SeriesMappings>
                </telerik:RadChart>

and my code behing is like this

List<MyClass> a = new List<MyClass>{new MyClass{intValue = 1,stringValue = "s1"},new MyClass{intValue = 2,stringValue = "s2"}};

radChartCAMois.ItemsSource = a;

where MyClass is

class MyClass
{
    public int intValue;
    public string stringValue;
}
Was it helpful?

Solution

The XValue and YValue DataPointMember-s require their corresponding FieldName to be of type double. That's the reason why you can't set string as XValue. Instead you should use XCategory in a Category Chart..

http://www.telerik.com/help/wpf/radchart-features-categorical-charts.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top