public void ImportLineData(ArrayList values1, ArrayList values2) { dsc = new DataSeriesCollection(); DataSeries ds1 = new DataSeries(); ds1.RenderAs = RenderAs.Line; ds1.LegendText = "ObjValue"; for (int i = 0; i < values1.Count; i = i + 4) { DataPoint dp = new DataPoint(); dp.YValue = (double)values1[i]; dp.XValue = i; ds1.DataPoints.Add(dp); } DataSeries ds2 = new DataSeries(); ds2.RenderAs = RenderAs.Line; ds2.LegendText = "Variance"; for (int i = 0; i < values2.Count; i = i + 4) { DataPoint dp = new DataPoint(); dp.YValue = (double)values2[i]; dp.XValue = i; ds2.DataPoints.Add(dp); } dsc.Add(ds1); dsc.Add(ds2); }
public void ImportLineData(ArrayList values1, ArrayList values2, ArrayList values4) { dsc = new DataSeriesCollection(); DataSeries ds1 = new DataSeries(); ds1.RenderAs = RenderAs.Line; ds1.LegendText = "Sum"; for (int i = 0; i < values1.Count; i = i + 4) { DataPoint dp = new DataPoint(); dp.YValue = (double)values1[i]; dp.XValue = i; ds1.DataPoints.Add(dp); } DataSeries ds2 = new DataSeries(); ds2.RenderAs = RenderAs.Line; ds2.LegendText = "Average"; for (int i = 0; i < values2.Count; i = i + 4) { DataPoint dp = new DataPoint(); dp.YValue = (double)values2[i]; dp.XValue = i; ds2.DataPoints.Add(dp); } //DataSeries ds3 = new DataSeries(); //ds3.RenderAs = RenderAs.Line; //ds3.LegendText = "Variance"; //for (int i = 0; i < values3.Count; i = i + 4) //{ // DataPoint dp = new DataPoint(); // dp.YValue = (double)values3[i]; // dp.XValue = i; // ds3.DataPoints.Add(dp); //} DataSeries ds4 = new DataSeries(); ds4.RenderAs = RenderAs.Line; ds4.LegendText = "ObjValue"; for (int i = 0; i < values4.Count; i = i + 4) { DataPoint dp = new DataPoint(); dp.YValue = (double)values4[i]; dp.XValue = i; ds4.DataPoints.Add(dp); } dsc.Add(ds1); dsc.Add(ds2); //dsc.Add(ds3); dsc.Add(ds4); }
//static int labelCounter = 0; private void AddValuesToPlotData(PlotData[] plotData) { if (!_HoldOn) { ClearPlot(); } var customLabel = CustomPlotLabel.Length > 0 ? "[" + CustomPlotLabel + "] " : ""; foreach (var t in plotData) { var points = t.Points; var title = customLabel + t.Title; Labels.Add(title + customLabel); DataSeriesCollection.Add(new DataPointCollection { DataPoints = points, Title = title, ColorTag = "ColorTag" }); //if (DataSeriesCollection.Count > 0 && points[0] is ComplexDataPoint) //{ // RealLabels.Add(title + "\r(real)" + customLabel); // PhaseLabels.Add(title + "\r(phase)" + customLabel); // ImagLabels.Add(title + "\r(imag)" + customLabel); // AmplitudeLabels.Add(title + "\r(amp)" + customLabel); //} //else //{ // Labels.Add(title + customLabel); // has to happen before updating the bound collection //} } PlotTitles.Add(Title); UpdatePlotSeries(); }
void CreataSampleData(int nser, int npts) { _chart.BeginUpdate(); DataSeriesCollection sc = _chart.Data.Children; sc.Clear(); for (int iser = 0; iser < nser; iser++) { double phase = 0.05 + 0.1 * _rnd.NextDouble(); double amp = 1 + 5 * _rnd.NextDouble(); DataSeries ds = new DataSeries(); double[] vals = new double[npts]; for (int i = 0; i < npts; i++) { vals[i] = amp * Math.Sin(i * phase); } ds.ValuesSource = vals; ds.Label = "S " + iser.ToString(); ds.ConnectionStrokeThickness = 2; sc.Add(ds); } _chart.EndUpdate(); }
public void ImportLineData(ArrayList values) { dsc = new DataSeriesCollection(); DataSeries ds = new DataSeries(); ds.RenderAs = RenderAs.Line; foreach (Object value in values) { DataPoint dp = new DataPoint(); dp.YValue = (double)value; ds.DataPoints.Add(dp); } dsc.Add(ds); }
private void MonthChart(IEnumerable <ProductivityModel> productivityModels) { var dataSeries = new DataSeriesCollection(); var recruiters = Recruiter == null ? Recruiters : Recruiters.Where(r => r.Id == Recruiter.Id); foreach (var recruiter in recruiters) { var items = productivityModels.Where(p => p.RecruiterFullName == recruiter.FullName); if (items.Any()) { var series = new DataSeries { LegendText = recruiter.FullName, RenderAs = RenderAs.Column }; IEnumerable <DataPoint> dataPoints; dataPoints = !string.IsNullOrEmpty(Week) ? items.GroupBy(i => i.Week, (k, g) => new DataPoint { YValue = g.Count(), AxisXLabel = k }) : items.GroupBy(i => i.Month, (k, g) => new DataPoint { YValue = g.Count(), AxisXLabel = k }); foreach (var point in dataPoints) { series.DataPoints.Add(point); } dataSeries.Add(series); } } ChartSource = dataSeries; if (ChartUpdated != null) { ChartUpdated(this, EventArgs.Empty); } }
//static int labelCounter = 0; private void AddValuesToPlotData(PlotData[] plotData) { if (!_HoldOn) { ClearPlot(); } foreach (var t in plotData) { var points = t.Points; var title = t.Title; Labels.Add(title); DataSeriesCollection.Add(new DataPointCollection { DataPoints = points, Title = title, ColorTag = "ColorTag" }); PlotTitles.Add(Title); } UpdatePlotSeries(); }
private void MonthChart(IEnumerable<ProductivityModel> productivityModels) { var dataSeries = new DataSeriesCollection(); var recruiters = Recruiter == null ? Recruiters : Recruiters.Where(r => r.Id == Recruiter.Id); foreach (var recruiter in recruiters) { var items = productivityModels.Where(p => p.RecruiterFullName == recruiter.FullName); if (items.Any()) { var series = new DataSeries { LegendText = recruiter.FullName, RenderAs = RenderAs.Column }; IEnumerable<DataPoint> dataPoints; dataPoints = !string.IsNullOrEmpty(Week) ? items.GroupBy(i => i.Week, (k, g) => new DataPoint { YValue = g.Count(), AxisXLabel = k }) : items.GroupBy(i => i.Month, (k, g) => new DataPoint { YValue = g.Count(), AxisXLabel = k }); foreach (var point in dataPoints) series.DataPoints.Add(point); dataSeries.Add(series); } } ChartSource = dataSeries; if (ChartUpdated != null) ChartUpdated(this, EventArgs.Empty); }