public void Remove(AxisScaleSegment segment) { if (segment != null) { base.List.Remove(segment); } }
internal RectangleF GetBreakLinePosition(ChartGraphics graph, AxisScaleSegment nextSegment) { RectangleF relative = axis.PlotAreaPosition.ToRectangleF(); double linearPosition = axis.GetLinearPosition(nextSegment.ScaleMinimum); double linearPosition2 = axis.GetLinearPosition(ScaleMaximum); if (axis.AxisPosition == AxisPosition.Right || axis.AxisPosition == AxisPosition.Left) { relative.Y = (float)Math.Min(linearPosition, linearPosition2); relative.Height = (float)Math.Max(linearPosition, linearPosition2); } else { relative.X = (float)Math.Min(linearPosition, linearPosition2); relative.Width = (float)Math.Max(linearPosition, linearPosition2); } relative = Rectangle.Round(graph.GetAbsoluteRectangle(relative)); if (axis.AxisPosition == AxisPosition.Right || axis.AxisPosition == AxisPosition.Left) { relative.Height = Math.Abs(relative.Y - relative.Height); relative.X -= axis.chartArea.BorderWidth; relative.Width += 2 * axis.chartArea.BorderWidth; } else { relative.Width = Math.Abs(relative.X - relative.Width); relative.Y -= axis.chartArea.BorderWidth; relative.Height += 2 * axis.chartArea.BorderWidth; } return(relative); }
internal void GetAxisSegmentForScaleBreaks(AxisScaleSegmentCollection axisSegments) { axisSegments.Clear(); if (!IsEnabled()) { return; } FillAxisSegmentCollection(axisSegments); if (axisSegments.Count < 1) { return; } int startScaleFromZeroSegmentIndex = GetStartScaleFromZeroSegmentIndex(axisSegments); int num = 0; foreach (AxisScaleSegment axisSegment in axisSegments) { bool shouldStartFromZero = (num == startScaleFromZeroSegmentIndex) ? true : false; double minimum = axisSegment.ScaleMinimum; double maximum = axisSegment.ScaleMaximum; axisSegment.Interval = axis.EstimateNumberAxis(ref minimum, ref maximum, shouldStartFromZero, axis.prefferedNumberofIntervals, axis.Crossing, autoMaximum: true, autoMinimum: true); axisSegment.ScaleMinimum = minimum; axisSegment.ScaleMaximum = maximum; if (axisSegment.ScaleMinimum < axis.Minimum) { axisSegment.ScaleMinimum = axis.Minimum; } if (axisSegment.ScaleMaximum > axis.Maximum) { axisSegment.ScaleMaximum = axis.Maximum; } num++; } bool flag = false; AxisScaleSegment axisScaleSegment2 = axisSegments[0]; for (int i = 1; i < axisSegments.Count; i++) { AxisScaleSegment axisScaleSegment3 = axisSegments[i]; if (axisScaleSegment3.ScaleMinimum <= axisScaleSegment2.ScaleMaximum) { if (axisScaleSegment3.ScaleMaximum > axisScaleSegment2.ScaleMaximum) { axisScaleSegment2.ScaleMaximum = axisScaleSegment3.ScaleMaximum; } flag = true; axisSegments.RemoveAt(i); i--; } else { axisScaleSegment2 = axisScaleSegment3; } } if (flag) { SetAxisSegmentPosition(axisSegments); } }
internal void EnforceSegment(AxisScaleSegment segment) { enforcedSegment = segment; }
public void Insert(int index, AxisScaleSegment value) { base.List.Insert(index, value); }
public int IndexOf(AxisScaleSegment value) { return(base.List.IndexOf(value)); }
public bool Contains(AxisScaleSegment value) { return(base.List.Contains(value)); }
public int Add(AxisScaleSegment segment) { return(base.List.Add(segment)); }
internal void PaintBreakLine(ChartGraphics graph, AxisScaleSegment nextSegment) { RectangleF breakLinePosition = GetBreakLinePosition(graph, nextSegment); GraphicsPath breakLinePath = GetBreakLinePath(breakLinePosition, top: true); GraphicsPath graphicsPath = null; if (breakLinePosition.Width > 0f && breakLinePosition.Height > 0f) { graphicsPath = GetBreakLinePath(breakLinePosition, top: false); using (GraphicsPath graphicsPath2 = new GraphicsPath()) { graphicsPath2.AddPath(breakLinePath, connect: true); graphicsPath2.Reverse(); graphicsPath2.AddPath(graphicsPath, connect: true); graphicsPath2.CloseAllFigures(); using (Brush brush = GetChartFillBrush(graph)) { graph.FillPath(brush, graphicsPath2); if (axis.chartArea.ShadowOffset != 0 && !axis.chartArea.ShadowColor.IsEmpty) { RectangleF rect = breakLinePosition; if (axis.AxisPosition == AxisPosition.Right || axis.AxisPosition == AxisPosition.Left) { rect.Y += axis.chartArea.ShadowOffset; rect.Height -= axis.chartArea.ShadowOffset; rect.X = rect.Right - 1f; rect.Width = axis.chartArea.ShadowOffset + 2; } else { rect.X += axis.chartArea.ShadowOffset; rect.Width -= axis.chartArea.ShadowOffset; rect.Y = rect.Bottom - 1f; rect.Height = axis.chartArea.ShadowOffset + 2; } graph.FillRectangle(brush, rect); using (GraphicsPath graphicsPath3 = new GraphicsPath()) { graphicsPath3.AddPath(breakLinePath, connect: false); float val = axis.chartArea.ShadowOffset; val = ((axis.AxisPosition != AxisPosition.Right && axis.AxisPosition != 0) ? Math.Min(val, breakLinePosition.Width) : Math.Min(val, breakLinePosition.Height)); int num = (int)((float)(int)axis.chartArea.ShadowColor.A / val); RectangleF absoluteRectangle = graph.GetAbsoluteRectangle(axis.PlotAreaPosition.ToRectangleF()); if (axis.AxisPosition == AxisPosition.Right || axis.AxisPosition == AxisPosition.Left) { absoluteRectangle.X += axis.chartArea.ShadowOffset; absoluteRectangle.Width += axis.chartArea.ShadowOffset; } else { absoluteRectangle.Y += axis.chartArea.ShadowOffset; absoluteRectangle.Height += axis.chartArea.ShadowOffset; } graph.SetClip(graph.GetRelativeRectangle(absoluteRectangle)); for (int i = 0; (float)i < val; i++) { using (Matrix matrix = new Matrix()) { if (axis.AxisPosition == AxisPosition.Right || axis.AxisPosition == AxisPosition.Left) { matrix.Translate(0f, 1f); } else { matrix.Translate(1f, 0f); } graphicsPath3.Transform(matrix); } using (Pen pen = new Pen(Color.FromArgb(axis.chartArea.ShadowColor.A - num * i, axis.chartArea.ShadowColor), 1f)) { graph.DrawPath(pen, graphicsPath3); } } graph.ResetClip(); } } } } } if (axis.ScaleBreakStyle.BreakLineType != 0) { using (Pen pen2 = new Pen(axis.ScaleBreakStyle.LineColor, axis.ScaleBreakStyle.LineWidth)) { pen2.DashStyle = graph.GetPenStyle(axis.ScaleBreakStyle.LineStyle); graph.DrawPath(pen2, breakLinePath); if (breakLinePosition.Width > 0f && breakLinePosition.Height > 0f) { graph.DrawPath(pen2, graphicsPath); } } } breakLinePath.Dispose(); breakLinePath = null; if (graphicsPath != null) { graphicsPath.Dispose(); graphicsPath = null; } }
private void FillAxisSegmentCollection(AxisScaleSegmentCollection axisSegments) { axisSegments.Clear(); double minYValue = 0.0; double maxYValue = 0.0; double segmentSize = 0.0; double[] segmentMaxValue = null; double[] segmentMinValue = null; int[] seriesDataStatistics = GetSeriesDataStatistics(totalNumberOfSegments, out minYValue, out maxYValue, out segmentSize, out segmentMaxValue, out segmentMinValue); if (seriesDataStatistics == null) { return; } double minimum = minYValue; double maximum = maxYValue; axis.EstimateNumberAxis(ref minimum, ref maximum, axis.StartFromZero, axis.prefferedNumberofIntervals, axis.Crossing, autoMaximum: true, autoMinimum: true); if (maxYValue == minYValue) { return; } double num = (maxYValue - minYValue) / ((maximum - minimum) / 100.0); ArrayList arrayList = new ArrayList(); bool flag = false; while (!flag) { flag = true; int startSegment = 0; int numberOfSegments = 0; GetLargestSequenseOfSegmentsWithNoPoints(seriesDataStatistics, out startSegment, out numberOfSegments); int num2 = (int)((double)minimumNumberOfEmptySegments * (100.0 / num)); if (axisSegments.Count > 0 && numberOfSegments > 0) { foreach (AxisScaleSegment axisSegment in axisSegments) { if (startSegment > 0 && startSegment + numberOfSegments <= segmentMaxValue.Length - 1 && segmentMaxValue[startSegment - 1] >= axisSegment.ScaleMinimum && segmentMinValue[startSegment + numberOfSegments] <= axisSegment.ScaleMaximum) { double num3 = axisSegment.ScaleMaximum - axisSegment.ScaleMinimum; if ((segmentMinValue[startSegment + numberOfSegments] - segmentMaxValue[startSegment - 1]) / (num3 / 100.0) / 100.0 * axisSegment.Size > (double)num2 && (double)numberOfSegments > minSegmentSize) { num2 = numberOfSegments; } } } } if (numberOfSegments >= num2) { flag = false; arrayList.Add(startSegment); arrayList.Add(numberOfSegments); axisSegments.Clear(); if (arrayList.Count > 0) { double num4 = double.NaN; double num5 = double.NaN; int num6 = 0; for (int i = 0; i < seriesDataStatistics.Length; i++) { bool flag2 = IsExcludedSegment(arrayList, i); if (!flag2 && !double.IsNaN(segmentMinValue[i]) && !double.IsNaN(segmentMaxValue[i])) { num6 += seriesDataStatistics[i]; if (double.IsNaN(num4)) { num4 = segmentMinValue[i]; num5 = segmentMaxValue[i]; } else { num5 = segmentMaxValue[i]; } } if (!double.IsNaN(num4) && (flag2 || i == seriesDataStatistics.Length - 1)) { if (num5 == num4) { num4 -= segmentSize; num5 += segmentSize; } AxisScaleSegment axisScaleSegment2 = new AxisScaleSegment(); axisScaleSegment2.ScaleMaximum = num5; axisScaleSegment2.ScaleMinimum = num4; axisScaleSegment2.Tag = num6; axisSegments.Add(axisScaleSegment2); num4 = double.NaN; num5 = double.NaN; num6 = 0; } } } SetAxisSegmentPosition(axisSegments); } if (axisSegments.Count - 1 >= maximumNumberOfBreaks) { flag = true; } } }