Esempio n. 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);
            }
        }
Esempio n. 2
0
 public void DrawLine(
     object x1,
     object y1,
     object x2,
     object y2,
     Models.Graph.LineType type,
     Models.Graph.LineThicknessType thickness,
     Color colour)
 {
 }
Esempio n. 3
0
 /// <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)
 {
 }
Esempio n. 4
0
        public void DrawLine(
            object x1,
            object y1,
            object x2,
            object y2,
            Models.Graph.LineType type,
            Models.Graph.LineThicknessType thickness,
            Color colour)
        {
            OxyPlot.Annotations.LineAnnotation annotation = new OxyPlot.Annotations.LineAnnotation();

            double x1Position = 0.0;

            if (x1 is DateTime)
            {
                x1Position = DateTimeAxis.ToDouble(x1);
            }
            else
            {
                x1Position = Convert.ToDouble(x1);
            }
            double y1Position = 0.0;

            if ((double)y1 == double.MinValue)
            {
                y1Position = AxisMinimum(Models.Graph.Axis.AxisType.Left);
            }
            else if ((double)y1 == double.MaxValue)
            {
                y1Position = AxisMaximum(Models.Graph.Axis.AxisType.Left);
            }
            else
            {
                y1Position = (double)y1;
            }
            double x2Position = 0.0;

            if (x2 is DateTime)
            {
                x2Position = DateTimeAxis.ToDouble(x2);
            }
            else
            {
                x2Position = Convert.ToDouble(x2);
            }
            double y2Position = 0.0;

            if ((double)y2 == double.MinValue)
            {
                y2Position = AxisMinimum(Models.Graph.Axis.AxisType.Left);
            }
            else if ((double)y2 == double.MaxValue)
            {
                y2Position = AxisMaximum(Models.Graph.Axis.AxisType.Left);
            }
            else
            {
                y2Position = (double)y2;
            }

            annotation.X        = x1Position;
            annotation.Y        = y1Position;
            annotation.MinimumX = x1Position;
            annotation.MinimumY = y1Position;
            annotation.MaximumX = x2Position;
            annotation.MaximumY = y2Position;
            annotation.Type     = LineAnnotationType.Vertical;
            annotation.Color    = OxyColor.FromArgb(colour.A, colour.R, colour.G, colour.B);

            // Line type.
            // LineStyle oxyLineType;
            // if (Enum.TryParse<LineStyle>(type.ToString(), out oxyLineType))
            //    annotation.LineStyle = oxyLineType;

            // Line thickness
            if (thickness == LineThicknessType.Thin)
            {
                annotation.StrokeThickness = 0.5;
            }
            this.plot1.Model.Annotations.Add(annotation);
        }
Esempio n. 5
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);
            }
        }