예제 #1
0
        public DoubleDoubleMouseCrosshairCursorProvider(ChartControl chart,
                                                        XYDiagram2D diagram,
                                                        LineSeries2D series,
                                                        Canvas crosshairCursorCanvas,
                                                        ValueItem valueX,
                                                        ValueItem valueY,
                                                        Border verticalLine,
                                                        Border horizontalLine,
                                                        AxisX2D axisX,
                                                        AxisY2D axisY)
            : base(diagram, axisX, axisY, verticalLine, horizontalLine, valueX, valueY)
        {
            this.chart   = chart;
            this.diagram = diagram;
            this.series  = series;
            this.crosshairCursorCanvas = crosshairCursorCanvas;
            this.valueX         = valueX;
            this.valueY         = valueY;
            this.verticalLine   = verticalLine;
            this.horizontalLine = horizontalLine;
            this.axisX          = axisX;
            this.axisY          = axisY;

            chart.MouseMove    += ChartMouseMove;
            valueX.SizeChanged += ValueXSizeChanged;
            valueY.SizeChanged += ValueYSizeChanged;
        }
        public void HideZeroLevel()
        {
            AxisY2D axis = XyDiagram2D.AxisY;

            axis.WholeRange = new Range();
            axis.WholeRange.SetAuto();
            AxisY2D.SetAlwaysShowZeroLevel(axis.WholeRange, false);
        }
예제 #3
0
        void UpdateSeries(Series series, int index)
        {
            if (series is BubbleSeries2D)
            {
                InitializeBubbleSeries(series as BubbleSeries2D);
                return;
            }
            else if (series is FinancialSeries2D)
            {
                InitializeFinancialSeries(series as FinancialSeries2D);
                XYDiagram2D diagram = chart.Diagram as XYDiagram2D;
                if (diagram != null)
                {
                    AxisY2D.SetAlwaysShowZeroLevel(diagram.ActualAxisY.ActualWholeRange, false);
                }
                return;
            }
            if (series is PieSeries2D)
            {
                PieSeries2D pieSeries = series as PieSeries2D;
                if (!(pieSeries is NestedDonutSeries2D))
                {
                    pieSeries.HoleRadiusPercent = 0;
                }
                InitializePieSeries(pieSeries);
                return;
            }
            if (series is FunnelSeries2D)
            {
                InitializeFunnelSeries(series as FunnelSeries2D);
                return;
            }
            if (series is RangeBarSeries2D)
            {
                RangeBarSeries2D rangeBar = series as RangeBarSeries2D;
                InitializeRangeBarSeries(series as RangeBarSeries2D, index + 1);
                series.LabelsVisibility = false;
                if (rangeBar is RangeBarOverlappedSeries2D && index == 1)
                {
                    rangeBar.BarWidth = 0.2;
                }
                return;
            }
            if (series is RangeAreaSeries2D)
            {
                InitializeRangeAreaSeries(series as RangeAreaSeries2D);
                return;
            }
            if (series is CircularSeries2D)
            {
                InitializePolarSeries(series as CircularSeries2D);
                return;
            }

            InitializeSeries(series, index + 1);
        }
        public void SetFixedRange()
        {
            AxisY2D axis = XyDiagram2D.AxisY;

            axis.WholeRange = new Range()
            {
                MinValue = 0,
                MaxValue = 5
            };
            AxisY2D.SetAlwaysShowZeroLevel(axis.WholeRange, true);
        }
        public void AddGraph(IPsaParameterDataViewModel vm, Color strokeColor)
        {
            current.Add(vm, strokeColor);
            LineSeries2D series = new LineSeries2D();

            series.DataContext       = vm;
            series.Brush             = new SolidColorBrush(strokeColor);
            series.ValueScaleType    = ScaleType.Numerical;
            series.ArgumentScaleType = ScaleType.Numerical;
            series.MarkerVisible     = false;
            series.ShowInLegend      = false;
            series.Label             = new SeriesLabel();
            series.LabelsVisibility  = false;

            for (int i = 0; i < vm.Values.Count; i++)
            {
                SeriesPoint pt;
                if (!vm.HasTimestamps)
                {
                    pt = new SeriesPoint(i, vm.Values[i]);
                }
                else
                {
                    pt = new SeriesPoint(vm.Model.Timestamps[i], vm.Values[i]);
                }
                series.Points.Add(pt);
            }
            if (graphDiagram.Series.Count > 0)
            {
                AxisY2D compatibleAxis =
                    FindCompatibleAxis(graphDiagram, series);

                if (compatibleAxis == null)
                {
                    SecondaryAxisY2D newAxis = GenerateNewAxis(series);
                    newAxis.Brush = new SolidColorBrush(strokeColor);
                    graphDiagram.SecondaryAxesY.Add(newAxis);
                    XYDiagram2D.SetSeriesAxisY(series, newAxis);
                }
                else
                {
                    if (compatibleAxis is SecondaryAxisY2D)
                    {
                        UpdateAxisByNewSeries(
                            (SecondaryAxisY2D)compatibleAxis, series);
                        XYDiagram2D.SetSeriesAxisY(series,
                                                   (SecondaryAxisY2D)compatibleAxis);
                    }
                }
            }
            graphDiagram.Series.Add(series);
        }
 public DoubleDoubleCrosshairCursorProvider(XYDiagram2D diagram,
                                            AxisX2D axisX,
                                            AxisY2D axisY,
                                            Border verticalLine,
                                            Border horizontalLine,
                                            ValueItem valueX,
                                            ValueItem valueY)
 {
     this.diagram        = diagram;
     this.axisX          = axisX;
     this.axisY          = axisY;
     this.verticalLine   = verticalLine;
     this.horizontalLine = horizontalLine;
     this.valueX         = valueX;
     this.valueY         = valueY;
 }
 public DoubleDoubleMovingCrosshairCursorProvider(XYDiagram2D diagram,
                                                  AxisX2D axisX,
                                                  AxisY2D axisY,
                                                  Canvas crosshairCursorCanvas,
                                                  Series series,
                                                  Border verticalLine,
                                                  Border horizontalLine,
                                                  ValueItem valueX,
                                                  ValueItem valueY)
     : base(diagram, axisX, axisY, verticalLine, horizontalLine, valueX, valueY)
 {
     this.crosshairCursorCanvas = crosshairCursorCanvas;
     this.diagram        = diagram;
     this.series         = series;
     this.verticalLine   = verticalLine;
     this.horizontalLine = horizontalLine;
 }
        public void RemoveGraph(IPsaParameterDataViewModel vm)
        {
            current.Remove(vm);
            Series toDelete = null;

            foreach (Series s in graphDiagram.Series)
            {
                IPsaParameterDataViewModel param =
                    s.DataContext as IPsaParameterDataViewModel;
                if (param != null)
                {
                    if (param.Type == vm.Type)
                    {
                        toDelete = s;
                        break;
                    }
                }
            }
            // determine axes to delete
            AxisY2D axsToDelete = XYDiagram2D.
                                  GetSeriesAxisY((XYSeries)toDelete);
            bool axsUsedSomewhereElse = false;

            foreach (XYSeries s in graphDiagram.Series)
            {
                if (s != null && s == toDelete)
                {
                    continue;
                }
                AxisY2D axs = XYDiagram2D.GetSeriesAxisY(s);
                if (axs != null && axs == axsToDelete)
                {
                    axsUsedSomewhereElse = true;
                }
            }
            graphDiagram.Series.Remove(toDelete);
            SecondaryAxisY2D axsToDeleteCast =
                axsToDelete as SecondaryAxisY2D;

            if (!axsUsedSomewhereElse && axsToDeleteCast != null)
            {
                graphDiagram.SecondaryAxesY.
                Remove(axsToDeleteCast);
            }
        }
        private void RemoveGraph(PsaParameterDataViewModel vm)
        {
            Series toDelete = null;

            foreach (Series s in graph.SeriesCollection)
            {
                PsaParameterDataViewModel param =
                    s.DataContext as PsaParameterDataViewModel;
                if (param != null)
                {
                    if (param == vm) // the same object
                    {
                        toDelete = s;
                        break;
                    }
                }
            }
            // determine axes to delete
            AxisY2D axsToDelete          = XYDiagram2D.GetSeriesAxisY((XYSeries)toDelete);
            bool    axsUsedSomewhereElse = false;

            foreach (XYSeries s in graph.SeriesCollection)
            {
                if (s != null && s == toDelete)
                {
                    continue;
                }
                AxisY2D axs = XYDiagram2D.GetSeriesAxisY(s);
                if (axs != null && axs == axsToDelete)
                {
                    axsUsedSomewhereElse = true;
                }
            }
            graph.RemoveSeries(toDelete);
            SecondaryAxisY2D axsToDeleteCast = axsToDelete as SecondaryAxisY2D;

            if (!axsUsedSomewhereElse && axsToDeleteCast != null)
            {
                graph.graphDiagram.SecondaryAxesY.Remove(axsToDeleteCast);
            }
        }
        private void ProcessAutoscale(LineSeries2D series, Color color)
        {
            AxisY2D compatibleAxis = FindCompatibleAxis(graph.graphDiagram, series);

            if (compatibleAxis == null) // no compatible axis
            {
                SecondaryAxisY2D newAxis = GenerateNewAxis(series);
                newAxis.Brush = new SolidColorBrush(color);
                graph.graphDiagram.SecondaryAxesY.Add(newAxis);
                XYDiagram2D.SetSeriesAxisY(series, newAxis);
            }
            else // there is a compatible axis
            {
                SecondaryAxisY2D axs = compatibleAxis as SecondaryAxisY2D;
                if (axs != null)
                {
                    UpdateAxisRangeToNewSeries(axs, series);
                    XYDiagram2D.SetSeriesAxisY(series,
                                               (SecondaryAxisY2D)compatibleAxis);
                }
            }
            UpdateScalesSetView();
            UpdateScalesComboboxesView();
        }
예제 #11
0
 public ChartScale(AxisY2D axis)
 {
     this.axis = axis;
     IsNew     = false;
 }
예제 #12
0
 public ChartScale()
 {
     axis  = new SecondaryAxisY2D();
     IsNew = true;
 }