Ejemplo n.º 1
0
        /// <summary>
        ///   Updates the appearance of the different data series.
        /// </summary>
        public void UpdateAppearance()
        {
            this.DataScatterSeries.Title = Labels.ChartWindowDataSeriesLabel;

            this.DataScatterSeries.MarkerSize            = Viana.Project.CurrentFilterData.DataLineThickness + 2;
            this.DataScatterSeries.MarkerFill            = ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.DataLineColor);
            this.DataScatterSeries.MarkerStrokeThickness = 1.5;
            this.DataScatterSeries.MarkerType            = Viana.Project.CurrentFilterData.DataLineMarkerType;
            this.DataScatterSeries.MarkerStroke          = OxyColors.White;

            this.DataLineSeries.Title           = string.Empty;
            this.DataLineSeries.Color           = ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.DataLineColor);
            this.DataLineSeries.StrokeThickness = Viana.Project.CurrentFilterData.DataLineThickness;

            this.InterpolationSeries.Title      = Labels.ChartWindowInterpolationSeriesLabel;
            this.InterpolationSeries.MarkerSize = Viana.Project.CurrentFilterData.InterpolationLineThickness + 2;
            this.InterpolationSeries.MarkerFill =
                ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.InterpolationLineColor);
            this.SetMarkerStroke(Viana.Project.CurrentFilterData.InterpolationLineMarkerType, this.InterpolationSeries);
            this.InterpolationSeries.MarkerType = Viana.Project.CurrentFilterData.InterpolationLineMarkerType;
            this.InterpolationSeries.Color      =
                ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.InterpolationLineColor);
            this.InterpolationSeries.StrokeThickness = Viana.Project.CurrentFilterData.InterpolationLineThickness;

            this.RegressionSeries.Title      = Labels.ChartWindowRegressionSeriesLabel;
            this.RegressionSeries.MarkerSize = Viana.Project.CurrentFilterData.RegressionLineThickness + 2;
            this.RegressionSeries.MarkerFill =
                ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.RegressionLineColor);
            this.SetMarkerStroke(Viana.Project.CurrentFilterData.RegressionLineMarkerType, this.RegressionSeries);
            this.RegressionSeries.MarkerType      = Viana.Project.CurrentFilterData.RegressionLineMarkerType;
            this.RegressionSeries.Color           = ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.RegressionLineColor);
            this.RegressionSeries.StrokeThickness = Viana.Project.CurrentFilterData.RegressionLineThickness;
            this.RegressionSeries.Smooth          = true;

            this.TheorySeries.Title      = Labels.ChartWindowTheorySeriesLabel;
            this.TheorySeries.MarkerSize = Viana.Project.CurrentFilterData.TheoryLineThickness + 2;
            this.TheorySeries.MarkerFill = ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.TheoryLineColor);
            this.SetMarkerStroke(Viana.Project.CurrentFilterData.TheoryLineMarkerType, this.TheorySeries);
            this.TheorySeries.MarkerType      = Viana.Project.CurrentFilterData.TheoryLineMarkerType;
            this.TheorySeries.Color           = ConverterExtensions.ToOxyColor(Viana.Project.CurrentFilterData.TheoryLineColor);
            this.TheorySeries.StrokeThickness = Viana.Project.CurrentFilterData.TheoryLineThickness;
            this.TheorySeries.Smooth          = true;

            this.ChartDataModel.InvalidatePlot(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="ChartData" /> class.
        /// </summary>
        public ChartData()
        {
            this.ChartDataModel = new PlotModel
            {
                Title              = Labels.ChartWindowChartTitle,
                LegendPlacement    = LegendPlacement.Inside,
                LegendSymbolLength = 24,
                LegendBackground   = OxyColor.FromArgb(200, 255, 255, 255),
                LegendBorder       = OxyColors.LightGray,
                SelectionColor     =
                    ConverterExtensions.ToOxyColor(
                        Viana.Project.CurrentFilterData.SelectionColor)
            };
            this.DataScatterSeries   = new ScatterSeries();
            this.DataLineSeries      = new LineSeries();
            this.InterpolationSeries = new LineSeries();

            this.XAxis                        = new LinearAxis();
            this.XAxis.Position               = AxisPosition.Bottom;
            this.XAxis.ExtraGridlines         = new double[1];
            this.XAxis.ExtraGridlines[0]      = 0;
            this.XAxis.ExtraGridlineThickness = 2;
            this.XAxis.ExtraGridlineColor     = OxyColors.Gray;

            // this.XAxis.PositionAtZeroCrossing = true;
            // this.XAxis.TickStyle = TickStyle.Crossing;
            this.XAxis.MaximumPadding = 0.05;
            this.XAxis.MinimumPadding = 0.05;

            this.YAxis                        = new LinearAxis();
            this.YAxis.Position               = AxisPosition.Left;
            this.YAxis.ExtraGridlines         = new double[1];
            this.YAxis.ExtraGridlines[0]      = 0;
            this.YAxis.ExtraGridlineThickness = 2;
            this.YAxis.ExtraGridlineColor     = OxyColors.Gray;

            // this.YAxis.PositionAtZeroCrossing = true;
            // this.YAxis.TickStyle = TickStyle.Crossing;
            this.YAxis.MaximumPadding = 0.05;
            this.YAxis.MinimumPadding = 0.05;

            this.ChartDataModel.Series.Add(this.DataLineSeries);
            this.ChartDataModel.Series.Add(this.DataScatterSeries);
            this.ChartDataModel.Series.Add(this.InterpolationSeries);
            this.ChartDataModel.Series.Add(new FunctionSeries());
            this.ChartDataModel.Series.Add(new FunctionSeries());
            this.ChartDataModel.Axes.Add(this.XAxis);
            this.ChartDataModel.Axes.Add(this.YAxis);

            this.DataScatterSeries.SelectionMode = SelectionMode.Multiple;

            // Property info of target object
            this.DataScatterSeries.Mapping =
                item => new ScatterPoint(GetTargetValue(item, "PositionX"), GetTargetValue(item, "PositionY"));
            this.DataLineSeries.Mapping =
                item => new DataPoint(GetTargetValue(item, "PositionX"), GetTargetValue(item, "PositionY"));
            this.InterpolationSeries.Mapping = item => new DataPoint(((XYSample)item).ValueX, ((XYSample)item).ValueY);

            this.UpdateModel();
            this.UpdateAppearance();

            Viana.Project.CurrentFilterData.PropertyChanged += this.CurrentFilterDataPropertyChanged;
        }