jusim Posted November 16, 2009 Report Share Posted November 16, 2009 hello, I want to bind a chart with my business object. I have a class: class MyData{ string _serieName; object _xValue; double _yValue;public MyData(string serieName, object xvalue, double value) { _serieName = serieName; _xValue = xvalue; _yValue = value; } public object XValue {get { return _xValue; } } public string SerieName { get { return _serieName; } }public double YValue {get { return _yValue; } } } xvalue is an object because I can have double values, datetime values or string values. I can have a chart but I want the axisX to be sorted in ascending order because when I try like that: MyData[] testArray = new MyData[3]; testArray[0] = new MyData"serieA", 2, 12);testArray[1] = new MyData("SerieB", 1, 16); testArray[2] = new MyData("SerieC", 3, 15);ListProvider l = new ListProvider(testArray);CrosstabDataProvider c = new CrosstabDataProvider(); c.DataSource = l; chart.DataSourceSettings.Fields.Add( new FieldMap("SerieName", FieldUsage.ColumnHeading));chart.DataSourceSettings.Fields.Add(new FieldMap("XValue", FieldUsage.RowHeading) ); chart.DataSourceSettings.Fields.Add( new FieldMap("YValue", FieldUsage.Value));chart.DataSource = testArray; I have a good chart but labels on axisX are in this order : 2 - 1 - 3 (the order in the tab). I think it's a normal behaviour but is there a way to display a chart with axisX sorted? Thank you. Quote Link to comment Share on other sites More sharing options...
jusim Posted November 16, 2009 Author Report Share Posted November 16, 2009 I made a mistake in my post : chart.DataSource = c;// the CrossTabDataProvider Quote Link to comment Share on other sites More sharing options...
CarlosAC Posted November 16, 2009 Report Share Posted November 16, 2009 Hi jusim <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> You need to provide the X-Axis labels sorted. Chart FX does not sort automatically your data in this case. -- Pipon Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.