internal void Apply(Chart chart) { chart.BeginUpdate(); IRenderer renderer = chart.Renderers.GetRenderer(Renderer); if (renderer != null) { renderer.Options = RendererOptions; BaseRenderer renderer2 = renderer as BaseRenderer; if (renderer2 != null) { renderer2.Symbol = Symbol; renderer2.Connection = Connection; } if (chart.Data != null) { chart.Data.Renderer = renderer; using (IEnumerator <DataSeries> enumerator = chart.Data.Children.GetEnumerator()) { while (enumerator.MoveNext()) { enumerator.Current.ClearDataCache(); } } } if ((chart.View != null) && chart.View.Inverted) { renderer2.Inverted = !renderer2.Inverted; } } chart.EndUpdate(); }
protected override bool Render(RenderContext rc) { if (double.IsInfinity(rc.Rect.Width) || double.IsInfinity(rc.Rect.Height)) { return(false); } Rect rect = rc.Rect; if (double.IsNaN(rect.X) || double.IsNaN(rect.Y)) { return(false); } if ((rect.Width == 0.0) || (rect.Height == 0.0)) { BaseRenderer renderer = rc.Renderer as BaseRenderer; if ((renderer != null) && (renderer.Stacked != StackedOptions.None)) { return(false); } } rect = rect.IntersectRect(rc.Bounds); if (rect.IsEmptyRect()) { return(false); } // uno不支持Path.Data为非PathGeometry! // wasm中在给Path.Data赋值前内容必须完整,后添加的Figures无效!众里寻他千百度,因为赋值没按顺序,操! PathGeometry geometry = new PathGeometry(); PathFigure pf = new PathFigure(); pf.Segments.Add(new LineSegment { Point = new Point() }); pf.Segments.Add(new LineSegment { Point = new Point(rect.Width, 0) }); pf.Segments.Add(new LineSegment { Point = new Point(rect.Width, rect.Height) }); pf.Segments.Add(new LineSegment { Point = new Point(0, rect.Height) }); pf.Segments.Add(new LineSegment { Point = new Point() }); geometry.Figures.Add(pf); Data = geometry; Canvas.SetLeft(this, rect.X); Canvas.SetTop(this, rect.Y); RectangleGeometry geometry2 = new RectangleGeometry(); _labelRect = new Rect(-1.0, -1.0, rect.Width + 2.0, rect.Height + 2.0); geometry2.Rect = _labelRect; Clip = geometry2; return(true); }
protected override bool Render(RenderContext rc) { Point[] points = rc.Points; if ((points == null) || (points.Length < 2)) { return(false); } BaseRenderer renderer = rc.Renderer as BaseRenderer; bool inverted = (renderer != null) && renderer.Inverted; points = Lines.CreateSteps(points, inverted); Rect rect = rc.Bounds2D; bool isCustomClipping = rc.IsCustomClipping; // uno不支持Path.Data为非PathGeometry! // wasm中在给Path.Data赋值前内容必须完整,后添加的Figures无效!众里寻他千百度,因为赋值没按顺序,操! PathGeometry geometry = new PathGeometry(); if (rc.hasNan) { List <Point[]> list = base.SplitPointsWithHoles(points); if (list != null) { for (int i = 0; i < list.Count; i++) { PathFigure[] figureArray = base.RenderSegment(list[i], double.NaN, isCustomClipping ? rect : Extensions.EmptyRect); int length = figureArray.Length; for (int j = 0; j < length; j++) { geometry.Figures.Add(figureArray[j]); } } } } else { PathFigure[] figureArray2 = base.RenderSegment(points, double.NaN, isCustomClipping ? rect : Extensions.EmptyRect); int num4 = figureArray2.Length; for (int k = 0; k < num4; k++) { geometry.Figures.Add(figureArray2[k]); } } Data = geometry; _labelRect = rect; if (!isCustomClipping) { RectangleGeometry geometry2 = new RectangleGeometry(); geometry2.Rect = rect; base.Clip = geometry2; } return(true); }
protected override bool Render(RenderContext rc) { Point[] points = rc.Points; if (points == null) { return(false); } BaseRenderer renderer = rc.Renderer as BaseRenderer; bool inverted = (renderer != null) && renderer.Inverted; bool flag2 = (renderer != null) && renderer.IsStacked; double[] previousValues = rc.PreviousValues; double d = inverted ? rc.ConvertX(0.0) : rc.ConvertY(0.0); double naN = double.NaN; if ((rc.OptimizationRadiusScope & OptimizationRadiusScope.Lines) > ((OptimizationRadiusScope)0)) { naN = rc.OptimizationRadius; } if (double.IsNaN(d)) { d = inverted ? (rc.XReversed ? (rc.Bounds2D.X + rc.Bounds2D.Width) : rc.Bounds2D.X) : (rc.YReversed ? rc.Bounds2D.Y : (rc.Bounds2D.Y + rc.Bounds2D.Height)); } Rect cr = rc.IsCustomClipping ? new Rect(rc.Bounds2D.X - 2.0, rc.Bounds2D.Y - 2.0, rc.Bounds2D.Width + 4.0, rc.Bounds2D.Height + 4.0) : Extensions.EmptyRect; // uno不支持Path.Data为非PathGeometry! // wasm中在给Path.Data赋值前内容必须完整,后添加的Figures无效!众里寻他千百度,因为赋值没按顺序,操! PathGeometry geometry = new PathGeometry(); if (flag2 && (previousValues != null)) { points = Lines.CreateSteps(points, inverted); previousValues = Lines.CreateSteps(previousValues); int length = points.Length; Point[] pts = new Point[2 * length]; for (int i = 0; i < length; i++) { pts[i] = points[i]; if (inverted) { pts[length + i] = new Point(rc.ConvertX(previousValues[(length - i) - 1]), points[(length - i) - 1].Y); } else { pts[length + i] = new Point(points[(length - i) - 1].X, rc.ConvertY(previousValues[(length - i) - 1])); } } if (pts != null) { PathFigure figure = base.RenderSegment(pts); geometry.Figures.Add(figure); } } else { points = Lines.CreateSteps(points, inverted); List <Point[]> list = base.SplitPointsWithHoles(points); if (list != null) { for (int j = 0; j < list.Count; j++) { PathFigure figure2 = null; figure2 = base.RenderNonStacked(list[j], d, inverted, naN, cr); if (figure2 != null) { geometry.Figures.Add(figure2); } } } } Data = geometry; RectangleGeometry geometry3 = new RectangleGeometry(); _labelRect = rc.Bounds2D; geometry3.Rect = _labelRect; Clip = geometry3; return(true); }
protected override bool Render(RenderContext rc) { Point[] points = rc.Points; if ((points == null) || (points.Length < 2)) { return(false); } BaseRenderer renderer = rc.Renderer as BaseRenderer; if (renderer == null) { return(false); } bool inverted = renderer.Inverted; double naN = double.NaN; if ((rc.OptimizationRadiusScope & OptimizationRadiusScope.Lines) > ((OptimizationRadiusScope)0)) { naN = rc.OptimizationRadius; } double[] previousValues = rc.PreviousValues; Point[] pts = null; // uno不支持Path.Data为非PathGeometry! // wasm中在给Path.Data赋值前内容必须完整,后添加的Figures无效!众里寻他千百度,因为赋值没按顺序,操! PathGeometry geometry = new PathGeometry(); if (renderer.IsStacked && previousValues != null) { int length = points.Length; if ((previousValues != null) && (previousValues.Length == length)) { if (base.Smoothed && (length > 3)) { Point[] pointArray3 = InitPrevious(rc, inverted, points, previousValues); points = new SplineNew(points).Calculate(); pointArray3 = new SplineNew(pointArray3).Calculate(); length = points.Length; pts = new Point[2 * length]; for (int i = 0; i < length; i++) { pts[i] = points[i]; pts[length + i] = pointArray3[(length - i) - 1]; } } else { pts = new Point[2 * length]; for (int j = 0; j < length; j++) { pts[j] = points[j]; if (inverted) { pts[length + j] = new Point(rc.ConvertX(previousValues[(length - j) - 1]), points[(length - j) - 1].Y); } else { pts[length + j] = new Point(points[(length - j) - 1].X, rc.ConvertY(previousValues[(length - j) - 1])); } } } } if (pts != null) { PathFigure figure = RenderSegment(pts); geometry.Figures.Add(figure); } } else { double num5 = inverted ? rc.ConvertX(0.0) : rc.ConvertY(0.0); if (double.IsNaN(num5)) { num5 = inverted ? (rc.XReversed ? (rc.Bounds.X + rc.Bounds.Width) : rc.Bounds.X) : (rc.YReversed ? rc.Bounds.Y : (rc.Bounds.Y + rc.Bounds.Height)); } List <Point[]> list = base.SplitPointsWithHoles(points); Rect cr = rc.IsCustomClipping ? new Rect(rc.Bounds2D.X - 2.0, rc.Bounds2D.Y - 2.0, rc.Bounds2D.Width + 4.0, rc.Bounds2D.Height + 4.0) : Extensions.EmptyRect; if (list != null) { for (int k = 0; k < list.Count; k++) { Point[] pointArray4 = list[k]; PathFigure figure; if (renderer is RadarRenderer) { figure = RenderSegment(pointArray4); } else { figure = RenderNonStacked(pointArray4, num5, inverted, naN, cr); } if (figure != null) { geometry.Figures.Add(figure); } } } } Data = geometry; RectangleGeometry geometry2 = new RectangleGeometry(); geometry2.Rect = new Rect(rc.Bounds.X, rc.Bounds.Y, rc.Bounds.Width, rc.Bounds.Height); base.Clip = geometry2; return(true); }
internal RenderContext(IRenderer renderer, IDataSeriesInfo ds, int npts) { _cur = new Point(); _prev = new Point(); _curView = new Point(); _bounds = new Rect(); _stacked = new List <double>(); _excludeHoles = true; _pts = new List <Point>(); _rect = Extensions.EmptyRect; _clipBounds = Extensions.EmptyRect; _rendrerer = renderer; _ds = ds; _pts.Capacity = npts; if (_ds != null) { _names = _ds.GetDataNames(); } Chart visual = renderer.Visual as Chart; Chart = visual; BaseRenderer renderer2 = renderer as BaseRenderer; _isStacked = (renderer2 != null) && renderer2.IsStacked; hasNan = renderer2._dataInfo.hasNaN; DataSeries series = ds as DataSeries; if (series != null) { Renderer2D rendererd = renderer as Renderer2D; if ((((byte)(series.Display & SeriesDisplay.ShowNaNGap)) != 0) && (rendererd != null)) { _excludeHoles = false; } if (rendererd != null) { string axisX = series.AxisX; string axisY = series.AxisY; bool flag = !string.IsNullOrEmpty(axisX); bool flag2 = !string.IsNullOrEmpty(axisY); if (visual != null) { ChartViewport2D viewElement = visual.View.Viewport; if (viewElement != null) { if (flag || flag2) { foreach (Axis axis in viewElement.Axes) { if (flag && (axis.AxisName == axisX)) { _ax = axis; hasNan = true; } if (flag2 && (axis.AxisName == axisY)) { _ay = axis; hasNan = true; } } } _defax = viewElement._ax; _defay = viewElement._ay; } } } } if (visual.View != null) { ChartView view = visual.View; if (_ax != null) { XReversed = _ax.ReversedInternal; } else if (visual.View.AxisX != null) { XReversed = visual.View.AxisX.Reversed; } if (_ay != null) { YReversed = _ay.ReversedInternal; } else if (visual.View.AxisY != null) { YReversed = visual.View.AxisY.Reversed; } Axis axis2 = visual.View.GetAxisX(series); if ((axis2 != null) && !double.IsNaN(axis2.LogBase)) { hasNan = true; } Axis axis3 = visual.View.GetAxisY(series); if ((axis3 != null) && !double.IsNaN(axis3.LogBase)) { hasNan = true; } if ((renderer2 != null) && renderer2.Inverted) { if ((axis2 != null) && (axis2.PlotAreaIndex != 0)) { ClusterPlotAreaIndex = axis2.PlotAreaIndex; } } else if ((axis3 != null) && (axis3.PlotAreaIndex != 0)) { ClusterPlotAreaIndex = axis3.PlotAreaIndex; } } }