private void OnDisposed(object args)
 {
     gridChart.Children.Clear();
     if (m_chart != null)
     {
         m_chart.Dispose();
         m_chart = null;
     }
     dataChangedSubscription.Dispose();
     disposedSubscription.Dispose();
 }
Example #2
0
 protected void ViewModel_Closed(object sender, EventArgs e)
 {
     // Don't forget to clear chart grid child list.
     gridChart.Children.Clear();
     if (m_chart != null)
     {
         m_chart.Dispose();
         m_chart = null;
     }
     base.Dispose();
     base.GCCollect();
 }
 private void Dispose()
 {
     if (_chart != null)
     {
         _chart.Dispose();
         _chart = null;
     }
 }
 public void Dispose()
 {
     if (_chart != null)
     {
         _chart.Dispose();
         _chart = null;
     }
 }
Example #5
0
        private void CreateChart()
        {
            gridChart.Children.Clear();
            if (m_chart != null)
            {
                m_chart.Dispose();
                m_chart = null;
            }

            m_chart = new LightningChartUltimate(LicenseKeyStrings.LightningChartUltimate);
            m_chart.BeginUpdate();
            m_chart.Title.Text = "";
            m_chart.ViewXY.AxisLayout.YAxesLayout        = YAxesLayout.Segmented;
            m_chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.LeftThenRight;
            // m_chart.ViewXY.AxisLayout.AutoAdjustAxisGap = 0;

            m_chart.Background                          = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            m_chart.ChartBackground.Color               = Color.FromArgb(0, 0, 0, 0);
            m_chart.ChartBackground.GradientFill        = GradientFill.Solid;
            m_chart.ViewXY.GraphBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            m_chart.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
            m_chart.ViewXY.GraphBorderColor             = Color.FromArgb(0, 0, 0, 0);

            m_chart.ViewXY.XAxes[0].ValueType         = AxisValueType.Number;
            m_chart.ViewXY.XAxes[0].Minimum           = 0;
            m_chart.ViewXY.XAxes[0].Maximum           = 1000;
            m_chart.ViewXY.XAxes[0].Title.Visible     = false;
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].AxisThickness     = 2;
            m_chart.ViewXY.XAxes[0].AxisColor         = Color.FromArgb(100, 135, 205, 238);
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);

            m_chart.ViewXY.YAxes.Clear();
            m_chart.ViewXY.AxisLayout.Segments.Clear();

            m_chart.ViewXY.LegendBox.Visible        = true;
            m_chart.ViewXY.LegendBox.Layout         = LegendBoxLayout.VerticalColumnSpan;
            m_chart.ViewXY.LegendBox.Fill.Style     = RectFillStyle.None;
            m_chart.ViewXY.LegendBox.Shadow.Visible = false;
            m_chart.ViewXY.LegendBox.BorderWidth    = 0;
            m_chart.ViewXY.LegendBox.Position       = LegendBoxPosition.TopRight;
            m_chart.ViewXY.LegendBox.Offset.SetValues(-50, 10);
            m_chart.ViewXY.LegendBox.SeriesTitleFont = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);
            //Add cursor
            LineSeriesCursor cursor = new LineSeriesCursor(m_chart.ViewXY, m_chart.ViewXY.XAxes[0]);

            m_chart.ViewXY.LineSeriesCursors.Add(cursor);
            cursor.PositionChanged  += new LineSeriesCursor.PositionChangedHandler(cursor_PositionChanged);
            cursor.LineStyle.Color   = System.Windows.Media.Color.FromArgb(150, 255, 0, 0);
            cursor.LineStyle.Width   = 2;
            cursor.SnapToPoints      = true;
            cursor.TrackPoint.Color1 = Colors.White;
            m_chart.ViewXY.FitView();
            m_chart.EndUpdate();

            gridChart.Children.Add(m_chart);
        }
Example #6
0
        // Safe disposal of LightningChart components when the form is closed.
        private void Form_Closed(Object sender, FormClosedEventArgs e)
        {
            // Dispose Chart.
            _chart.Dispose();
            _chart = null;

            // Dispose SurfaceGrid.
            _surfaceGrid.Dispose();
            _surfaceGrid = null;
        }
        // Safe disposal of LightningChart components when the form is closed.
        private void Form_Closed(Object sender, FormClosedEventArgs e)
        {
            // Dispose Chart.
            _chart.Dispose();
            _chart = null;

            // Dispose Heat Map.
            _heatMap.Dispose();
            _heatMap = null;
        }
        /// <summary>
        /// 清空示波器数据
        /// </summary>
        public void Dispose()
        {
            if (_chart != null)
            {
                _parentControl.Children.Remove(_chart);

                _chart.Dispose();
                _chart = null;
            }
        }
Example #9
0
        // Safe disposal of LightningChart components when the window is closed.
        private void Window_Closed(object window_Closed, System.EventArgs e)
        {
            // Dispose Chart.
            _chart.Dispose();
            _chart = null;

            // Dispose Heat Map.
            _heatMap.Dispose();
            _heatMap = null;
        }
Example #10
0
        private void CreateChart()
        {
            gridChart.Children.Clear();
            if (m_chart != null)
            {
                m_chart.Dispose();
                m_chart = null;
            }

            m_chart = new LightningChartUltimate(LicenseKeyStrings.LightningChartUltimate);
            m_chart.BeginUpdate();
            m_chart.Title.Text = "";
            m_chart.ViewXY.AxisLayout.YAxisTitleAutoPlacement = false;
            m_chart.ViewXY.AxisLayout.YAxesLayout             = YAxesLayout.Stacked;
            m_chart.ViewXY.LegendBox.Visible = false;

            m_chart.Background                          = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            m_chart.ChartBackground.Color               = Color.FromArgb(0, 0, 0, 0);
            m_chart.ChartBackground.GradientFill        = GradientFill.Solid;
            m_chart.ViewXY.GraphBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            m_chart.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
            m_chart.ViewXY.GraphBorderColor             = Color.FromArgb(0, 0, 0, 0);

            m_chart.ViewXY.XAxes[0].ValueType         = AxisValueType.Number;
            m_chart.ViewXY.XAxes[0].Title.Visible     = false;
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].AxisThickness     = 2;
            m_chart.ViewXY.XAxes[0].AxisColor         = Color.FromArgb(100, 135, 205, 238);
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);

            m_chart.ViewXY.YAxes[0].Title.Visible     = false;
            m_chart.ViewXY.YAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.YAxes[0].AxisThickness     = 2;
            m_chart.ViewXY.YAxes[0].AxisColor         = Color.FromArgb(100, 135, 205, 238);
            m_chart.ViewXY.YAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.YAxes[0].LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);

            FreeformPointLineSeries series = new FreeformPointLineSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[0], m_chart.ViewXY.YAxes[0]);

            series.MouseInteraction       = false;
            series.LineStyle.AntiAliasing = LineAntialias.None;
            series.LineStyle.Width        = 1;

            m_chart.ViewXY.FreeformPointLineSeries.Add(series);

            m_chart.ViewXY.FitView();
            m_chart.EndUpdate();
            gridChart.Children.Add(m_chart);
        }
Example #11
0
        private void CreateChart()
        {
            gridChart.Children.Clear();
            if (m_chart != null)
            {
                m_chart.Dispose();
                m_chart = null;
            }

            m_chart = new LightningChartUltimate(LicenseKeyStrings.LightningChartUltimate);
            m_chart.BeginUpdate();
            m_chart.Title.Visible = false;
            m_chart.ViewXY.AxisLayout.YAxesLayout = YAxesLayout.Stacked;

            m_chart.Background                          = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            m_chart.ChartBackground.Color               = Color.FromArgb(0, 0, 0, 0);
            m_chart.ChartBackground.GradientFill        = GradientFill.Solid;
            m_chart.ViewXY.GraphBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            m_chart.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
            m_chart.ViewXY.GraphBorderColor             = Color.FromArgb(0, 0, 0, 0);

            m_chart.ViewXY.XAxes[0].ValueType         = AxisValueType.Number;
            m_chart.ViewXY.XAxes[0].Title.Visible     = false;
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].AxisThickness     = 2;
            m_chart.ViewXY.XAxes[0].AxisColor         = Color.FromArgb(100, 135, 205, 238);
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);
            //m_chart.ViewXY.XAxes[0].LabelsPosition = Alignment.Near;
            //m_chart.ViewXY.XAxes[0].MajorDivTickStyle.Alignment = Alignment.Near;
            //m_chart.ViewXY.XAxes[0].MajorDivTickStyle.Color = Color.FromArgb(100, 135, 205, 238);
            //m_chart.ViewXY.XAxes[0].MinorDivTickStyle.Alignment = Alignment.Near;
            //m_chart.ViewXY.XAxes[0].MinorDivTickStyle.Color = Color.FromArgb(100, 135, 205, 238);
            //m_chart.ViewXY.XAxes[0].VerticalAlign = AlignmentVertical.Top;

            m_chart.ViewXY.YAxes.Clear();
            m_chart.ViewXY.LegendBox.Visible = false;

            m_chart.ViewXY.FitView();
            m_chart.EndUpdate();

            gridChart.Children.Add(m_chart);
        }
        private void CreateChart()
        {
            gridChart.Children.Clear();
            if (m_chart != null)
            {
                m_chart.Dispose();
                m_chart = null;
            }

            m_chart = new LightningChartUltimate(LicenseKeyStrings.LightningChartUltimate);
            m_chart.BeginUpdate();
            m_chart.Title.Text = "";
            m_chart.ViewXY.AxisLayout.XAxisAutoPlacement      = XAxisAutoPlacement.BottomThenTop;
            m_chart.ViewXY.AxisLayout.YAxisAutoPlacement      = YAxisAutoPlacement.LeftThenRight;
            m_chart.ViewXY.AxisLayout.YAxisTitleAutoPlacement = false;
            m_chart.ViewXY.AxisLayout.YAxesLayout             = YAxesLayout.Layered;

            m_chart.Background                          = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            m_chart.ChartBackground.Color               = Color.FromArgb(0, 0, 0, 0);
            m_chart.ChartBackground.GradientFill        = GradientFill.Solid;
            m_chart.ViewXY.GraphBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            m_chart.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
            m_chart.ViewXY.GraphBorderColor             = Color.FromArgb(0, 0, 0, 0);

            m_chart.ViewXY.LegendBox.Visible = false;

            m_chart.ViewXY.XAxes[0].ValueType         = AxisValueType.DateTime;
            m_chart.ViewXY.XAxes[0].Title.Visible     = false;
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].AxisThickness     = 2;
            m_chart.ViewXY.XAxes[0].AxisColor         = Color.FromArgb(100, 135, 205, 238);
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);


            m_chart.ViewXY.YAxes[0].Title.Visible     = false;
            m_chart.ViewXY.YAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.YAxes[0].AxisThickness     = 2;
            m_chart.ViewXY.YAxes[0].AxisColor         = Color.FromArgb(100, 135, 205, 238);
            m_chart.ViewXY.YAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.YAxes[0].LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);
            m_chart.ViewXY.YAxes[0].Title.Text        = "";

            AxisX xAxis2 = new AxisX(m_chart.ViewXY);

            xAxis2.LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);
            xAxis2.Title.Text        = "";
            xAxis2.AxisColor         = DefaultColors.SeriesForBlackBackgroundWPF[1];
            xAxis2.MajorGrid.Visible = false;
            xAxis2.ValueType         = AxisValueType.Number;
            m_chart.ViewXY.XAxes.Add(xAxis2);

            AxisY yAxis2 = new AxisY(m_chart.ViewXY);

            yAxis2.LabelsFont        = new WPFFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);
            yAxis2.Title.Text        = "";
            yAxis2.AxisColor         = DefaultColors.SeriesForBlackBackgroundWPF[1];
            yAxis2.MajorGrid.Visible = false;
            m_chart.ViewXY.YAxes.Add(yAxis2);

            PointLineSeries series = new PointLineSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[0], m_chart.ViewXY.YAxes[0]);

            series.MouseInteraction       = false;
            series.LineStyle.AntiAliasing = LineAntialias.None;
            series.LineStyle.Width        = 1;
            m_chart.ViewXY.PointLineSeries.Add(series);

            PointLineSeries series2 = new PointLineSeries(m_chart.ViewXY, m_chart.ViewXY.XAxes[1], m_chart.ViewXY.YAxes[1]);

            series2.MouseInteraction       = false;
            series2.LineStyle.Color        = DefaultColors.SeriesForBlackBackgroundWPF[1];
            series2.LineStyle.AntiAliasing = LineAntialias.None;
            series2.LineStyle.Width        = 1;
            series2.CursorTrackEnabled     = false;
            m_chart.ViewXY.PointLineSeries.Add(series2);

            //Add cursor
            LineSeriesCursor cursor = new LineSeriesCursor(m_chart.ViewXY, m_chart.ViewXY.XAxes[0]);

            cursor.PositionChanged += AlarmPointTrendDataView_PositionChanged;
            //cursor.AssignXAxisIndex = 0;
            m_chart.ViewXY.LineSeriesCursors.Add(cursor);
            cursor.LineStyle.Color   = System.Windows.Media.Color.FromArgb(150, 255, 0, 0);
            cursor.SnapToPoints      = true;
            cursor.LineStyle.Width   = 2;
            cursor.TrackPoint.Color1 = Colors.White;

            m_chart.ViewXY.FitView();
            m_chart.EndUpdate();
            gridChart.Children.Add(m_chart);
        }
        private void CreateChart()
        {
            // Clear any gridChart's children.
            gridChart.Children.Clear();

            if (m_chart != null)
            {
                // If a chart is already created, dispose it.
                m_chart.Dispose();
                m_chart = null;
            }

            // Create a new chart.
            m_chart            = new LightningChartUltimate(LicenseKeyStrings.LightningChartUltimate);
            m_chart.Title.Text = "";


            //Disable rendering, strongly recommended before updating chart properties
            m_chart.BeginUpdate();

            //Set active view
            m_chart.ActiveView = ActiveView.View3D;
            //Chart name
            m_chart.ChartName                    = "Point cloud chart";
            m_chart.Background                   = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            m_chart.ChartBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            m_chart.ChartBackground.GradientFill = GradientFill.Solid;

            //Setup LegendBox
            m_chart.View3D.LegendBox.Layout   = LegendBoxLayout.VerticalColumnSpan;
            m_chart.View3D.LegendBox.Position = LegendBoxPosition.TopRight;
            m_chart.View3D.LegendBox.SurfaceScales.ScaleSizeDim1 = 150;
            m_chart.View3D.LegendBox.SurfaceScales.ScaleSizeDim2 = 20;
            m_chart.View3D.LegendBox.ShowCheckboxes = false;
            m_chart.View3D.LegendBox.Position       = LegendBoxPosition.TopRight;
            m_chart.View3D.LegendBox.Offset.SetValues(0, 0);
            m_chart.View3D.LegendBox.Fill.Style       = RectFillStyle.None;
            m_chart.View3D.LegendBox.Shadow.Visible   = false;
            m_chart.View3D.LegendBox.BorderWidth      = 0;
            m_chart.View3D.LegendBox.SeriesTitleColor = Colors.White;
            m_chart.View3D.LegendBox.ValueLabelColor  = Colors.White;
            m_chart.View3D.LegendBox.SurfaceScales.ScaleBorderColor = Colors.White;

            m_series = new SurfaceMeshSeries3D(m_chart.View3D, Axis3DBinding.Primary, Axis3DBinding.Primary, Axis3DBinding.Primary);
            m_chart.View3D.SurfaceMeshSeries3D.Add(m_series);
            m_series.Title.Text = "";

            m_series.ColorSaturation          = 100;
            m_series.WireframeType            = SurfaceWireframeType.DotsPaletted;
            m_series.ContourLineType          = ContourLineType.None;
            m_series.Fill                     = SurfaceFillStyle.None;
            m_series.InitialValue             = -10;
            m_series.ContourPalette           = CreatePalette(m_series, 1);
            m_series.WireframeLineStyle.Width = 3;

            SurfacePoint[,] seriesData = new SurfacePoint[iColumnCount, iRowCount];
            SurfacePoint invalidPoint = new SurfacePoint(0, -100, 0, Colors.White);

            for (int i = 0; i < iColumnCount; i++)
            {
                for (int j = 0; j < iRowCount; j++)
                {
                    seriesData[i, j] = invalidPoint;
                }
            }
            m_series.Data = seriesData;

            //Hide walls
            foreach (WallBase wall in m_chart.View3D.GetWalls())
            {
                wall.Visible = false;
            }

            //Set camera
            m_chart.View3D.Camera.MinimumViewDistance = 30;
            m_chart.View3D.Camera.RotationX          += 10;

            //Set Y dimensions a little bit higher than default
            m_chart.View3D.Dimensions.Y = 80;

            //Set axis ranges
            m_chart.View3D.XAxisPrimary3D.SetRange(0, 1);
            m_chart.View3D.XAxisPrimary3D.Title.Text = "倍频";
            m_chart.View3D.YAxisPrimary3D.SetRange(0, 1);
            m_chart.View3D.YAxisPrimary3D.Title.Text = "幅值";
            m_chart.View3D.ZAxisPrimary3D.SetRange(0, 1);
            m_chart.View3D.ZAxisPrimary3D.Title.Text = "转速";

            //Allow chart rendering
            m_chart.EndUpdate();

            gridChart.Children.Add(m_chart);
        }
Example #14
0
        private void CreateChart()
        {
            gridChart.Children.Clear();
            if (m_chart != null)
            {
                m_chart.Dispose();
                m_chart = null;
            }

            m_chart = new LightningChartUltimate();
            m_chart.BeginUpdate();
            m_chart.Title.Text = "";;
            m_chart.ViewXY.AxisLayout.YAxesLayout        = YAxesLayout.Segmented;
            m_chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.LeftThenRight;
            // m_chart.ViewXY.BeforeZooming += ViewXY_BeforeZooming;
            //m_chart.ViewXY.ZoomPanOptions.MouseWheelZooming = MouseWheelZooming.Vertical;


            // m_chart.ViewXY.AxisLayout.AutoAdjustAxisGap = 0;
            m_chart.Background                          = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            m_chart.ChartBackground.Color               = Color.FromArgb(0, 0, 0, 0);
            m_chart.ChartBackground.GradientFill        = GradientFill.Solid;
            m_chart.ViewXY.GraphBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            m_chart.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
            m_chart.ViewXY.GraphBorderColor             = Color.FromArgb(0, 0, 0, 0);

            m_chart.ViewXY.XAxes[0].ValueType     = AxisValueType.DateTime;
            m_chart.ViewXY.XAxes[0].Title.Visible = false;
            //m_chart.ViewXY.XAxes[0].MinimumDateTime = DateTime.Now.Subtract(TimeSpan.FromMinutes(5));
            //m_chart.ViewXY.XAxes[0].MaximumDateTime = DateTime.Now;
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].AxisThickness     = 2;
            m_chart.ViewXY.XAxes[0].AxisColor         = Color.FromArgb(0xff, 0xff, 0xff, 0xff);//Color.FromArgb(100, 135, 205, 238);
            m_chart.ViewXY.XAxes[0].LabelsFont        = new WpfFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);

            //Create new Y axis for each series
            //AxisY yAxis = new AxisY(m_chart.ViewXY);
            //yAxis.SetRange(-10, 10);
            //m_chart.ViewXY.YAxes.Add(yAxis);
            //Almost zero margins, bottom is 3u
            //   m_chart.ViewXY.Margins = new Thickness(3);

            m_chart.ViewXY.YAxes.Clear();
            AxisY axisYnone = new AxisY(m_chart.ViewXY);

            axisYnone.Title.Font    = new WpfFont(System.Drawing.FontFamily.GenericSansSerif, 10, System.Drawing.FontStyle.Regular);
            axisYnone.AxisThickness = 2;
            axisYnone.AxisColor     = Color.FromArgb(0xff, 0xff, 0xff, 0xff);//Color.FromArgb(100, 135, 205, 238);
            axisYnone.Units.Text    = "none";
            m_chart.ViewXY.YAxes.Add(axisYnone);

            m_chart.ViewXY.AxisLayout.Segments.Clear();
            m_chart.ViewXY.AxisLayout.Segments.Add(new YAxisSegment(m_chart.ViewXY.AxisLayout)
            {
                Height = 0
            });
            m_chart.ViewXY.AxisLayout.Segments.Add(new YAxisSegment(m_chart.ViewXY.AxisLayout)
            {
                Height = 0
            });

            m_chart.ViewXY.LegendBoxes[0].Visible        = true;
            m_chart.ViewXY.LegendBoxes[0].Layout         = LegendBoxLayout.VerticalColumnSpan;
            m_chart.ViewXY.LegendBoxes[0].Fill.Style     = RectFillStyle.None;
            m_chart.ViewXY.LegendBoxes[0].Shadow.Visible = false;
            m_chart.ViewXY.LegendBoxes[0].BorderWidth    = 0;
            m_chart.ViewXY.LegendBoxes[0].Position       = LegendBoxPositionXY.TopRight;
            m_chart.ViewXY.LegendBoxes[0].Offset.SetValues(-80, 5);
            m_chart.ViewXY.LegendBoxes[0].SeriesTitleFont             = new WpfFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);
            m_chart.ViewXY.LegendBoxes[0].SeriesTitleMouseMoveOverOn += LegendBox_SeriesTitleMouseMoveOverOn;

            //Add cursor
            LineSeriesCursor cursor = new LineSeriesCursor(m_chart.ViewXY, m_chart.ViewXY.XAxes[0]);

            m_chart.ViewXY.LineSeriesCursors.Add(cursor);
            cursor.PositionChanged  += cursor_PositionChanged;
            cursor.LineStyle.Color   = System.Windows.Media.Color.FromArgb(150, 255, 0, 0);
            cursor.LineStyle.Width   = 2;
            cursor.SnapToPoints      = true;
            cursor.TrackPoint.Color1 = Colors.White;

            m_chart.ViewXY.ZoomToFit();
            m_chart.EndUpdate();

            gridChart.Children.Add(m_chart);
        }
Example #15
0
 // Safe disposal of LightningChart components when the form is closed.
 private void Form_Closed(Object sender, FormClosedEventArgs e)
 {
     // Dispose Chart.
     chart.Dispose();
     chart = null;
 }
Example #16
0
        private void CreateChart()
        {
            gridChart.Children.Clear();
            if (_chart != null)
            {
                _chart.Dispose();
                _chart = null;
            }

            _chart = new LightningChartUltimate();
            _chart.BeginUpdate();
            _chart.Title.Text = "";;
            _chart.ViewXY.AxisLayout.YAxesLayout        = YAxesLayout.Layered;
            _chart.ViewXY.AxisLayout.YAxisAutoPlacement = YAxisAutoPlacement.LeftThenRight;

            // _chart.ViewXY.AxisLayout.AutoAdjustAxisGap = 0;
            _chart.Background                          = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            _chart.ChartBackground.Color               = Color.FromArgb(0, 0, 0, 0);
            _chart.ChartBackground.GradientFill        = GradientFill.Solid;
            _chart.ViewXY.GraphBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            _chart.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
            _chart.ViewXY.GraphBorderColor             = Color.FromArgb(0, 0, 0, 0);

            _chart.ViewXY.XAxes[0].ValueType        = AxisValueType.DateTime;
            _chart.ViewXY.XAxes[0].AutoFormatLabels = false;
            _chart.ViewXY.XAxes[0].LabelsTimeFormat = "MM-dd HH:mm";
            _chart.ViewXY.XAxes[0].Title.Visible    = false;
            //_chart.ViewXY.XAxes[0].MinimumDateTime = DateTime.Now.Subtract(TimeSpan.FromMinutes(5));
            //_chart.ViewXY.XAxes[0].MaximumDateTime = DateTime.Now;
            _chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            _chart.ViewXY.XAxes[0].AxisThickness     = 2;
            _chart.ViewXY.XAxes[0].AxisColor         = Color.FromArgb(0xff, 0xff, 0xff, 0xff);//Color.FromArgb(100, 135, 205, 238);
            _chart.ViewXY.XAxes[0].LabelsFont        = new WpfFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);

            _chart.ViewXY.YAxes.Clear();
            AxisY axisYnone = new AxisY(_chart.ViewXY);

            axisYnone.Title.Font    = new WpfFont(System.Drawing.FontFamily.GenericSansSerif, 10, System.Drawing.FontStyle.Regular);
            axisYnone.AxisThickness = 2;
            axisYnone.AxisColor     = Color.FromArgb(0xff, 0xff, 0xff, 0xff);//Color.FromArgb(100, 135, 205, 238);
            axisYnone.Units.Text    = "none";
            _chart.ViewXY.YAxes.Add(axisYnone);

            _chart.ViewXY.LegendBoxes[0].Visible        = false;
            _chart.ViewXY.LegendBoxes[0].Layout         = LegendBoxLayout.VerticalColumnSpan;
            _chart.ViewXY.LegendBoxes[0].Fill.Style     = RectFillStyle.None;
            _chart.ViewXY.LegendBoxes[0].Shadow.Visible = false;
            _chart.ViewXY.LegendBoxes[0].BorderWidth    = 0;
            _chart.ViewXY.LegendBoxes[0].Position       = LegendBoxPositionXY.TopRight;
            _chart.ViewXY.LegendBoxes[0].Offset.SetValues(-80, 5);
            _chart.ViewXY.LegendBoxes[0].SeriesTitleFont             = new WpfFont(System.Drawing.FontFamily.GenericSansSerif, 9, System.Drawing.FontStyle.Regular);
            _chart.ViewXY.LegendBoxes[0].SeriesTitleMouseMoveOverOn += LegendBox_SeriesTitleMouseMoveOverOn;

            //Add cursor
            LineSeriesCursor cursor = new LineSeriesCursor(_chart.ViewXY, _chart.ViewXY.XAxes[0]);

            _chart.ViewXY.LineSeriesCursors.Add(cursor);
            cursor.PositionChanged  += cursor_PositionChanged;
            cursor.LineStyle.Color   = System.Windows.Media.Color.FromArgb(150, 255, 0, 0);
            cursor.LineStyle.Width   = 2;
            cursor.SnapToPoints      = true;
            cursor.TrackPoint.Color1 = Colors.White;

            _chart.ViewXY.ZoomToFit();

            _chart.EndUpdate();

            gridChart.Children.Add(_chart);

            chkZoom.Checked   += chkZoom_Checked;
            chkZoom.Unchecked += chkZoom_Unchecked;
            chkZoom_Checked(null, null);
        }
        private void CreateChart()
        {
            gridChart.Children.Clear();
            if (_chart != null)
            {
                _chart.Dispose();
                _chart = null;
            }

            Color blackColor = ((SolidColorBrush)Application.Current.Resources["ChartBlackAccentColorBrush"]).Color;

            // Create a new chart.
            _chart = new LightningChartUltimate();
            _chart.BeginUpdate();
            _chart.Title.Text = "";
            _chart.ViewXY.DropOldSeriesData   = true;
            _chart.ViewXY.DropOldEventMarkers = true;

            _chart.Background                          = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            _chart.ChartBackground.Color               = Color.FromArgb(0, 0, 0, 0);
            _chart.ChartBackground.GradientFill        = GradientFill.Solid;
            _chart.ViewXY.GraphBackground.Color        = Color.FromArgb(0, 0, 0, 0);
            _chart.ViewXY.GraphBackground.GradientFill = GradientFill.Solid;
            _chart.ViewXY.GraphBorderColor             = Color.FromArgb(0, 0, 0, 0);

            //Chart has one Y axis ready to go. Just set the range
            //_chart.ViewXY.YAxes[0].SetRange(0, 100);
            //_chart.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.None;
            // Configure x-axis.
            _chart.ViewXY.XAxes[0].AutoFormatLabels          = false;
            _chart.ViewXY.XAxes[0].CustomTicksEnabled        = true;
            _chart.ViewXY.XAxes[0].MinorDivTickStyle.Visible = false;
            _chart.ViewXY.XAxes[0].MajorGrid.Pattern         = LinePattern.Dash;
            _chart.ViewXY.XAxes[0].MajorGrid.Visible         = false;
            _chart.ViewXY.XAxes[0].MouseInteraction          = false;
            _chart.ViewXY.XAxes[0].Title.Visible             = false;
            _chart.ViewXY.XAxes[0].ValueType   = AxisValueType.Number;
            _chart.ViewXY.XAxes[0].ScrollMode  = XAxisScrollMode.None;
            _chart.ViewXY.XAxes[0].AxisColor   = blackColor; // Color.FromArgb(0xff, 0x00, 0x00, 0x00);
            _chart.ViewXY.XAxes[0].LabelsColor = blackColor; //Color.FromArgb(0xff, 0x00, 0x00, 0x00);

            //Hide X axis
            //_chart.ViewXY.XAxes[0].Visible = false;
            _chart.ViewXY.YAxes[0].Visible       = true;
            _chart.ViewXY.YAxes[0].Title.Visible = false;
            _chart.ViewXY.YAxes[0].AxisColor     = blackColor; //Color.FromArgb(0xff, 0x00, 0x00, 0x00);
            _chart.ViewXY.YAxes[0].LabelsColor   = blackColor; //Color.FromArgb(0xff, 0x00, 0x00, 0x00);

            //Arrange bars side-by-side and fit to width of the chart
            _chart.ViewXY.BarViewOptions.Grouping    = BarsGrouping.ByLocation;
            _chart.ViewXY.BarViewOptions.Stacking    = BarsStacking.None;
            _chart.ViewXY.BarViewOptions.BarSpacing  = 5;
            _chart.ViewXY.BarViewOptions.Orientation = BarsOrientation.Vertical;

            //Set the legend box in to the bottom
            _chart.ViewXY.LegendBoxes[0].Position = LegendBoxPositionXY.TopRight;
            _chart.ViewXY.LegendBoxes[0].Offset.SetValues(0, 30);
            _chart.ViewXY.LegendBoxes[0].Layout = LegendBoxLayout.VerticalColumnSpan;

            //Allow chart rendering
            _chart.EndUpdate();

            gridChart.Children.Add(_chart);
        }
 // Safe disposal of LightningChart components when the window is closed.
 private void Window_Closed(Object sender, EventArgs e)
 {
     // Dispose Chart.
     chart.Dispose();
     chart = null;
 }
        private void CreateTime3DChart()
        {
            // Clear any timeGrid3DChart's children.
            timeGrid3DChart.Children.Clear();
            if (time3Dchart != null)
            {
                // If a chart is already created, dispose it.
                time3Dchart.Dispose();
                time3Dchart = null;
            }

            // Create a new chart.
            time3Dchart            = new LightningChartUltimate(LicenseKeyStrings.LightningChartUltimate);
            time3Dchart.ChartName  = "Spectrum 3D chart";
            time3Dchart.Title.Text = string.Empty;

            //Disable rendering, strongly recommended before updating chart properties
            time3Dchart.BeginUpdate();

            //Set 3D as active view
            time3Dchart.ActiveView = ActiveView.View3D;

            //Setup background
            time3Dchart.ChartBackground.GradientColor = Colors.Black;
            time3Dchart.ChartBackground.Color         = Colors.DimGray;
            time3Dchart.ChartBackground.GradientFill  = GradientFill.Radial;

            //Setup LegendBox
            time3Dchart.View3D.LegendBox.Layout   = LegendBoxLayout.VerticalColumnSpan;
            time3Dchart.View3D.LegendBox.Position = LegendBoxPosition.TopRight;
            time3Dchart.View3D.LegendBox.SurfaceScales.ScaleSizeDim1 = 150;
            time3Dchart.View3D.LegendBox.SurfaceScales.ScaleSizeDim2 = 10;
            time3Dchart.View3D.LegendBox.ShowCheckboxes = false;

            //Hide all walls but bottom
            time3Dchart.View3D.WallOnBack.Visible   = false;
            time3Dchart.View3D.WallOnLeft.Visible   = false;
            time3Dchart.View3D.WallOnRight.Visible  = false;
            time3Dchart.View3D.WallOnTop.Visible    = false;
            time3Dchart.View3D.WallOnFront.Visible  = false;
            time3Dchart.View3D.WallOnBottom.Visible = true;

            //Setup primary x-axis
            time3Dchart.View3D.XAxisPrimary3D.Orientation                 = PlaneXAxis3D.XY;
            time3Dchart.View3D.XAxisPrimary3D.CornerAlignment             = AxisAlignment3D.Outside;
            time3Dchart.View3D.XAxisPrimary3D.MajorDivTickStyle.Alignment = Alignment.Far;
            time3Dchart.View3D.XAxisPrimary3D.LabelsColor                 = Color.FromArgb(200, 255, 255, 255);
            time3Dchart.View3D.XAxisPrimary3D.MajorDivTickStyle.Color     = Colors.Orange;
            time3Dchart.View3D.XAxisPrimary3D.Title.Text  = "频率 (Hz)";
            time3Dchart.View3D.XAxisPrimary3D.Title.Color = Colors.Yellow;

            //Setup primary y-axis
            time3Dchart.View3D.YAxisPrimary3D.Orientation                 = PlaneYAxis3D.XY;
            time3Dchart.View3D.YAxisPrimary3D.CornerAlignment             = AxisAlignment3D.Outside;
            time3Dchart.View3D.YAxisPrimary3D.MajorDivTickStyle.Alignment = Alignment.Far;
            time3Dchart.View3D.YAxisPrimary3D.LabelsColor                 = Color.FromArgb(200, 255, 255, 255);
            time3Dchart.View3D.YAxisPrimary3D.MajorDivTickStyle.Color     = Colors.Orange;
            time3Dchart.View3D.YAxisPrimary3D.Title.Text  = "幅值 P(f)";
            time3Dchart.View3D.YAxisPrimary3D.Title.Color = Colors.Yellow;
            time3Dchart.View3D.YAxisPrimary3D.SetRange(0, 0);
            time3Dchart.View3D.YAxisPrimary3D.LabelsNumberFormat = "0.00";

            //Setup primary z-axis
            time3Dchart.View3D.ZAxisPrimary3D.Reversed                = true;
            time3Dchart.View3D.ZAxisPrimary3D.LabelsColor             = Color.FromArgb(200, 255, 255, 255);
            time3Dchart.View3D.ZAxisPrimary3D.Title.Text              = "时间";
            time3Dchart.View3D.ZAxisPrimary3D.Title.Color             = Colors.Yellow;
            time3Dchart.View3D.ZAxisPrimary3D.ValueType               = AxisValueType.DateTime;
            time3Dchart.View3D.ZAxisPrimary3D.MajorDivTickStyle.Color = Colors.Orange;
            time3Dchart.View3D.ZAxisPrimary3D.SetRange(1, 100);
            time3Dchart.View3D.ZAxisPrimary3D.LabelsVisible = false;
            time3Dchart.View3D.WallOnBottom.GridStrips      = WallGridStripXZ.X;

            //Setup legend box
            time3Dchart.View3D.LegendBox.SeriesTitleColor = Colors.White;
            time3Dchart.View3D.LegendBox.ValueLabelColor  = Colors.White;
            time3Dchart.View3D.LegendBox.SurfaceScales.ScaleBorderColor = Colors.White;
            time3Dchart.View3D.LegendBox.Position = LegendBoxPosition.TopRight;
            time3Dchart.View3D.LegendBox.Offset.SetValues(0, 0);
            time3Dchart.View3D.LegendBox.Fill.Style     = RectFillStyle.None;
            time3Dchart.View3D.LegendBox.Shadow.Visible = false;
            time3Dchart.View3D.LegendBox.BorderWidth    = 0;

            //Setup camera
            time3Dchart.View3D.Camera.RotationX = 18.6;
            time3Dchart.View3D.Camera.RotationY = -23.6;
            time3Dchart.View3D.Camera.RotationZ = 0;
            time3Dchart.View3D.Camera.Target.SetValues(-9.5f, -10f, -5.8f);
            time3Dchart.View3D.Camera.ViewDistance = 163;

            //double dAxisZMin = updateRate / 1000.0;
            //double dAxisZMax = 100 * updateRate / 1000.0;
            //m_dStepZ = updateRate / 1000.0;

            //time3Dchart.View3D.ZAxisPrimary3D.SetRange(dAxisZMin, dAxisZMax);
            //m_dCurrentZ = dAxisZMax;

            //Add Surface
            CreateSurface();
            //Add Waterfall
            //CreateWaterfall();
            //Add WaterFall Front

            //  CreateWaterfallFront();

            //Allow chart rendering
            time3Dchart.EndUpdate();

            timeGrid3DChart.Children.Add(time3Dchart);
        }