This project is read-only.

Two Dynamic lines with separate scales

Oct 28, 2009 at 10:32 PM

Good day,

I'm trying to crate a chart that will display 2 linegraphs on a single plotter. Both lines should have their own scale. I had a look at the sample that is available for two lines with two scales, but it seems like they need to have the same xDatasource.

Can you please give me some ideas how I can go about doing this with a dynamic Ydatasource?

I would think that you will have to have 5 datasources, x, y1, y2, xy1 and xy2. You would then increment x, add the new values to y1 & y2. However I have not been able to find a way to just add values to x, y1 & y2. it seems like you have to re-create them.

please let me know if their is an easier way to do this.

Thanks & Regards

Cornelius Kruger


Oct 31, 2009 at 4:38 AM

Hi Cornelius,

there is no need in having common x-dataSource for charts.

To make data dynamic simple create ObservableCollections for you data, as it has CollectionChanged event we are using. Then wrap this collection by, for example, y-DataSource, and assign to LineChart.

So you have to have 4 dataSources of double - x1, y1, y_for_x1 and y_for_x2.

This should work.