I seem unable to find sample code showing how to use that chart control in ReportViewer with more that one data serie. I want to plot Setpoint and Feedback from an Engine in the same reportviewer, but I have no idea on how to go about it.
I have a few custom objects that I use as datasource.
public class Point2D
{
public double Value { get; private set; }
public DateTime DateTime { get; private set; }
public Point2D( double value, DateTime datetime)
{
Value = value;
DateTime = datetime;
}
}
and an Engine class
public class Engine
{
public Engine(string Name)
{
this.Name = Name;
Setpoint = new List<Point2D>();
Feedback = new List<Point2D>();
Estimate = new List<Point2D>();
foreach(int i in Enumerable.Range(0,101))
{
DateTime dt = DateTime.Now;
double d = i / 100.0;
Setpoint.Add(new Point2D(d, dt.AddSeconds(i)));
Feedback.Add(new Point2D(d, dt.AddSeconds(i)));
Estimate.Add(new Point2D(d, dt.AddSeconds(i)));
}
}
public string Name { get; private set; }
public List<Point2D> Setpoint { get; private set; }
public List<Point2D> Feedback { get; private set; }
public List<Point2D> Estimate { get; private set; }
}
I have added the Point2D as a datasource
<GenericObjectDataSource DisplayName="Point2D" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>Point2D, ReportViewer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>
Added a reportViwer to my project, and inserted a graph (line) to the report used the Point2D from ReportData and dragged that into the graph. Now i set the datasource "binding"
this.Point2DBindingSource.DataSource = tdDataSource.Engines.First().Setpoint;
This works just fine. Showing me one series.
How do I go about adding the Feedback into the same graph?