하나 이상의 데이터 세리가있는 ReportViewer에서 해당 차트 컨트롤을 사용하는 방법을 보여주는 샘플 코드를 찾을 수 없습니다. 동일한 reportviewer에서 엔진의 Setpoint 및 Feedback을 플로팅하고 싶지만 어떻게 진행해야할지 모릅니다.두 개 이상의 계열이 포함 된 C#의 ReportViewer 차트
데이터 원본으로 사용하는 몇 가지 사용자 지정 개체가 있습니다.
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;
}
}
및
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; }
}
내가 데이터 소스
<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>
추가 내 프로젝트에 reportViwer로하는 Point2D를 추가 한 엔진 클래스 및 보고서에 그래프 (선) 삽입 ReportData에서 Point2D를 사용하여 그래프로 드래그했습니다. 이제 데이터 소스 "바인딩"을 설정했습니다.
this.Point2DBindingSource.DataSource = tdDataSource.Engines.First().Setpoint;
잘 작동합니다. 한 시리즈를 보여줍니다.
피드백을 동일한 그래프에 추가하려면 어떻게해야합니까?