Exemple #1
0
        public void DrawLineAndMarkers(
            string title,
            IEnumerable x,
            IEnumerable y,
            Models.Graph.Axis.AxisType xAxisType,
            Models.Graph.Axis.AxisType yAxisType,
            Color colour,
            Models.Graph.LineType lineType,
            Models.Graph.MarkerType markerType,
            bool showOnLegend)
        {
            if (x != null && y != null)
            {
                Utility.LineSeriesWithTracker series = new Utility.LineSeriesWithTracker();
                series.OnHoverOverPoint += OnHoverOverPoint;
                if (showOnLegend)
                {
                    series.Title = title;
                }
                series.Color       = ConverterExtensions.ToOxyColor(colour);
                series.ItemsSource = this.PopulateDataPointSeries(x, y, xAxisType, yAxisType);
                series.XAxisKey    = xAxisType.ToString();
                series.YAxisKey    = yAxisType.ToString();
                series.CanTrackerInterpolatePoints = false;

                bool   filled        = false;
                string oxyMarkerName = markerType.ToString();
                if (oxyMarkerName.StartsWith("Filled"))
                {
                    oxyMarkerName = oxyMarkerName.Remove(0, 6);
                    filled        = true;
                }

                // Line type.
                LineStyle oxyLineType;
                if (Enum.TryParse <LineStyle>(lineType.ToString(), out oxyLineType))
                {
                    series.LineStyle = oxyLineType;
                }

                // Marker type.
                OxyPlot.MarkerType type;
                if (Enum.TryParse <OxyPlot.MarkerType>(oxyMarkerName, out type))
                {
                    series.MarkerType = type;
                }

                series.MarkerSize   = 7.0;
                series.MarkerStroke = ConverterExtensions.ToOxyColor(colour);
                if (filled)
                {
                    series.MarkerFill   = ConverterExtensions.ToOxyColor(colour);
                    series.MarkerStroke = OxyColors.White;
                }

                this.plot1.Model.Series.Add(series);
            }
        }
 /// <summary>
 /// Stub method for interface. This method is not used as the plots are not editable.
 /// </summary>
 /// <param name="title"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="xAxisType"></param>
 /// <param name="yAxisType"></param>
 /// <param name="colour"></param>
 /// <param name="lineType"></param>
 /// <param name="markerType"></param>
 /// <param name="showOnLegend"></param>
 public void DrawLineAndMarkers(
     string title,
     IEnumerable x,
     IEnumerable y,
     Models.Graph.Axis.AxisType xAxisType,
     Models.Graph.Axis.AxisType yAxisType,
     Color colour,
     Models.Graph.LineType lineType,
     Models.Graph.MarkerType markerType,
     bool showOnLegend)
 {
 }
Exemple #3
0
        public void DrawLineAndMarkers(
            string title,
            IEnumerable x,
            IEnumerable y,
            Models.Graph.Axis.AxisType xAxisType,
            Models.Graph.Axis.AxisType yAxisType,
            Color colour,
            Models.Graph.LineType lineType,
            Models.Graph.MarkerType markerType,
            Models.Graph.LineThicknessType lineThickness,
            Models.Graph.MarkerSizeType markerSize,
            bool showOnLegend)
        {
            if (x != null && y != null)
            {
                Utility.LineSeriesWithTracker series = new Utility.LineSeriesWithTracker();
                series.OnHoverOverPoint += OnHoverOverPoint;
                if (showOnLegend)
                {
                    series.Title = title;
                }
                else
                {
                    series.ToolTip = title;
                }
                series.Color       = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
                series.ItemsSource = this.PopulateDataPointSeries(x, y, xAxisType, yAxisType);
                series.XAxisKey    = xAxisType.ToString();
                series.YAxisKey    = yAxisType.ToString();
                series.CanTrackerInterpolatePoints = false;

                bool   filled        = false;
                string oxyMarkerName = markerType.ToString();
                if (oxyMarkerName.StartsWith("Filled"))
                {
                    oxyMarkerName = oxyMarkerName.Remove(0, 6);
                    filled        = true;
                }

                // Line type.
                LineStyle oxyLineType;
                if (Enum.TryParse <LineStyle>(lineType.ToString(), out oxyLineType))
                {
                    series.LineStyle = oxyLineType;
                    if (series.LineStyle == LineStyle.None)
                    {
                        series.Color = OxyColors.Transparent;
                    }
                }

                // Line thickness
                if (lineThickness == LineThicknessType.Thin)
                {
                    series.StrokeThickness = 0.5;
                }

                // Marker type.
                OxyPlot.MarkerType type;
                if (Enum.TryParse <OxyPlot.MarkerType>(oxyMarkerName, out type))
                {
                    series.MarkerType = type;
                }

                if (markerSize == MarkerSizeType.Normal)
                {
                    series.MarkerSize = 7.0;
                }
                else
                {
                    series.MarkerSize = 5.0;
                }

                series.MarkerStroke = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
                if (filled)
                {
                    series.MarkerFill   = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);
                    series.MarkerStroke = OxyColors.White;
                }

                this.plot1.Model.Series.Add(series);
            }
        }