public void drawVerticalPathPoint(List <PointF> pathData) { int shift = 0; int focusNum = (pathData.Count + 1) / 3; for (int i = 0; i < focusNum; i++) { FastLine Vpath = new FastLine(); Vpath.Color = Color.Black; Vpath.Add(pathData.ElementAt <PointF>(shift)); Vpath.Add(pathData.ElementAt <PointF>((shift + 1))); Vpath.Add(pathData.ElementAt <PointF>((shift + 2))); wavePathDisplay.Series.Add(Vpath); shift += 3; } }
private void BtnPreview_Repair_Click(object sender, EventArgs e) { Tchart_RepairTrend.Show(); Grid_DailyData.Hide(); if (RepairConf.Channel != null) { Tchart_RepairTrend.Axes.Bottom.Labels.DateTimeFormat = "yyyy\nM.d"; Tchart_RepairTrend.Series.Clear(); var overrideConf = RepairConf.Channel.Overrides.Where(x => x.OverrideName.Equals(RepairConf.AlarmReferenceName)).FirstOrDefault(); float[] alarms = null; if (overrideConf != null) { alarms = overrideConf.AlarmValues; AddAlarmLineToTrendChart(alarms, Tchart_RepairTrend, true); } switch ((ScaleType)RepairConf.ScaleTypeIdx) { case ScaleType.Auto: Tchart_RepairTrend.Axes.Left.AutomaticMaximum = true; break; case ScaleType.Alarm: Tchart_RepairTrend.Axes.Left.AutomaticMaximum = false; if (alarms != null) { Tchart_RepairTrend.Axes.Left.Maximum = alarms.Last(); } break; case ScaleType.Custom: Tchart_RepairTrend.Axes.Left.AutomaticMaximum = false; Tchart_RepairTrend.Axes.Left.Maximum = RepairConf.MaxScale; break; } Tchart_RepairTrend.Header.Lines = new string[] { RepairConf.Channel.PointName }; colorBand1.Start = RepairConf.BeforeRepairDate.ToOADate(); colorBand1.End = RepairConf.AfterRepairDate.ToOADate(); RepairConf.StartDate = RepairConf.BeforeRepairDate.AddDays(-1 * RepairConf.RepairOffsetDay); RepairConf.EndDate = RepairConf.AfterRepairDate.AddDays(RepairConf.RepairOffsetDay); foreach (var dataTable in DBConn.LoadRepairData(RepairConf)) { FastLine fastline = new FastLine() { Title = dataTable.TableName }; Tchart_RepairTrend.Series.Add(fastline); foreach (DataRow data in dataTable.Rows) { fastline.Add((DateTime)data.ItemArray[0], Convert.ToDouble(data.ItemArray[1])); } } } }
public FastLineChart(ChartView BaseChart) { fastLine1 = new FastLine(); fastLine2 = new FastLine(); var = new Variables.Variables(); BaseChart.Chart.Header.Text = "Fast random picture"; BaseChart.Chart.Series.Add(fastLine1); BaseChart.Chart.Series.Add(fastLine2); BaseChart.Chart.Legend.Visible = false; fastLine1.SeriesColor = var.GetPaletteBasic[0]; fastLine1.Chart.Zoom.Allow = false; fastLine1.Chart.Panning.Allow = ScrollModes.None; fastLine1.RecalcOptions = RecalcOptions.OnModify; fastLine1.DefaultNullValue = 0; fastLine1.AutoRepaint = true; fastLine1.VertAxis = VerticalAxis.Both; fastLine1.HorizAxis = HorizontalAxis.Both; /*for (int i = 0; i < var.GetValorBubble1.Length; i++) * { * fastLine1.Add(var.GetValorBubbleX[i], var.GetValorBubble1[i], var.GetPaletteBasic[i]); * }*/ fastLine2.Title = "fastLine2"; fastLine2.SeriesColor = var.GetPaletteBasic[1]; fastLine2.Chart.Zoom.Allow = false; fastLine2.Chart.Panning.Allow = ScrollModes.None; fastLine2.AutoRepaint = true; fastLine2.RecalcOptions = RecalcOptions.OnModify; fastLine2.DefaultNullValue = 0; Random r = new Random(); int tmprandom; for (int t = 1; t < 1000; t++) { tmprandom = r.Next(Math.Abs(500 - t)) - (Math.Abs(500 - t) / 2); fastLine1.Add(1000 - t + tmprandom); fastLine2.Add(t + tmprandom); } fastLine2.VertAxis = VerticalAxis.Both; fastLine2.HorizAxis = HorizontalAxis.Both; fastLine2.Title = "fastLine2"; BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 5, BaseChart.Chart.Axes.Left.MaxYValue + 5); BaseChart.Chart.Axes.Bottom.SetMinMax(0, BaseChart.Chart.Axes.Bottom.MaxXValue + 3); BaseChart.Chart.Axes.Bottom.Increment = 5; BaseChart.Chart.Axes.Left.Increment = 15; BaseChart.Chart.Axes.Left.Labels.ValueFormat = "0K"; BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0"; BaseChart.Chart.Axes.Left.Title.Pen = new ChartPen { Color = Color.Black, Width = 15 }; BaseChart.Chart.Axes.Left.Title.Visible = false; BaseChart.Chart.Axes.Bottom.Title.Visible = false; BaseChart.Chart.Axes.Left.Visible = true; BaseChart.Chart.Axes.Left.AxisPen.Visible = true; BaseChart.Chart.Axes.Left.Ticks = new Axis.TicksPen { Width = 2, Visible = true, Color = Color.FromArgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10, }; BaseChart.Chart.Axes.Bottom.Visible = true; BaseChart.Chart.Axes.Left.Title.Angle = 90; BaseChart.Chart.Axes.Left.Grid.Visible = false; BaseChart.Chart.ClickSeries += null; BaseChart.Chart.Panel.MarginLeft = 5; // Themes Marks Themes.AplicarMarksTheme1(BaseChart); }
private void BtnPreview_MultPointTrend_Click(object sender, EventArgs e) { if (MultiPointConf.CommonBandpassList.Count > 0) { Tchart_Trend.Series.Clear(); var point = MultiPointConf.SelectedChannelList.Where(x => x.PointName.Equals(MultiPointConf.AlarmReferenceName)).First(); var alarms = point.Overrides.Where(x => x.OverrideName == MultiPointConf.SelectedBandpass.DisplayName).First().AlarmValues; AddAlarmLineToTrendChart(alarms, Tchart_Trend); switch ((ScaleType)MultiPointConf.ScaleTypeIdx) { case ScaleType.Auto: Tchart_Trend.Axes.Left.AutomaticMaximum = true; break; case ScaleType.Alarm: Tchart_Trend.Axes.Left.AutomaticMaximum = false; Tchart_Trend.Axes.Left.Maximum = alarms.Last(); break; case ScaleType.Custom: Tchart_Trend.Axes.Left.AutomaticMaximum = false; Tchart_Trend.Axes.Left.Maximum = MultiPointConf.MaxScale; break; } Tchart_Trend.Header.Lines = new string[] { MultiPointConf.SelectedBandpass.OverrideInfo.OverrideName }; switch (MultiPointConf.StatTermType) { case "day": foreach (var dataTable in DBConn.LoadMultiPointTrendData(MultiPointConf)) { FastLine fastline = new FastLine() { Title = dataTable.TableName }; Tchart_Trend.Series.Add(fastline); foreach (DataRow data in dataTable.Rows) { fastline.Add(Convert.ToDouble(data.ItemArray[3]), data.ItemArray[0].ToString() + "\n" + data.ItemArray[1].ToString() + "." + data.ItemArray[2].ToString()); } } break; case "week": foreach (var dataTable in DBConn.LoadMultiPointTrendData(MultiPointConf)) { FastLine fastline = new FastLine() { Title = dataTable.TableName }; Tchart_Trend.Series.Add(fastline); foreach (DataRow data in dataTable.Rows) { fastline.Add(Convert.ToDouble(data.ItemArray[2]), data.ItemArray[0].ToString() + "\n" + data.ItemArray[1].ToString() + " Week"); } } break; case "month": foreach (var dataTable in DBConn.LoadMultiPointTrendData(MultiPointConf)) { FastLine fastline = new FastLine() { Title = dataTable.TableName }; Tchart_Trend.Series.Add(fastline); foreach (DataRow data in dataTable.Rows) { fastline.Add(Convert.ToDouble(data.ItemArray[2]), data.ItemArray[0].ToString() + "\n" + data.ItemArray[1].ToString() + " Month"); } } break; } } }
private void BtnPreview_MultiBandTrend_Click(object sender, EventArgs e) { if (MultiBandConf.Channel != null) { Tchart_Trend.Series.Clear(); var overrideConf = MultiBandConf.Channel.Overrides.Where(x => x.OverrideName.Equals(MultiBandConf.AlarmReferenceName)).FirstOrDefault(); float[] alarms = null; if (overrideConf != null) { alarms = overrideConf.AlarmValues; AddAlarmLineToTrendChart(alarms, Tchart_Trend); } switch ((ScaleType)MultiBandConf.ScaleTypeIdx) { case ScaleType.Auto: Tchart_Trend.Axes.Left.AutomaticMaximum = true; break; case ScaleType.Alarm: Tchart_Trend.Axes.Left.AutomaticMaximum = false; if (alarms != null) { Tchart_Trend.Axes.Left.Maximum = alarms.Last(); } break; case ScaleType.Custom: Tchart_Trend.Axes.Left.AutomaticMaximum = false; Tchart_Trend.Axes.Left.Maximum = MultiBandConf.MaxScale; break; } Tchart_Trend.Header.Lines = new string[] { MultiBandConf.Channel.PointName }; switch (MultiBandConf.StatTermType) { case "day": foreach (var dataTable in DBConn.LoadMultiBandpassTrendData(MultiBandConf)) { FastLine fastline = new FastLine() { Title = dataTable.TableName }; Tchart_Trend.Series.Add(fastline); foreach (DataRow data in dataTable.Rows) { fastline.Add(Convert.ToDouble(data.ItemArray[3]), data.ItemArray[0].ToString() + "\n" + data.ItemArray[1].ToString() + "." + data.ItemArray[2].ToString()); } } break; case "week": foreach (var dataTable in DBConn.LoadMultiBandpassTrendData(MultiBandConf)) { FastLine fastline = new FastLine() { Title = dataTable.TableName }; Tchart_Trend.Series.Add(fastline); foreach (DataRow data in dataTable.Rows) { fastline.Add(Convert.ToDouble(data.ItemArray[2]), data.ItemArray[0].ToString() + "\n" + data.ItemArray[1].ToString() + " Week"); } } break; case "month": foreach (var dataTable in DBConn.LoadMultiBandpassTrendData(MultiBandConf)) { FastLine fastline = new FastLine() { Title = dataTable.TableName }; Tchart_Trend.Series.Add(fastline); foreach (DataRow data in dataTable.Rows) { fastline.Add(Convert.ToDouble(data.ItemArray[2]), data.ItemArray[0].ToString() + "\n" + data.ItemArray[1].ToString() + " Month"); } } break; } } }
public void SetChartLine(Detector detector, DATA_TYPE type, float[] bufData) { if ((bufData == null) || (bufData.Length == 0)) { return; } try { FastLine line = new FastLine(); int dataLength = bufData.Length; tChart.AutoRepaint = false; line.LinePen.UseStyling = true; line.Legend.Visible = true; line.Legend.AutoSize = false; line.Legend.Text = "Детектор " + detector.Number; line.Tag = detector.Id; switch (type) { case DATA_TYPE.BASE: for (i = 0; i < dataLength; i++) { decimalValue = System.Convert.ToDouble(bufData[i]); y = Math.Round(decimalValue, 4); line.Add(i, y); } line.Color = getChannelColor(detector.Id, DATA_TYPE.BASE); break; case DATA_TYPE.FFT: case DATA_TYPE.FFT_S: float kf = MainForm.SamplingFrequency[detector.Info.D] / (float)Math.Pow(2.0, detector.Order); for (i = 0; i < dataLength; i++) { decimalValue = System.Convert.ToDouble(bufData[i]); y = Math.Round(decimalValue, 4); line.Add(i * kf, y); } line.Color = getChannelColor(detector.Id, DATA_TYPE.FFT); break; } line.Legend.Color = line.Color; if (MainForm.mode == MODE.BASE) { tChart.Series.Add(line); } else { if (tChart.Series.Count < (MainForm.detectors.Count + Circle.detectorIndexes.Count())) { tChart.Series.Add(line); } else { tChart.Series.RemoveAt(MainForm.detectors.Count); tChart.Series.Add(line); SetCircleMeasurement(); } tChart.Refresh(); } tChart.AutoRepaint = true; } catch (Exception e) { MessageBox.Show("Error by set data to chart. " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public FLineRealTimeChartFeatures(ChartView BaseChart) { fastLine1 = new FastLine(); fastLine2 = new FastLine(); var = new Variables.Variables(); this.BaseChart = BaseChart; pointsCreate = 0; BaseChart.Chart.Header.Text = "Fast random picture"; BaseChart.Chart.Series.Add(fastLine1); BaseChart.Chart.Series.Add(fastLine2); BaseChart.Chart.Legend.Visible = false; fastLine1.SeriesColor = var.GetPaletteBasic[0]; fastLine1.Chart.Zoom.Allow = false; fastLine1.Chart.Panning.Allow = ScrollModes.None; fastLine1.RecalcOptions = RecalcOptions.OnModify; fastLine1.DefaultNullValue = 0; fastLine1.AutoRepaint = true; fastLine1.VertAxis = VerticalAxis.Both; fastLine1.HorizAxis = HorizontalAxis.Both; fastLine2.SeriesColor = var.GetPaletteBasic[var.GetPaletteBasic.Length - 1]; fastLine2.Chart.Zoom.Allow = false; fastLine2.Chart.Panning.Allow = ScrollModes.None; fastLine2.RecalcOptions = RecalcOptions.OnModify; fastLine2.DefaultNullValue = 0; fastLine2.AutoRepaint = true; fastLine2.VertAxis = VerticalAxis.Both; fastLine2.HorizAxis = HorizontalAxis.Both; Random r = new Random(); int tmprandom; for (int t = 1; t < 1000; t++) { tmprandom = r.Next(Math.Abs(500 - t)) - (Math.Abs(500 - t) / 2); fastLine1.Add(1000 - t + tmprandom); fastLine2.Add(t + tmprandom); } BaseChart.Chart.Axes.Left.SetMinMax(BaseChart.Chart.Axes.Left.MinYValue - 100, BaseChart.Chart.Axes.Left.MaxYValue + 100); BaseChart.Chart.Axes.Bottom.SetMinMax(0, BaseChart.Chart.Axes.Bottom.MaxXValue + 3); BaseChart.Chart.Axes.Bottom.Increment = 5; BaseChart.Chart.Axes.Left.Increment = 15; BaseChart.Chart.Axes.Left.Labels.ValueFormat = "0K"; BaseChart.Chart.Axes.Bottom.Labels.ValueFormat = "0"; BaseChart.Chart.Axes.Left.Title.Pen = new ChartPen { Color = Xamarin.Forms.Color.Black, Width = 15 }; BaseChart.Chart.Axes.Left.Title.Visible = false; BaseChart.Chart.Axes.Bottom.Title.Visible = false; BaseChart.Chart.Axes.Left.Visible = true; BaseChart.Chart.Axes.Left.AxisPen.Visible = true; BaseChart.Chart.Axes.Left.Ticks = new Axis.TicksPen { Width = 2, Visible = true, Color = Xamarin.Forms.Color.FromRgb(200, 200, 200), EndCap = PenLineCap.Flat, Style = DashStyle.Solid, Length = 10, }; BaseChart.Chart.Axes.Bottom.Visible = true; BaseChart.Chart.Axes.Left.Title.Angle = 90; BaseChart.Chart.Axes.Left.Grid.Visible = false; BaseChart.Chart.ClickSeries += null; BaseChart.Chart.Panel.MarginLeft = 5; BaseChart.Chart.AfterDraw += Chart_AfterDraw; // Themes Marks Themes.AplicarMarksTheme1(BaseChart); }
private void Chart_AfterDraw(object sender, Graphics3D g) { //Timer = new BaseTimer(100); //Timer.StartTimer(new Func<bool>(TimerFunction)); Device.StartTimer(TimeSpan.FromMilliseconds(200), () => { if (fastLine1 != null && fastLine2 != null && numMaxim == false) { fastLine1.Clear(); fastLine2.Clear(); for (int t = 0; t < 1000; t++) { tmprandom = r.Next(Math.Abs(500 - t)) - (Math.Abs(500 - t) / 2); fastLine1.Add(1000 - t + tmprandom); fastLine2.Add(t + tmprandom); } fastLine1.Color = var.GetPaletteBasic[color]; fastLine2.Color = var.GetPaletteBasic[var.GetPaletteBasic.Length - 1 - color]; color++; if (color == 8) { color = 0; } pointsCreate += 2000; return(false); } else { return(true); } }); if (pointsCreate < Int32.MaxValue - 2000) { BaseChart.Chart.Header.Text = pointsCreate.ToString() + " points created in " + (Math.Round((double)((pointsCreate / 6.20) / 1000), 0)).ToString() + " seconds"; } else { numMaxim = true; BaseChart.Chart.Header.Text = "Finish"; } /* * int tmprandom; * bool repeat; * int numRepeat; * int colorReapeat; * Random r; * private bool TimerFunction() * { * * if (!repeat) * { * * fastLine1.Clear(); * * for (int t = 1; t < 1000; t++) * { * tmprandom = r.Next(Math.Abs(500 - t)) - (Math.Abs(500 - t) / 2); * fastLine1.Add(1000 - t + tmprandom); * } * * //if(numRepeat % var.GetPaletteBasic.Length == ) { } * * numRepeat++; * * return false; * * } * else { return true; } * * } */ }