public static Point NormalizePoint(this IChartStyle style, Point point) { if (style.ChartCanvas.Width.ToString() == "NaN") { style.ChartCanvas.Width = 270; } if (style.ChartCanvas.Height.ToString() == "NaN") { style.ChartCanvas.Height = 250; } return(new Point { X = (int)((point.X - style.Xmin) * style.ChartCanvas.Width / (style.Xmax - style.Xmin)), Y = (int)(style.ChartCanvas.Height - (point.Y - style.Ymin) * style.ChartCanvas.Height / (style.Ymax - style.Ymin)) }); }
public void AddLines(IChartStyle cs) { int j = 0; foreach (DataSeries ds in DataList) { if (ds.SeriesName == "Default Name") ds.SeriesName = "DataSeries" + j; ds.AddLinePattern(ds.LineSeries); for (int i = 0; i < ds.LineSeries.Points.Count; i++) { ds.LineSeries.Points[i] = cs.NormalizePoint(ds.LineSeries.Points[i]); } cs.ChartCanvas.Children.Add(ds.LineSeries); j++; } }
public void AddLines(IChartStyle cs) { int j = 0; foreach (DataSeries ds in DataList) { if (ds.SeriesName == "Default Name") { ds.SeriesName = "DataSeries" + j; } ds.AddLinePattern(ds.LineSeries); for (int i = 0; i < ds.LineSeries.Points.Count; i++) { ds.LineSeries.Points[i] = cs.NormalizePoint(ds.LineSeries.Points[i]); } cs.ChartCanvas.Children.Add(ds.LineSeries); j++; } }