Esempio n. 1
0
        private IEnumerable <Element> GetDataPointMarker(ChartSeries series, LineSeriesStyle style, IReadOnlyCollection <ChartLine> lines)
        {
            var elements = new List <Element>();

            if (!lines.Any())
            {
                return(elements);
            }

            elements.AddRange(CreateDataPoint(
                                  lines.Last().CompletePoint.X,
                                  lines.Last().CompletePoint.Y,
                                  lines.Last().CompletePoint.XValue,
                                  lines.Last().CompletePoint.YValue,
                                  series.SeriesName,
                                  style));

            for (var i = 0; i < lines.Count; i++)
            {
                elements.AddRange(CreateDataPoint(
                                      lines.ElementAt(i).StartPoint.X,
                                      lines.ElementAt(i).StartPoint.Y,
                                      series.DataPoints[i].XValue,
                                      series.DataPoints[i].YValue,
                                      series.SeriesName,
                                      style));
            }

            return(elements);
        }
        public override void Render(IRenderContext rc, PlotModel ddd)
        {
            PlotModel model = this.PlotModel;
            Axis      axis  = ((MapPlotModel)model).GetAxis(this.YKey);

            if (!SeriesVisible || !((IAxis)axis).AxisVisible)
            {
                return;
            }

            //AjustAxis();
            if (Count == 0)
            {
                return;
            }

            OxyColor average_color = OxyColors.Green;
            OxyColor limit_color   = OxyColors.Red;

            if (Theme != null)
            {
                LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                this.Color    = Helper.ConvertColorToOxyColor(style.LineColor);
                average_color = Helper.ConvertColorToOxyColor(style.AverageColor);
                limit_color   = Helper.ConvertColorToOxyColor(style.AlarmColor);
            }

            rc.ResetClip();
            OxyRect clippingRect = model.PlotArea;

            for (int i = 0; i < _points.Count; i++)
            {
                double x = this.XAxis.Transform(_points[i].Index);
                double y = axis.Transform(_points[i].Y);
                if (double.IsNaN(y))
                {
                    continue;
                }

                string      text = _points[i].Value;
                ScreenPoint sp   = new ScreenPoint(x, y);

                rc.DrawText(sp, text, this.Color, "Arial", this.ActualFontSize);
            }
        }
Esempio n. 3
0
        public override void Render(IRenderContext rc,PlotModel modle1)
        {
            PlotModel model = this.PlotModel;
            Axis axis = ((MapPlotModel)model).GetAxis(this.YKey);
            rc.ResetClip();

            if (!SeriesVisible || !((IAxis)axis).AxisVisible)
                return;

            if (_points.Count > 0)
            {
                if (!_performed)
                {
                    double tip_font_size = 20;
                    string tip = this.Title;
                    OxySize size = rc.MeasureText(tip, this.ActualFont, tip_font_size);
                    OxyRect bound = ((IAxis)axis).Bound;
                    double y = bound.Top + (bound.Height-size.Height) / 2;
                    double x = (bound.Width - size.Width) / 2 + bound.Left;
                    rc.DrawText(new ScreenPoint(x, y), tip, this.Color, this.ActualFont, tip_font_size);
                }
            }

            if (_iso_line.LineStrings.Count == 0 )
                return;

            OxyColor average_color = OxyColors.Green;
            OxyColor limit_color = OxyColors.Red;
            if (Theme != null)
            {
                LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                this.Color = Helper.ConvertColorToOxyColor(style.LineColor);
                average_color = Helper.ConvertColorToOxyColor(style.AverageColor);
                limit_color = Helper.ConvertColorToOxyColor(style.AlarmColor);
            }          

            OxyRect clippingRect = model.PlotArea;
            for (int i = 0; i < _iso_line.LineStrings.Count; i++)
            {
                LineString line = _iso_line.LineStrings[i];
                bool invalid = false;
                if (line.VPoints.Count > 0)
                {
                    for (int j = 0; j < line.VPoints.Count; j++)
                    {
                        double x = this.XAxis.Transform(line.VPoints[j].X);
                        double y = axis.Transform(line.VPoints[j].Y);

                        if (clippingRect.Contains(x, y))
                        {
                            invalid = true;
                        }
                    }
                }
                else
                    invalid = true;
                if (!invalid)
                    continue;

                if (line.Points.Count > 0)
                {
                    IList<ScreenPoint> sps = new List<ScreenPoint>();
                    for (int j = 0; j < line.Points.Count; j++)
                    {
                        double x = this.XAxis.Transform(line.Points[j].X);
                        double y = axis.Transform(line.Points[j].Y);
                        sps.Add(new ScreenPoint(x, y));
                    }

                    if (line.Value >= 99999 || line.Value<-99999)
                    {
                        continue;
                    }
                    if (line.Value > DashLimit)
                        base.RenderLine(rc, clippingRect, sps, Color, this.LineWidth,this.LineStyle);
                    else
                    {
                        base.RenderLine(rc, clippingRect, sps, Color, this.LineWidth, LineStyle.Dash);
                    }
                }
                
                if (line.VPoints.Count > 0)
                {
                    for (int j = 0; j < line.VPoints.Count; j++)
                    {
                        double x = this.XAxis.Transform(line.VPoints[j].X);
                        double y = axis.Transform(line.VPoints[j].Y);

                        if (clippingRect.Contains(x, y))
                        {
                            rc.DrawText(new ScreenPoint(x, y), line.Value.ToString("f1"), this.Color);
                        }
                    }
                }
            }
        }
        public override void Render(IRenderContext rc, PlotModel model1)
        {
            PlotModel model  = this.PlotModel;
            Axis      y_axis = ((MapPlotModel)model).GetAxis(this.YKey);

            if (!SeriesVisible || !((IAxis)y_axis).AxisVisible)
            {
                return;
            }

            if (Count == 0)
            {
                return;
            }

            OxyColor average_color = OxyColors.Green;
            OxyColor limit_color   = OxyColors.Red;
            Color    color         = System.Drawing.Color.Red;

            if (Theme != null)
            {
                LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                this.Color    = Helper.ConvertColorToOxyColor(style.LineColor);
                color         = style.LineColor;
                average_color = Helper.ConvertColorToOxyColor(style.AverageColor);
                limit_color   = Helper.ConvertColorToOxyColor(style.AlarmColor);
            }

            rc.ResetClip();
            OxyRect            clippingRect = model.PlotArea;
            List <ScreenPoint> sps          = new List <ScreenPoint>();
            var      field = rc.GetType().GetField("g", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            object   o     = field.GetValue(rc);
            Graphics g     = (Graphics)o;

            if (FontFamily == null)
            {
                return;
            }

            using (Font f = new System.Drawing.Font(FontFamily, FontSize))
            {
                using (Brush brush = new SolidBrush(color))
                {
                    for (int i = 0; i < _points.Count; i++)
                    {
                        double x = this.XAxis.Transform(_points[i].Index);
                        double y = y_axis.Transform(_points[i].Y);
                        if (double.IsNaN(y))
                        {
                            continue;
                        }

                        ScreenPoint sp = new ScreenPoint(x, y);
                        if (_points[i].Value == "9999")
                        {
                            continue;
                        }

                        //using (Brush rec = new SolidBrush(System.Drawing.Color.Blue))
                        //{
                        //    g.FillRectangle(rec, new RectangleF((float)x - 1, (float)y - 1, 2, 2));
                        //}

                        FontLabelSeries.DrawText(g, new ScreenPoint(x, y), _points[i].Value,
                                                 brush, f, _points[i].Angle,
                                                 HorizontalAlignment.Center, VerticalAlignment.Middle);
                    }
                }
            }
        }
Esempio n. 5
0
        private IEnumerable <Element> CreateDataPoint(double dataPointX, double dataPointY, string xValue, string yValue, string seriesName, LineSeriesStyle style)
        {
            var elements = new List <Element>();

            if (style.MarkerStyle.Draw)
            {
                elements.Add(new Circle(
                                 null,
                                 $"{xValue}:{yValue}",
                                 dataPointX,
                                 dataPointY,
                                 style.MarkerStyle.Radius,
                                 style: style.MarkerStyle, classes: new[] { $"data-point data-point_{seriesName}" }));
            }

            if (style.DrawLabel)
            {
                elements.Add(CreateDataPointLabel(dataPointX, dataPointY, yValue, seriesName, style));
            }

            return(elements);
        }
Esempio n. 6
0
        private Text CreateDataPointLabel(double dataPointX, double dataPointY, string value, string seriesName, LineSeriesStyle style)
        {
            var xPos = dataPointX;
            var yPos = 0.0;

            switch (style.DataPointLabelPosition)
            {
            case Position.Top:
                yPos = dataPointY - style.LabelStyle.Size;
                break;

            case Position.Centre:
                yPos = dataPointY;
                break;

            case Position.Bottom:
                yPos = dataPointY + style.LabelStyle.Size;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(new Text(value, xPos, yPos, TextAnchor.Middle, DominantBaseline.Middle, style.LabelStyle, new [] { $"data-point-text data-point-text_{seriesName}" }));
        }
Esempio n. 7
0
        public override void Render(IRenderContext rc, PlotModel model1)
        {
            PlotModel model = this.PlotModel;

            this.YAxis = ((MapPlotModel)model).GetAxis(this.YKey);
            if (!SeriesVisible || !((IAxis)this.YAxis).AxisVisible)
            {
                return;
            }
            //AjustAxis();
            if (Points.Count == 0)
            {
                return;
            }

            OxyColor limit_color = OxyColors.Red;

            if (Theme != null)
            {
                LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                this.Color  = Helper.ConvertColorToOxyColor(style.LineColor);
                limit_color = Helper.ConvertColorToOxyColor(style.AlarmColor);
            }

            rc.ResetClip();
            OxyRect            clippingRect = model.PlotArea;
            List <ScreenPoint> sps          = new List <ScreenPoint>();

            for (int i = 0; i < Points.Count; i++)
            {
                double      x  = this.XAxis.Transform(Points[i].X);
                double      y  = this.YAxis.Transform(Points[i].Y);
                ScreenPoint sp = new ScreenPoint(x, y);
                sps.Add(sp);

                if (LabelVisible)
                {
                    string text = PointLineSeries.FormatValue(Points[i].Y);
                    PointLineSeries.RenderBoxText(rc, ThemeMode, clippingRect, text, TextPadding, sp, TextOffset, Color);
                }
            }

            if (ShowLimit)
            {
                if (LimitValue != Helper.InvalidData)
                {
                    double y     = this.YAxis.Transform(LimitValue);
                    double left  = model.PlotArea.Left;
                    double right = model.PlotArea.Right;

                    if (y >= this.YAxis.ScreenMin.Y && y <= this.YAxis.ScreenMax.Y)
                    {
                        rc.DrawLine(left, y, right, y, new OxyPen(limit_color, 1, LineStyle.Solid, LineJoin.Miter));
                        string limit_text = PointLineSeries.FormatValue(LimitValue);
                        rc.DrawText(new ScreenPoint(left + 10, y - 15), limit_text, limit_color, "Arial");
                    }
                }
            }

            if (Points.Count > 0)
            {
                double x = this.XAxis.Transform(Points[0].X);
                double y = this.YAxis.Transform(YAxis.Minimum) - 2;

                double x1 = this.XAxis.Transform(Points[Points.Count - 1].X);
                double y1 = y;

                ScreenPoint sp  = new ScreenPoint(x, y);
                ScreenPoint sp1 = new ScreenPoint(x1, y1);

                IList <ScreenPoint> poligon = new List <ScreenPoint>();
                poligon.Add(sp);
                foreach (ScreenPoint item in sps)
                {
                    poligon.Add(item);
                }
                poligon.Add(sp1);

                rc.DrawClippedPolygon(clippingRect, poligon, 2, OxyColor.FromAColor(150, Color), OxyColors.Transparent);
                RenderLine(rc, clippingRect, sps, Color, 2, this.LineStyle);
            }
        }
Esempio n. 8
0
        public override void Render(IRenderContext rc, PlotModel model1)
        {
            PlotModel model = this.PlotModel;

            this.YAxis = ((MapPlotModel)model).GetAxis(this.YKey);
            //if (this.YAxis == null)
            //    return;
            if (!SeriesVisible || !((IAxis)this.YAxis).AxisVisible)
            {
                return;
            }

            //AjustAxis();
            if (Points.Count == 0)
            {
                return;
            }

            OxyColor average_color = OxyColors.Green;
            OxyColor limit_color   = OxyColors.Red;

            if (Theme != null)
            {
                LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                this.Color    = Helper.ConvertColorToOxyColor(style.LineColor);
                average_color = Helper.ConvertColorToOxyColor(style.AverageColor);
                limit_color   = Helper.ConvertColorToOxyColor(style.AlarmColor);
            }


            rc.ResetClip();
            OxyRect            clippingRect = model.PlotArea;
            List <ScreenPoint> sps          = new List <ScreenPoint>();

            for (int i = 0; i < Points.Count; i++)
            {
                double      x  = this.XAxis.Transform(Points[i].X);
                double      y  = this.YAxis.Transform(Points[i].Y);
                ScreenPoint sp = new ScreenPoint(x, y);

                sps.Add(sp);
            }

            BoxPosition box_position = BoxPosition.Left;

            switch (PointLineStyle)
            {
            case ePointLineStyle.Smooth:
                box_position = BoxPosition.Left;
                ResetSmoothedPoints(sps);
                RenderLine(rc, clippingRect, _smooth_points, Color, this.LineWidth, this.LineStyle);
                break;

            case ePointLineStyle.Polygon:
                RenderLine(rc, clippingRect, sps, Color, this.LineWidth, this.LineStyle);
                box_position = BoxPosition.Left;
                break;

            case ePointLineStyle.Cloumn:
                RenderColumn(rc, model, clippingRect, sps, Color);
                box_position = BoxPosition.Middle;
                break;
            }

            if (_is_average && ShowEverage)
            {
                double y     = this.YAxis.Transform(_average);
                double left  = model.PlotArea.Left;
                double right = model.PlotArea.Right;

                rc.DrawLine(left, y, right, y, new OxyPen(average_color, 1, LineStyle.Dash, LineJoin.Miter));
                string average_text = FormatValue(_average);
                rc.DrawText(new ScreenPoint(left + 10, y - 15), average_text, average_color, "Arial");
            }

            if (LimitValue != Helper.InvalidData && ShowEverage)
            {
                double y     = this.YAxis.Transform(LimitValue);
                double left  = model.PlotArea.Left;
                double right = model.PlotArea.Right;

                if (y >= this.YAxis.ScreenMin.Y && y <= this.YAxis.ScreenMax.Y)
                {
                    rc.DrawLine(left, y, right, y, new OxyPen(limit_color, 1, LineStyle.Solid, LineJoin.Miter));
                    string limit_text = FormatValue(LimitValue);
                    rc.DrawText(new ScreenPoint(left + 10, y - 15), limit_text, limit_color, "Arial");
                }
            }

            if (PointLineStyle == ePointLineStyle.Polygon || PointLineStyle == ePointLineStyle.Smooth)
            {
                for (int i = 0; i < Points.Count; i++)
                {
                    if (PointLineStyle != ePointLineStyle.Cloumn)
                    {
                        rc.DrawMarker(clippingRect, sps[i], this.MarkerType, null, MarkerSize, Color, MarkerStroke, 1);
                    }
                    if (LabelVisible)
                    {
                        string text = FormatValue(Points[i].Y);
                        RenderBoxText(rc, ThemeMode, clippingRect, text, TextPadding, sps[i], TextOffset, Color, box_position);
                    }
                }
            }

            RenderCurrentLegend(rc, _mouse_move_point);
        }
Esempio n. 9
0
        public override void Render(IRenderContext rc, PlotModel model1)
        {
            PlotModel model = this.PlotModel;

            this.YAxis = ((MapPlotModel)model).GetAxis(this.YKey);
            if (!SeriesVisible || !((IAxis)this.YAxis).AxisVisible)
            {
                return;
            }
            //AjustAxis();
            if (_pts.Count == 0)
            {
                return;
            }
            OxyColor average_color = OxyColors.Green;
            OxyColor limit_color   = OxyColors.Red;

            if (Theme != null)
            {
                LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                this.FillColor = Helper.ConvertColorToOxyColor(style.LineColor);
                average_color  = Helper.ConvertColorToOxyColor(style.AverageColor);
                limit_color    = Helper.ConvertColorToOxyColor(style.AlarmColor);
            }

            rc.ResetClip();
            IAxis   y_axis       = this.YAxis as IAxis;
            OxyRect clippingRect = y_axis.Bound;

            double width = model.PlotArea.Width;

            List <FeatureText> features = new List <FeatureText>();
            //compute offset
            List <string> column_serieses = new List <string>();

            for (int i = 0; i < model1.Series.Count; i++)
            {
                if (model1.Series[i] is PointColumnSeries || (model1.Series[i] is PointLineSeries && ((PointLineSeries)model1.Series[i]).PointLineStyle == ePointLineStyle.Cloumn))
                {
                    column_serieses.Add(((ISeries)model.Series[i]).Id);
                }
            }

            int    column_padding = 3;
            double total_width    = this.XAxis.Transform(1) - this.XAxis.Transform(0);
            double column_width   = this.ColumnWidth;

            if ((this.ColumnWidth + column_padding) * column_serieses.Count > total_width)
            {
                //auto width;
                column_width = (total_width - column_serieses.Count * column_padding) / column_serieses.Count;
            }
            if (column_width < 1)
            {
                column_width = 1;
            }
            int    index = column_serieses.IndexOf(this.Id);
            double total_column_width = column_width * column_serieses.Count + (column_serieses.Count - 1) * column_padding;
            double offset             = 0;

            if (index >= 0)
            {
                offset = index * (column_width + column_padding) - total_column_width / 2 + column_width / 2;;
            }
            for (int i = 0; i < Count; i++)
            {
                double value = double.Parse(this[i].Value);
                double x     = this.XAxis.Transform(this[i].Index) + offset;
                if (value == 0)
                {
                    continue;
                }
                double      y            = this.YAxis.Transform(value);
                ScreenPoint center_point = new ScreenPoint(x, y);

                string text = PointLineSeries.FormatValue(value);
                if (double.Parse(text) == 0)
                {
                    continue;
                }
                features.Add(new FeatureText(text, center_point, new OxySize(10, 10), center_point));

                ScreenPoint left_top  = new ScreenPoint(center_point.X - ColumnWidth / 2, center_point.Y);
                ScreenPoint right_top = new ScreenPoint(center_point.X + ColumnWidth / 2, center_point.Y);

                double      y1           = this.YAxis.Transform(0);
                ScreenPoint right_bottom = new ScreenPoint(right_top.X, y1 - 2);
                ScreenPoint left_bottom  = new ScreenPoint(left_top.X, y1 - 2);

                IList <ScreenPoint> poligon = new List <ScreenPoint>();
                poligon.Add(left_top);
                poligon.Add(right_top);
                poligon.Add(right_bottom);
                poligon.Add(left_bottom);
                rc.DrawClippedPolygon(clippingRect, poligon, 2, FillColor, FillColor);
            }

            if (_is_average && ShowEverage)
            {
                double y     = this.YAxis.Transform(_average);
                double left  = model.PlotArea.Left;
                double right = model.PlotArea.Right;

                rc.DrawLine(left, y, right, y, new OxyPen(average_color, 1, LineStyle.Dash, LineJoin.Miter));
                string average_text = PointLineSeries.FormatValue(_average);
                rc.DrawText(new ScreenPoint(left + 10, y - 15), average_text, average_color, "Arial");
            }

            if (LimitValue != Helper.InvalidData && ShowLimit)
            {
                double y     = this.YAxis.Transform(LimitValue);
                double left  = model.PlotArea.Left;
                double right = model.PlotArea.Right;

                if (y >= this.YAxis.ScreenMin.Y && y <= this.YAxis.ScreenMax.Y)
                {
                    rc.DrawLine(left, y, right, y, new OxyPen(limit_color, 1, LineStyle.Solid, LineJoin.Miter));
                    string limit_text = PointLineSeries.FormatValue(LimitValue);
                    rc.DrawText(new ScreenPoint(left + 10, y - 15), limit_text, limit_color, "Arial");
                }
            }

            if (LabelVisible)
            {
                foreach (FeatureText feature in features)
                {
                    if (double.Parse(feature.Text) == 0)
                    {
                        continue;
                    }
                    PointLineSeries.RenderBoxText(rc, ThemeMode, clippingRect, feature.Text, TextPadding, feature.Position, TextOffset, FillColor, PointLineSeries.BoxPosition.Middle);
                }
            }
        }
Esempio n. 10
0
        public override void Render(IRenderContext rc, PlotModel model1)
        {
            PlotModel model = this.PlotModel;

            //throw new NotImplementedException();
            _legends.Clear();
            Dictionary <OxyRect, Tuple <List <Series>, OxyColor> > legends = new Dictionary <OxyRect, Tuple <List <Series>, OxyColor> >();

            foreach (Axis axis in model.Axes)
            {
                IAxis axis_cur = axis as IAxis;
                if (!axis_cur.AxisVisible)
                {
                    continue;
                }

                List <Series> seriess = new List <Series>();
                OxyColor      color   = ((Axis)axis_cur).TicklineColor;
                for (int i = 0; i < model.Series.Count; i++)
                {
                    ISeries se = model.Series[i] as ISeries;
                    if (se != null && se.YKey == axis_cur.AxisKey)
                    {
                        seriess.Add(model.Series[i]);
                    }
                }
                double x       = axis_cur.Bound.Left + axis_cur.Bound.Width / 2;
                double y       = axis_cur.Bound.Top + axis_cur.Bound.Height / 2;
                bool   contain = false;
                foreach (KeyValuePair <OxyRect, Tuple <List <Series>, OxyColor> > pair in legends)
                {
                    if (pair.Key.Contains(x, y))
                    {
                        contain = true;
                        List <Series> collection = pair.Value.Item1;
                        collection.AddRange(seriess);
                        break;
                    }
                }

                if (!contain)
                {
                    legends[axis_cur.Bound] = new Tuple <List <Series>, OxyColor>(seriess, color);
                }
            }

            OxyColor fill_color = OxyColors.Transparent;

            if (Theme != null)
            {
                LineSeriesStyle style = Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                if (style != null)
                {
                    fill_color = Helper.ConvertColorToOxyColor(style.LineColor);
                }
            }

            foreach (KeyValuePair <OxyRect, Tuple <List <Series>, OxyColor> > pair in legends)
            {
                List <Series> seriess = pair.Value.Item1;
                OxyRect       bound   = pair.Key;

                if (seriess.Count > 0)
                {
                    double total_height = 0;
                    List <List <Series> > group_series = new List <List <Series> >();
                    for (int i = 0; i < seriess.Count; i++)
                    {
                        ISeries series_cur = seriess[i] as ISeries;
                        OxySize size       = rc.MeasureText(series_cur.Title);
                        total_height += size.Height + TextPadding;

                        if (group_series.Count == 0)
                        {
                            group_series.Add(new List <Series>());
                        }

                        if (total_height <= bound.Height)
                        {
                            group_series[group_series.Count - 1].Add(seriess[i]);
                        }
                        else
                        {
                            total_height = 0;
                            group_series.Add(new List <Series>());
                            group_series[group_series.Count - 1].Add(seriess[i]);
                        }
                    }

                    double total_width = 0;
                    double max_height  = 0;
                    List <Tuple <ScreenPoint, string, OxyColor> > cache = new List <Tuple <ScreenPoint, string, OxyColor> >();
                    for (int i = group_series.Count - 1; i >= 0; i--)
                    {
                        double cur_max_width = 0;
                        double top           = bound.Top + TopPadding;
                        double cu_height     = 0;
                        for (int j = 0; j < group_series[i].Count; j++)
                        {
                            ISeries series_cur = seriess[j] as ISeries;
                            OxySize size       = rc.MeasureText(series_cur.Title);
                            if (size.Width > cur_max_width)
                            {
                                cur_max_width = size.Width;
                            }

                            double  left = bound.Right - RightPadding - total_width - size.Width;
                            OxyRect rect = new OxyRect(left, top, size.Width, size.Height);
                            _legends.Add(new LegendModel {
                                Series = series_cur, Rect = rect
                            });

                            OxyColor color = OxyColors.Blue;
                            if (series_cur.Theme != null)
                            {
                                LineSeriesStyle style = series_cur.Theme.GetStyle(ThemeMode) as LineSeriesStyle;
                                color = Helper.ConvertColorToOxyColor(style.LineColor);
                            }
                            if (!series_cur.SeriesVisible)
                            {
                                color = OxyColors.Gray;
                            }
                            cache.Add(new Tuple <ScreenPoint, string, OxyColor>(new ScreenPoint(left, top), series_cur.Title, color));
                            top       += size.Height + TextPadding;
                            cu_height += size.Height + TextPadding;
                        }
                        total_width += cur_max_width + 2 * TextPadding;
                        if (max_height < cu_height)
                        {
                            max_height = cu_height;
                        }
                    }
                    max_height += TopPadding;
                    rc.DrawRectangle(new OxyRect(bound.Right - total_width, bound.Top, total_width, max_height), fill_color, pair.Value.Item2);
                    for (int i = 0; i < cache.Count; i++)
                    {
                        rc.DrawText(cache[i].Item1, cache[i].Item2, cache[i].Item3);
                    }
                }
            }
        }