Hi,
I see that all examples use DataTable as the Data Source of Chart.
First, is it possible to use BindingList, and assign it to the DataSource of Chart?
If possible, how can we specify both x and y axis of the Chart? I have a binding source, which has two columns (X and Y), and each row represents a distinct set of X and Y that should be plotted as one line graph.
I have tried assiging my bindinglist to the data source of the chart, but everytime I did it, it only set the y axis, and x axis was not. (I don't even get what column from the binding list that the chart plotted as y axis)
Many Thanks in Advance
Set the ChartType to ScatterChart and ScatterChart.ConnectWithLines = true.
A line chart has either time or just strings on the x-axis, whereas a scatter chart has numeric x and y axes.
With you answer above - does this imply I can use a Line chart for plotting numeric vs date Information ? I am using IBinding List and have swapped the axis but cannot see how I tell the chart to derive my x-axis from a particular column (DateTime). Can you advise ? Thanks in advance
Ah, using a DateTime property complicates things a bit. Try changing the ChartType back to LineChart and set LineChart.TreatDateTimeAsString = false.
You can't tell the chart which property or column to use, but if you have only a DateTime and Numeric column, the line chart should know what to do.
If you find it's using the wrong columns, try implementing ICustomTypeDescriptor and returning only the properties needed by the chart in the ICustomTypeDescriptor.GetProperties method.