1
Answer

DataVisualization.Charting control

Andrew

Andrew

13y
1.9k
1
Hi All,

Basically I am trying to plot multiple lines on a line chart. The data flow is as follows:

1. The user selects a year and month and clicks a button "Plot Line 1".
2. I retrieve a count of records in a table where CreatedDate falls within the chosen month.
3. I return the results to a dataTable.
4. I bind the dataTable to the chart with the "Date" field as the XValueMember and "Count" as the YValueMember.

This all works great for plotting a single line on the chart.

But when i try to do the same for "Plot Line 2" button the chart rebinds to the Line 2 data and i lose my first plotted line (obviously).

So how do i plot 2 lines on the chart each fired off a different button click supplying separate results in a datatable for the X and Y values?

Real-life example is a user selecting June 2011 for button 1 and July 2011 for button 2 to see a visual comparison using the lines on the chart.

Thanks for your time :)
Answers (1)