This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I have a data structure that has several objects that contain List located in a central List. I would like to bind one List to my X-Axis and another to the Y-Axis. I attempted to do this, but I was unsuccessful with the following code: class AxisData
{
public List List AxisData AxisData1 = new AxisData(); AxisData AxisData2 = new AxisData(); ///(AxisData1 and AxisData2 get filled with data) DataStorage.Add(AxisData1); DataStorage.Add(AxisData2); LineSeries series = new LineSeries(); series.XBinding = new Binding("DataStorage[1].Data"); series.XBinding = new Binding("DataStorage[1].Data"); this.myChart.Series.Add(series); |
|
|
Hello Edward The chart only supports a list of individual data points to plot on the chart, rather than 2 lists of x and y data. Each item added to the items source will be plotted as a point on the chart. To get this to work with your scenario, one option would be to pre-convert your 2 lists into a list of objects that each hold a matching X and Y value. Or you could implement a custom collection that holds the 2 AxisData instances, and then outputs individual data points made up of an X and Y value taken from the 2 AxisData collections. The XBinding and YBinding properties are directed towards each object within the items source, not the item source itself. This allows you to plot any type of custom object, and let the chart know which property of the object provides the X value, and which provides the Y value (of a single data point). Let me know if you have questions about this. -Jason Fauchelle |
|
|
Hello Jason! Sorry for the late reply, but I is there a way I can use ICustomTypeDestriptor to simulate the properties and point to list that I want to use? I am using a very similar technique that has Row objects (which extends CustomTypeDescriptor) in a List that implements ITypedList. I then have a RowPropertyDescriptor that simulates Properties and returns the data. When I try to use set my Row collection to a series ItemSource, the GetProperties method of my Row object gets called, but it never calls the RowPropertyDescriptor GetValue method? I can send a demo project if this will help? |
|
|
Hello Yes, please send a demo project and I'll be able to find a solution for you. -Jason Fauchelle |
|
|
Here is an installer that shows how my data structure binds with a competing third party control. The solution to this project is attached in the next post. |
|
|
Here is the attached solution so you can see the source code. |
|
|
Thanks for the sample project! In the next nightly build, the data series will support ICustomTypeDescriptor as data points and so your code will just work without requiring any changes. The next nightly build will be available after 1200 GMT and will be downloadable from your account page: http://www.mindscapehq.com/store/myaccount -Jason Fauchelle |
|
|
Hello Jason, That worked fantastic!! This allowed me to greatly reduce the memory requirements in my application when I used an ADO.net DataTable object to hold my data. I went from storing 300,000 data elements to 21,000,000 using less overall memory! Thanks so much! |
|
|
Excellent! I'm glad to hear it worked out so well. -Jason Fauchelle |
|