public PVOProFunctionChart(ChartView BaseChart) { volume = new Volume(); fastLine = new FastLine(); pvoFunction = new PVOFunction(); var = new Variables.Variables(); BaseChart.Chart.Axes.Left.Automatic = true; BaseChart.Chart.Axes.Bottom.Automatic = true; BaseChart.Chart.Axes.Left.Ticks.Transparency = 100; BaseChart.Chart.Axes.Left.AxisPen.Visible = true; BaseChart.Chart.Axes.Left.Increment = 10; volume.FillSampleValues(15); volume.Color = var.GetPaletteBasic[0]; volume.LinePen.Width = 3; volume.Title = "Volume"; fastLine.Color = var.GetPaletteBasic[1]; fastLine.DataSource = volume; fastLine.Function = pvoFunction; fastLine.LinePen.Width = 3; fastLine.Title = "FastLine"; pvoFunction.Period = 12; BaseChart.Chart.Series.Add(volume); BaseChart.Chart.Series.Add(fastLine); }
private void btnStart_Click(object sender, EventArgs e) { foreach (var serise in TimeChart.Series) { (serise as FastLine).Clear(); } foreach (var serise in FFTChart.Series) { (serise as FastLine).Clear(); } TrendChart.Series.Clear(); btnStart.Enabled = false; btnStop.Enabled = true; SelectedReceiver = lb_Receiver.SelectedItem as IHeritableWavesReceiver; foreach (var m in MeasureList) { FastLine line = new FastLine() { Title = "Ch" + (m.GetChannelIdx() + 1) + " " + m.ToString().Replace("TestCms1.", "").Replace("Measure", "") }; TrendChart.Series.Add(line); } if (SelectedReceiver != null) { SelectedReceiver.Start(); } foreach (var recoder in RecoderList) { recoder.Start(); } }
void bindDataWpf() { Chart.Series.Clear(); Chart.Visibility = Visibility.Visible; Chart.Aspect.View3D = false; Chart.Header.Font.Size = 16; Chart.Header.Text = "FastLine Example"; Chart.Axes.Left.AutomaticMaximum = true; Chart.Axes.Left.AutomaticMinimum = true; Chart.Axes.Left.Increment = 1000; Chart.Panel.Gradient.Visible = false; Chart.Panel.Brush.Transparency = 100; Chart.Panel.Bevel.Inner = BevelStyles.None; Chart.Panel.Bevel.Outer = BevelStyles.None; FastLine line = new FastLine(Chart.Chart) { Title = "Example FastLine 1", Color = Color.FromRgb(0xfa, 0x68, 0x00), }; line.Marks.Arrow.Visible = false; line.Marks.Brush.Visible = false; line.Marks.Pen.Visible = false; Chart.Chart.ToolTip.InitialDelay = 500; Chart.Chart.ToolTip.BackColor = Color.FromRgb(0x25, 0x25, 0x25); Chart.Chart.ToolTip.ForeColor = Color.FromRgb(0xFF, 0xFF, 0xFF); line.XValues.DataMember = "Argument"; line.YValues.DataMember = "Value"; line.DataSource = chartSource; }
private void InitializeChart() { tChart1.Header.Text = "Scroll Pager Tool"; tChart1.Series.Add(series = new FastLine()); series.FillSampleValues(1000); tChart1.Tools.Add(tool = new ScrollPager()); tChart1.Tools.Add(point = new NearestPoint()); tChart1.Tools.Add(annotate = new Annotation()); point.Brush.Color = tool.PointerHighlightColor; point.DrawLine = false; point.Size = 6; point.Direction = NearestPointDirection.Horizontal; point.Series = series; point.Change += new EventHandler(point_Change); annotate.Position = AnnotationPositions.RightTop; annotate.Text = "YValue:"; annotate.Shape.Shadow.Visible = false; annotate.Shape.Font.Color = tChart1.Header.Font.Color; annotate.Shape.Color = tool.PointerHighlightColor; annotate.Shape.Pen.Visible = false; annotate.TextAlign = StringAlignment.Center; Theme.ApplyChartTheme(typeof(FlatTheme), tool.SubChartTChart.Chart); }
void bindData() { FastLine fastLine = new FastLine(chart.Chart); fastLine.XValues.DataMember = "Argument"; fastLine.YValues.DataMember = "Value"; fastLine.DataSource = chartSource; }
private void InitializeChart() { tChart1.Frame = this.View.Frame; tChart1.Header.Text = "Scroll Pager Tool"; tChart1.Panning.Active = true; tChart1.Series.Add(series = new FastLine()); series.FillSampleValues(1000); tChart1.Tools.Add(tool = new ScrollPager()); for (int i = 0; i < tChart1.Series.Count; i++) { if (tChart1.Series[i].Count > 0) { tool.Series = tChart1.Series[i]; } } tool.ColorBandTool.StartLine.AllowDrag = true; tool.ColorBandTool.EndLine.AllowDrag = true; tool.ColorBandTool.StartLine.Active = true; tool.ColorBandTool.EndLine.Active = true; tChart1.Tools.Add(colorlinetool = new ColorLine()); colorlinetool.Value = 100; colorlinetool.AllowDrag = true; colorlinetool.Pen.Color = Color.Blue; tChart1.ClickBackground += TChart1_ClickBackground; tChart1.Tools.Add(point = new NearestPoint()); tChart1.Tools.Add(annotate = new Annotation()); point.Brush.Color = tool.PointerHighlightColor; point.DrawLine = false; point.Size = 6; point.Direction = NearestPointDirection.Horizontal; point.Series = series; point.Change += Point_Change; annotate.Position = AnnotationPositions.RightTop; annotate.Text = "YValue:"; annotate.Shape.Shadow.Visible = false; annotate.Shape.Font.Color = Color.Red; annotate.Shape.Color = tool.PointerHighlightColor; annotate.Shape.Font.Size = 15; annotate.Shape.Pen.Visible = false; annotate.Shape.Transparent = true; annotate.TextAlign = CoreText.CTTextAlignment.Center; tChart1.Panel.Gradient.Visible = false; this.View.AddSubview(tChart1); }
/// <summary> /// Constructor for deserializing objects /// </summary> /// <param name="info">A <see cref="SerializationInfo"/> instance that defines the serialized data /// </param> /// <param name="context">A <see cref="StreamingContext"/> instance that contains the serialized data /// </param> protected FastLineItem(SerializationInfo info, StreamingContext context) : base(info, context) { // The schema value is just a file version parameter. You can use it to make future versions // backwards compatible as new member variables are added to classes int sch = info.GetInt32("schema2"); //_symbol = (Symbol)info.GetValue("symbol", typeof(Symbol)); _line = (FastLine)info.GetValue("line", typeof(FastLine)); }
private void AddPoint(double value, string counterName) { FastLine trend; if (!_trends.TryGetValue(counterName, out trend)) { trend = new FastLine { LegendText = counterName }; _trends.Add(counterName, trend); _chart.BaseSeries.Add(trend); } trend.Add(DateTime.Now.ToLongTimeString(), new FastLine.DataPoint(value)); }
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])); } } } }
private void InitializeChart() { tChart1.Chart.Header.Text = "Scroll Pager Tool"; tChart1.Chart.Panning.Active = true; tChart1.Chart.Series.Add(series = new FastLine()); series.FillSampleValues(1000); tChart1.Chart.Tools.Add(tool = new ScrollPager()); for (int i = 0; i < tChart1.Chart.Series.Count; i++) { if (tChart1.Chart.Series[i].Count > 0) { tool.Series = tChart1.Chart.Series[i]; } } tool.ColorBandTool.StartLine.AllowDrag = true; tool.ColorBandTool.EndLine.AllowDrag = true; tool.ColorBandTool.StartLine.Active = true; tool.ColorBandTool.EndLine.Active = true; tChart1.Chart.Tools.Add(colorlinetool = new ColorLine()); colorlinetool.Value = 100; colorlinetool.AllowDrag = true; colorlinetool.Pen.Color = Color.Blue; tChart1.Chart.ClickBackground += TChart1_ClickBackground; tChart1.Chart.Tools.Add(point = new NearestPoint()); tChart1.Chart.Tools.Add(annotate = new Annotation()); point.Brush.Color = tool.PointerHighlightColor; point.DrawLine = false; point.Size = 6; point.Direction = NearestPointDirection.Horizontal; point.Series = series; point.Change += new EventHandler(point_Change); annotate.Position = AnnotationPositions.RightTop; annotate.Text = "YValue:"; annotate.Shape.Shadow.Visible = false; annotate.Shape.Font.Color = tChart1.Chart.Header.Font.Color; annotate.Shape.Color = tool.PointerHighlightColor; annotate.Shape.Pen.Visible = false; annotate.Shape.Font.Color = Color.White; annotate.TextAlign = TextAlignment.Center; //Theme.ApplyChartTheme(typeof(FlatTheme), tool.SubChartTChart.Chart); }
/// <summary> /// Create a new <see cref="FastLineItem"/> using the specified properties. /// </summary> /// <param name="label">The _label that will appear in the legend.</param> /// <param name="points">A <see cref="IPointList"/> of double precision value pairs that define /// the X and Y values for this curve</param> /// <param name="color">A <see cref="Color"/> value that will be applied to /// the <see cref="Line"/> and <see cref="Symbol"/> properties. /// </param> /// <param name="symbolType">A <see cref="SymbolType"/> enum specifying the /// type of symbol to use for this <see cref="FastLineItem"/>. Use <see cref="SymbolType.None"/> /// to hide the symbols.</param> /// <param name="lineWidth">The width (in points) to be used for the <see cref="Line"/>. This /// width is scaled based on <see cref="PaneBase.CalcScaleFactor"/>. Use a value of zero to /// hide the line (see <see cref="ZedGraph.Line.IsVisible"/>).</param> public FastLineItem(string label, IPointList points, Color color, SymbolType symbolType, float lineWidth) : base(label, points) { _line = new FastLine(color); if (lineWidth == 0) { _line.IsVisible = false; } else { _line.Width = lineWidth; } //_symbol = new Symbol(symbolType, color); }
void AddPoint(string address, double received) { FastLine trend; if (!_trends.TryGetValue(address, out trend)) { trend = new FastLine { LegendText = address }; _trends.Add(address, trend); _chart.BaseSeries.Add(trend); } var x = DateTime.Now.Subtract(_start).TotalMinutes; trend.Add(x, new FastLine.DataPoint(received)); }
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; } }
public FindCoeffProFunctionChart(ChartView BaseChart) { fastLineSource = new FastLine(); fastLineCoe1 = new FastLine(); fastLineCoe2 = new FastLine(); #if !TEE_STD polyFitting = new PolyFitting(); polyFitting2 = new PolyFitting(); var = new Variables.Variables(); BaseChart.Chart.Title.Text = "Polynomial Fitting"; BaseChart.Chart.Axes.Left.Automatic = true; BaseChart.Chart.Axes.Left.Ticks.Transparency = 100; BaseChart.Chart.Axes.Bottom.Automatic = true; BaseChart.Chart.Axes.Left.Increment = 100; fastLineSource.FillSampleValues(40); fastLineSource.LinePen.Width = 3; fastLineSource.Color = var.GetPaletteBasic[0]; fastLineSource.Title = "Data Source"; fastLineSource.Marks.DrawEvery = 4; fastLineCoe1.DataSource = fastLineSource; fastLineCoe1.Function = polyFitting; fastLineCoe1.LinePen.Width = 3; fastLineCoe1.Color = var.GetPaletteBasic[1]; fastLineCoe1.Title = "Curve 1"; fastLineCoe1.Marks.DrawEvery = 4; fastLineCoe2.DataSource = fastLineSource; fastLineCoe2.Function = polyFitting2; fastLineCoe2.LinePen.Width = 3; fastLineCoe2.Color = var.GetPaletteBasic[2]; fastLineCoe2.Title = "Curve 2"; fastLineCoe2.Marks.DrawEvery = 4; polyFitting.PolyDegree = 5; polyFitting2.PolyDegree = 14; BaseChart.Chart.Series.Add(fastLineSource); BaseChart.Chart.Series.Add(fastLineCoe1); BaseChart.Chart.Series.Add(fastLineCoe2); #endif }
public ExponentialTrendProFunctionChart(ChartView BaseChart) { flineSource = new FastLine(); flineExpTrend = new FastLine(); expTrendFunction = new ExpTrendFunction(); flineTrend = new FastLine(); trendFunction = new TrendFunction(); var = new Variables.Variables(); BaseChart.Chart.Title.Text = "Exponential Trend"; BaseChart.Chart.Axes.Left.Automatic = true; BaseChart.Chart.Axes.Left.Ticks.Transparency = 100; BaseChart.Chart.Axes.Bottom.Automatic = true; BaseChart.Chart.Axes.Left.Increment = 50; FillSampleValues(flineSource, 50, 800); flineSource.Title = "Data Source"; flineSource.LinePen.Width = 3; flineSource.Color = var.GetPaletteBasic[0]; flineExpTrend.DataSource = flineSource; flineExpTrend.Function = expTrendFunction; flineExpTrend.LinePen.Width = 3; flineExpTrend.Color = var.GetPaletteBasic[1]; flineExpTrend.Title = "Exp. Trend"; expTrendFunction.TrendStyle = TrendStyles.Exponential; trendFunction.TrendStyle = TrendStyles.Normal; flineTrend.DataSource = flineSource; flineTrend.Function = trendFunction; flineTrend.LinePen.Width = 3; flineTrend.Color = var.GetPaletteBasic[2]; flineTrend.Title = "Trend"; BaseChart.Chart.Series.Add(flineSource); BaseChart.Chart.Series.Add(flineTrend); BaseChart.Chart.Series.Add(flineExpTrend); ((((BaseChart.Parent as StackLayout).Parent as Grid).Parent as ContentPage).Parent as TabbedPage).Title = "Exp. Trend"; }
private void listBox1_SelectedValueChanged(object sender, EventArgs e) { _overviewChart.Series.Clear(); this._trends.Clear(); double maxVal = 0; foreach (object id in this.listBox1.SelectedItems) { string ids = id.ToString(); List <PerformanceSample> samples = this._performanceData[ids]; foreach (PerformanceSample s in samples) { FastLine trend; if (!_trends.TryGetValue(ids, out trend)) { trend = new FastLine { LegendText = ids }; trend.BorderWidth = 3; _trends.Add(ids, trend); _overviewChart.Series.Add(trend); } trend.Add(s.Timestamp.ToLongTimeString(), new FastLine.DataPoint(s.Value)); if (s.Value > maxVal) { maxVal = s.Value; } } } //_overviewChart.ChartAreas[0].AxisX.ScaleView.ZoomReset(); _overviewChart.ChartAreas[0].AxisY.Maximum = maxVal; _overviewChart.Invalidate(); }
private void ChartToCreate(String item) { List <String[]> originalData = ChartData(); String[] dataPicker = new String[originalData.Count]; for (int i = 0; i < originalData.Count; i++) { dataPicker[i] = originalData[i][1]; } _customChart.ChartView.Chart.Series.RemoveAllSeries(); var imageButton = ((((this.Children[0] as ContentPage).Content as ScrollView).Content as StackLayout).Children[1] as Grid).Children[2] as Button; switch (item) { case "AREA": Area area = new Area(); area.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(area); _customChart.ImageSource = dataPicker[0]; imageButton.ImageSource = dataPicker[0]; break; #if !TEE_STD case "ARROW": Arrow arrow = new Arrow(); arrow.FillSampleValues(10); _customChart.ChartView.Chart.Series.Add(arrow); _customChart.ImageSource = dataPicker[1]; imageButton.ImageSource = dataPicker[1]; break; #endif case "BAR": Bar bar = new Bar(); bar.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(bar); _customChart.ImageSource = dataPicker[2]; imageButton.ImageSource = dataPicker[2]; break; #if !TEE_STD case "BARJOIN": BarJoin barjoin = new BarJoin(); barjoin.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(barjoin); _customChart.ImageSource = dataPicker[3]; imageButton.ImageSource = dataPicker[3]; break; case "BEZIER": Bezier bezier = new Bezier(); bezier.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(bezier); _customChart.ImageSource = dataPicker[4]; imageButton.ImageSource = dataPicker[4]; break; case "BOX": Box box = new Box(); box.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(box); _customChart.ImageSource = dataPicker[5]; imageButton.ImageSource = dataPicker[5]; break; #endif case "BUBBLES": Bubble bubble = new Bubble(); bubble.FillSampleValues(7); _customChart.ChartView.Chart.Series.Add(bubble); _customChart.ImageSource = dataPicker[6]; imageButton.ImageSource = dataPicker[6]; break; #if !TEE_STD case "CANDLE": Candle candle = new Candle(); candle.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(candle); _customChart.ImageSource = dataPicker[7]; imageButton.ImageSource = dataPicker[7]; break; case "CONTOUR": Contour countour = new Contour(); countour.FillSampleValues(1); _customChart.ChartView.Chart.Series.Add(countour); _customChart.ImageSource = dataPicker[8]; imageButton.ImageSource = dataPicker[8]; break; case "DARVAS": Darvas darvas = new Darvas(); darvas.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(darvas); _customChart.ImageSource = dataPicker[9]; imageButton.ImageSource = dataPicker[9]; break; #endif case "DONUT": Donut donut = new Donut(); donut.FillSampleValues(1); _customChart.ChartView.Chart.Series.Add(donut); _customChart.ImageSource = dataPicker[10]; imageButton.ImageSource = dataPicker[10]; break; #if !TEE_STD case "ERROR": Error error = new Error(); error.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(error); _customChart.ImageSource = dataPicker[11]; imageButton.ImageSource = dataPicker[11]; break; case "ERRORBAR": ErrorBar errorbar = new ErrorBar(); errorbar.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(errorbar); _customChart.ImageSource = dataPicker[12]; imageButton.ImageSource = dataPicker[12]; break; case "ERRORPOINT": ErrorPoint errorPoint = new ErrorPoint(); errorPoint.FillSampleValues(7); _customChart.ChartView.Chart.Series.Add(errorPoint); _customChart.ImageSource = dataPicker[13]; imageButton.ImageSource = dataPicker[13]; break; #endif case "FASTLINE": FastLine fastLine = new FastLine(); fastLine.FillSampleValues(2); _customChart.ChartView.Chart.Series.Add(fastLine); _customChart.ImageSource = dataPicker[14]; imageButton.ImageSource = dataPicker[14]; break; #if !TEE_STD case "HIGHLOW": HighLow highLow = new HighLow(); highLow.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(highLow); _customChart.ImageSource = dataPicker[15]; imageButton.ImageSource = dataPicker[15]; break; case "HISTOGRAM": Histogram histogram = new Histogram(); histogram.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(histogram); _customChart.ImageSource = dataPicker[16]; imageButton.ImageSource = dataPicker[16]; break; #endif case "HORIZAREA": HorizArea horizArea = new HorizArea(); horizArea.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizArea); _customChart.ImageSource = dataPicker[17]; imageButton.ImageSource = dataPicker[17]; break; case "HORIZBAR": HorizBar horizBar = new HorizBar(); horizBar.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizBar); _customChart.ImageSource = dataPicker[18]; imageButton.ImageSource = dataPicker[18]; break; case "HORIZLINE": HorizLine horizLine = new HorizLine(); horizLine.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizLine); _customChart.ImageSource = dataPicker[19]; imageButton.ImageSource = dataPicker[19]; break; #if !TEE_STD case "ISOSURFACE": IsoSurface isoSurface = new IsoSurface(); isoSurface.FillSampleValues(10); _customChart.ChartView.Chart.Series.Add(isoSurface); _customChart.ImageSource = dataPicker[20]; imageButton.ImageSource = dataPicker[20]; break; #endif case "LINE": Line line = new Line(); line.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(line); _customChart.ImageSource = dataPicker[21]; imageButton.ImageSource = dataPicker[21]; break; #if !TEE_STD case "LINEPOINT": LinePoint linePoint = new LinePoint(); linePoint.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(linePoint); _customChart.ImageSource = dataPicker[22]; imageButton.ImageSource = dataPicker[22]; break; #endif case "PIE": Pie pie = new Pie(); pie.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(pie); _customChart.ImageSource = dataPicker[23]; imageButton.ImageSource = dataPicker[23]; break; #if !TEE_STD case "SURFACE": Surface surface = new Surface(); surface.FillSampleValues(10); //surface. _customChart.ChartView.Chart.Series.Add(surface); _customChart.ImageSource = dataPicker[24]; imageButton.ImageSource = dataPicker[24]; break; case "TOWER": Tower tower = new Tower(); tower.FillSampleValues(8); _customChart.ChartView.Chart.Series.Add(tower); _customChart.ImageSource = dataPicker[25]; imageButton.ImageSource = dataPicker[25]; break; case "VOLUME": Volume volume = new Volume(); volume.FillSampleValues(9); _customChart.ChartView.Chart.Series.Add(volume); _customChart.ImageSource = dataPicker[26]; imageButton.ImageSource = dataPicker[26]; break; #endif } _customChart.ChartView.Chart.Axes.Left.Automatic = true; _customChart.ChartView.Chart.Axes.Bottom.Automatic = true; }
public static Chart Fast() { var ys1 = EnumerableEx.Defer(delegate { var random = new Random(0); return EnumerableEx.Generate(50.0, y => true, y => y + (random.NextDouble() * 10.0 - 5.0), y => y); }); var ys2 = EnumerableEx.Defer(delegate { var random = new Random(1); return EnumerableEx.Generate(200.0, y => true, y => y + (random.NextDouble() * 10.0 - 5.0), y => y); }); var beans = new FastLine() { Points = { from y in ys1.Take(1000000) select y } , LegendText = "Garbonzo Beans" }; var brocolli = new FastLine() { Points = { from y in ys2.Take(1000000) select y } , LegendText = "Brocolli" }; var chart = new Chart { ChartAreas = { new ChartArea { beans, brocolli } }, BackColor = System.Drawing.Color.WhiteSmoke, BackGradientStyle = System.Windows.Forms.DataVisualization.Charting.GradientStyle.TopBottom, BackSecondaryColor = System.Drawing.Color.White, BorderlineColor = System.Drawing.Color.FromArgb(26, 59, 105), BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid, BorderlineWidth = 2, BorderSkin = { SkinStyle = System.Windows.Forms.DataVisualization.Charting.BorderSkinStyle.Emboss }, Dock = DockStyle.Fill }; return chart; }
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); }
void AddPoint(string address, double received) { FastLine trend; if (!_trends.TryGetValue(address, out trend)) { trend = new FastLine{ LegendText=address }; _trends.Add(address, trend); _chart.BaseSeries.Add(trend); } var x = DateTime.Now.Subtract(_start).TotalMinutes; trend.Add(x, new FastLine.DataPoint(received)); }
static void Main(string[] args) { Console.WriteLine("-----------------------------"); Console.WriteLine(" The_xUnitGenerator 0.0.1."); Console.WriteLine("-----------------------------"); Console.WriteLine("For more information add -?"); FastLine fastLine = new FastLine(); TestGenerator testGenerator = new TestGenerator(); bool given2nd = false; // Check, what user wanted // TODO CHECK, IF IN ARGUMENTS WAS ALREADY PROVIDED FULL COMMAND WITH PARAMS // TODO CHECK, IF GIT IS SET if (!fastLine.GetIsGitRunning()) { Console.WriteLine("GIT IS NOT HERE! - Please, install git first."); return; } // TODO CHECK, IF GITHUB RESPONDS MEANING NET CONNECTION WORKS // Compare with known arguments var looping = true; // Start looping, until user stops with exit do { // Obtain command from user with params Console.WriteLine($"{Environment.NewLine}What has to be done?"); string line = Console.ReadLine(); if (string.IsNullOrWhiteSpace(line)) { continue; } string[] lineParts = line.Split(" "); lineParts[0] = lineParts[0].Trim().ToLower(); if (lineParts.Length > 1) { given2nd = !string.IsNullOrWhiteSpace(lineParts[1]); } // Start comparing with known commands switch (lineParts[0]) { case "gen": if (!given2nd) { Console.WriteLine("Generating for what?"); continue; } Console.WriteLine("Calling xUnit Generator.."); string response = testGenerator.FindRepositoryURL(lineParts[1]); if (string.IsNullOrWhiteSpace(response)) { Console.WriteLine("Obtained git url is empty."); continue; } response = $"git clone {response}"; string result = fastLine.Cmd("git status"); Console.WriteLine(result); break; case "co": if (!given2nd) { Console.WriteLine("Checking out what?"); continue; } lineParts[1] = lineParts[1].Trim().ToLower(); if (!FastValidators.CheckURLValid(lineParts[1])) { Console.WriteLine("It is not a valid git repository url."); continue; } Console.WriteLine($"Calling GitHub with {lineParts[1]}."); // break; case "tst": Console.WriteLine($"solution: {fastLine.GetCurrentSolutionDirectory()}"); Console.WriteLine($"project: {fastLine.GetCurrentProjectsDirectory()}"); if (!given2nd) { Console.WriteLine("Testing what?"); continue; } else { Console.WriteLine("Calling default test runner.."); } break; case "psh": if (!given2nd) { Console.WriteLine("Pushing what?"); continue; } else { Console.WriteLine("Pushing changes.."); } break; case "?": Console.WriteLine("Maybe something, like:"); Console.WriteLine("gen ttrzcinski/Clint"); break; case "exit": looping = false; break; case "quit": looping = false; break; default: Console.WriteLine("I didn't understand that."); break; } } while (looping); Console.WriteLine("Thanks and bye.."); }
/// <summary> /// Create a new <see cref="FastLineItem"/>, specifying only the legend <see cref="CurveItem.Label" />. /// </summary> /// <param name="label">The _label that will appear in the legend.</param> public FastLineItem(string label) : base(label) { //_symbol = new Symbol(); _line = new FastLine(); }
protected override void Dispose(bool disposing) { FastLine.Dispose(); base.Dispose(disposing); }
/// <summary> /// The Copy Constructor /// </summary> /// <param name="rhs">The <see cref="FastLineItem"/> object from which to copy</param> public FastLineItem(FastLineItem rhs) : base(rhs) { //_symbol = new Symbol(rhs.Symbol); _line = new FastLine(rhs.Line); }
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); } }
/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { FastLine.Set(Instrument.MasterInstrument.Round2TickSize(DonchianChannel(LengthFast)[0])); SlowLine.Set(Instrument.MasterInstrument.Round2TickSize(DonchianChannel(LengthSlow)[0])); TrailingStop.Set(EMA(eMA1Len)[0]); //TrendFilter.Set(EMA(eMA2Len)[0]); if (CrossAbove(FastLine, SlowLine, 1) && crossedAboveBarNumber <= crossedBelowBarNumber) { crossedAboveBarNumber = CurrentBar; lookingLong = true; lookingShort = false; } else if (CrossBelow(FastLine, SlowLine, 1) && crossedAboveBarNumber >= crossedBelowBarNumber) { crossedBelowBarNumber = CurrentBar; lookingLong = false; lookingShort = true; } // Cancel trade under these conditions if (lookingLong && High[0] + entryOffsetTicks * TickSize < TrailingStop[0]) { lookingLong = false; } if (lookingShort && Low[0] - entryOffsetTicks * TickSize > TrailingStop[0]) { lookingShort = false; } //Print(Time + " " + CurrentBar + " " + crossedAboveBarNumber + " " + crossedBelowBarNumber); double barHeight = Range()[0]; //High[0] - Low[0]; PlotColors[0][0] = Color.DarkBlue; PlotColors[1][0] = Color.DarkBlue; PlotColors[2][0] = Color.DarkBlue; PlotColors[3][0] = Color.DarkBlue; PlotColors[4][0] = Color.DarkBlue; PlotColors[5][0] = Color.DarkBlue; PlotColors[6][0] = Color.DarkBlue; PlotColors[7][0] = Color.DarkBlue; PlotColors[8][0] = Color.DarkBlue; PlotColors[9][0] = Color.DarkBlue; if (isLongSignal()) { LongEntry.Set(High[0] + entryOffsetTicks * TickSize); LongStop.Set(Low[0] - stopOffsetTicks * TickSize); LongTgt1.Set(High[0] + Instrument.MasterInstrument.Round2TickSize(tgt1X * barHeight)); LongTgt2.Set(High[0] + Instrument.MasterInstrument.Round2TickSize(tgt2X * barHeight)); LongTgt3.Set(High[0] + Instrument.MasterInstrument.Round2TickSize(tgt3X * barHeight)); } if (isShortSignal()) { ShortEntry.Set(Low[0] - entryOffsetTicks * TickSize); ShortStop.Set(High[0] + stopOffsetTicks * TickSize); ShortTgt1.Set(Low[0] - Instrument.MasterInstrument.Round2TickSize(tgt1X * barHeight)); ShortTgt2.Set(Low[0] - Instrument.MasterInstrument.Round2TickSize(tgt2X * barHeight)); ShortTgt3.Set(Low[0] - Instrument.MasterInstrument.Round2TickSize(tgt3X * barHeight)); } }
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; } } }