public ChartZooming() { InitializeComponent(); cs = new ChartStyle(); cs.Xmin = xmin0; cs.Xmax = xmax0; cs.Ymin = ymin0; cs.Ymax = ymax0; }
public RetrieveChartData() { InitializeComponent(); cs = new ChartStyle(); cs.Xmin = xmin0; cs.Xmax = xmax0; cs.Ymin = ymin0; cs.Ymax = ymax0; }
private void AddChart(double xmin, double xmax, double ymin, double ymax) { dc = new DataCollection(); ds = new DataSeries(); cs = new ChartStyle(); cs.ChartCanvas = chartCanvas; cs.TextCanvas = textCanvas; cs.Title = "Sine and Cosine Chart"; cs.Xmin = xmin; cs.Xmax = xmax; cs.Ymin = ymin; cs.Ymax = ymax; cs.GridlinePattern = ChartStyle.GridlinePatternEnum.Dot; cs.GridlineColor = Brushes.Black; cs.AddChartStyle(tbTitle, tbXLabel, tbYLabel); // Draw Sine curve: ds.LineColor = Brushes.Blue; ds.LineThickness = 2; double dx = (cs.Xmax - cs.Xmin) / 100; for (double x = cs.Xmin; x <= cs.Xmax + dx; x += dx) { double y = Math.Exp(-0.3 * Math.Abs(x)) * Math.Sin(x); ds.LineSeries.Points.Add(new Point(x, y)); } dc.DataList.Add(ds); // Draw cosine curve: ds = new DataSeries(); ds.LineColor = Brushes.Red; ds.LinePattern = DataSeries.LinePatternEnum.DashDot; ds.LineThickness = 2; for (double x = cs.Xmin; x <= cs.Xmax + dx; x += dx) { double y = Math.Exp(-0.3 * Math.Abs(x)) * Math.Cos(x); ds.LineSeries.Points.Add(new Point(x, y)); } dc.DataList.Add(ds); dc.AddLines(cs); }
public void AddLines(ChartStyle cs) { int j = 0; foreach (DataSeries ds in DataList) { if (ds.SeriesName == "Default Name") { ds.SeriesName = "DataSeries" + j.ToString(); } ds.AddLinePattern(); 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++; } }
private void AddChart(double xmin, double xmax, double ymin, double ymax) { dc = new DataCollection(); ds = new DataSeries(); cs = new ChartStyle(); cs.ChartCanvas = chartCanvas; cs.TextCanvas = textCanvas; cs.Title = "Sine and Cosine Chart"; cs.Xmin = xmin; cs.Xmax = xmax; cs.Ymin = ymin; cs.Ymax = ymax; cs.GridlinePattern = ChartStyle.GridlinePatternEnum.Dot; cs.GridlineColor = Brushes.Black; cs.AddChartStyle(tbTitle, tbXLabel, tbYLabel); // Draw Sine-like curve: ds.LineColor = Brushes.Blue; ds.LineThickness = 2; double dx = (cs.Xmax - cs.Xmin) / 100; for (double x = cs.Xmin; x <= cs.Xmax + dx; x += dx) { double y = Math.Exp(-0.3 * Math.Abs(x)) * Math.Sin(x); ds.LineSeries.Points.Add(new Point(x, y)); } dc.DataList.Add(ds); Ellipse circle = new Ellipse(); circle.Width = 8; circle.Height = 8; circle.Margin = new Thickness(2); circle.Fill = ds.LineColor; labelCircles.Add(circle); TextBlock tb = new TextBlock(); tb.Text = "Y0 Value"; tb.FontSize = 10; tb.Margin = new Thickness(2); labelResults.Add(tb); circle = new Ellipse(); circle.Width = 8; circle.Height = 8; circle.Fill = ds.LineColor; circle.Visibility = Visibility.Hidden; circles.Add(circle); // Draw Cosine-like curve: ds = new DataSeries(); ds.LineColor = Brushes.Red; ds.LinePattern = DataSeries.LinePatternEnum.DashDot; ds.LineThickness = 2; for (double x = cs.Xmin; x <= cs.Xmax + dx; x += dx) { double y = Math.Exp(-0.3 * Math.Abs(x)) * Math.Cos(x); ds.LineSeries.Points.Add(new Point(x, y)); } dc.DataList.Add(ds); dc.AddLines(cs); circle = new Ellipse(); circle.Width = 8; circle.Height = 8; circle.Margin = new Thickness(2, 2, 2, 2); circle.Fill = ds.LineColor; labelCircles.Add(circle); tb = new TextBlock(); tb.Text = "Y1 Value"; tb.FontSize = 10; tb.Margin = new Thickness(2); labelResults.Add(tb); circle = new Ellipse(); circle.Width = 8; circle.Height = 8; circle.Fill = ds.LineColor; circle.Visibility = Visibility.Hidden; circles.Add(circle); xCoordinate.Text = "X Value"; xCoordinate.FontSize = 10; xCoordinate.Margin = new Thickness(2); resultPanel.Children.Add(xCoordinate); for (int i = 0; i < dc.DataList.Count; i++) { chartCanvas.Children.Add(circles[i]); Canvas.SetTop(circles[i], 0); Canvas.SetLeft(circles[i], 0); resultPanel.Children.Add(labelCircles[i]); resultPanel.Children.Add(labelResults[i]); } }