protected virtual void ProcessChartType3D(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { ArrayList arrayList = null; if (area.Area3DStyle.Clustered && this.SideBySideSeries) { goto IL_0020; } if (this.Stacked) { goto IL_0020; } arrayList = new ArrayList(); arrayList.Add(seriesToDraw.Name); goto IL_0044; IL_0044: ArrayList dataPointDrawingOrder = area.GetDataPointDrawingOrder(arrayList, this, selection, COPCoordinates.X, null, this.yValueIndex, false); foreach (object item in dataPointDrawingOrder) { this.ProcessSinglePoint3D((DataPoint3D)item, selection, graph, common, area); } this.DrawAccumulated3DLabels(graph, common, area); return; IL_0020: arrayList = area.GetSeriesFromChartType(this.Name); goto IL_0044; }
protected override void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { gradientFill = false; lowPoints = null; indexedBasedX = area.IndexedSeries((string[])area.GetSeriesFromChartType(Name).ToArray(typeof(string))); base.ProcessChartType(selection, graph, common, area, seriesToDraw); FillLastSeriesGradient(graph); }
protected virtual void ProcessChartType3D(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { ArrayList arrayList = null; if ((area.Area3DStyle.Clustered && SideBySideSeries) || Stacked) { arrayList = area.GetSeriesFromChartType(Name); } else { arrayList = new ArrayList(); arrayList.Add(seriesToDraw.Name); } foreach (object item in area.GetDataPointDrawingOrder(arrayList, this, selection, COPCoordinates.X, null, yValueIndex, sideBySide: false)) { ProcessSinglePoint3D((DataPoint3D)item, selection, graph, common, area); } DrawAccumulated3DLabels(graph, common, area); }
public void AddSmartLabelMarkerPositions(CommonElements common, ChartArea area, Series series, ArrayList list) { indexedSeries = area.IndexedSeries((string[])area.GetSeriesFromChartType(Name).ToArray(typeof(string))); Axis axis = area.GetAxis(AxisName.X, series.XAxisType, series.XSubAxisName); Axis axis2 = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName); int num = 0; int num2 = 1; foreach (DataPoint point in series.Points) { double yValue = GetYValue(common, area, series, point, num2 - 1, yValueIndex); yValue = axis2.GetLogValue(yValue); if (yValue > axis2.GetViewMaximum() || yValue < axis2.GetViewMinimum()) { num2++; continue; } double yValue2 = indexedSeries ? ((double)num2) : point.XValue; yValue2 = axis.GetLogValue(yValue2); if (yValue2 > axis.GetViewMaximum() || yValue2 < axis.GetViewMinimum()) { num2++; continue; } if (!ShouldDrawMarkerOnViewEdgeX()) { if (yValue2 == axis.GetViewMaximum() && ShiftedX >= 0.0) { num2++; continue; } if (yValue2 == axis.GetViewMinimum() && ShiftedX <= 0.0) { num2++; continue; } } PointF pointF = PointF.Empty; pointF.Y = (float)axis2.GetLinearPosition(yValue); if (indexedSeries) { pointF.X = (float)axis.GetPosition(num2); } else { pointF.X = (float)axis.GetPosition(point.XValue); } pointF.X += (float)ShiftedX; int markerSize = point.MarkerSize; string markerImage = point.MarkerImage; MarkerStyle markerStyle = point.MarkerStyle; SizeF markerSize2 = GetMarkerSize(common.graph, common, area, point, markerSize, markerImage); if (area.Area3DStyle.Enable3D) { area.GetSeriesZPositionAndDepth(series, out float depth, out float positionZ); Point3D[] array = new Point3D[1] { new Point3D(pointF.X, pointF.Y, positionZ + (middleMarker ? (depth / 2f) : depth)) }; area.matrix3D.TransformPoints(array); pointF = array[0].PointF; } if (alwaysDrawMarkers || markerStyle != 0 || markerImage.Length > 0) { if (num == 0) { markerSize2 = common.graph.GetRelativeSize(markerSize2); RectangleF rectangleF = new RectangleF(pointF.X - markerSize2.Width / 2f, pointF.Y - markerSize2.Height / 2f, markerSize2.Width, markerSize2.Height); list.Add(rectangleF); } num++; if (series.MarkerStep == num) { num = 0; } } num2++; } }
protected virtual void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { if (area.Area3DStyle.Enable3D) { ProcessChartType3D(selection, graph, common, area, seriesToDraw); return; } if (ShiftedSerName.Length == 0) { indexedSeries = area.IndexedSeries((string[])area.GetSeriesFromChartType(Name).ToArray(typeof(string))); } else { indexedSeries = ChartElement.IndexedSeries(common.DataManager.Series[ShiftedSerName]); } foreach (Series item in common.DataManager.Series) { bool flag = false; if (ShiftedSerName.Length > 0) { if (ShiftedSerName != item.Name) { continue; } flag = true; } if (string.Compare(item.ChartTypeName, Name, ignoreCase: true, CultureInfo.CurrentCulture) != 0 || item.ChartArea != area.Name || !item.IsVisible() || (seriesToDraw != null && seriesToDraw.Name != item.Name)) { continue; } hAxis = area.GetAxis(AxisName.X, item.XAxisType, item.XSubAxisName); vAxis = area.GetAxis(AxisName.Y, item.YAxisType, item.YSubAxisName); double viewMaximum = hAxis.GetViewMaximum(); double viewMinimum = hAxis.GetViewMinimum(); double viewMaximum2 = vAxis.GetViewMaximum(); double viewMinimum2 = vAxis.GetViewMinimum(); if (!selection) { common.EventsManager.OnBackPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } int num = 0; int num2 = 1; foreach (DataPoint point in item.Points) { point.positionRel = new PointF(float.NaN, float.NaN); double yValue = indexedSeries ? ((double)num2) : point.XValue; yValue = hAxis.GetLogValue(yValue); if (yValue > viewMaximum || yValue < viewMinimum) { num2++; continue; } double yValue2 = GetYValue(common, area, item, point, num2 - 1, yValueIndex); yValue2 = vAxis.GetLogValue(yValue2); if (yValue2 > viewMaximum2 || yValue2 < viewMinimum2) { num2++; continue; } bool flag2 = false; if (!ShouldDrawMarkerOnViewEdgeX()) { if (yValue == viewMaximum && ShiftedX >= 0.0) { flag2 = true; } if (yValue == viewMinimum && ShiftedX <= 0.0) { flag2 = true; } } int markerSize = point.MarkerSize; string markerImage = point.MarkerImage; MarkerStyle markerStyle = point.MarkerStyle; PointF empty = PointF.Empty; empty.Y = (float)vAxis.GetLinearPosition(yValue2); if (indexedSeries) { empty.X = (float)hAxis.GetPosition(num2); } else { empty.X = (float)hAxis.GetPosition(point.XValue); } empty.X += (float)ShiftedX; point.positionRel = new PointF(empty.X, empty.Y); SizeF markerSize2 = GetMarkerSize(graph, common, area, point, markerSize, markerImage); if (flag2) { num2++; continue; } if (alwaysDrawMarkers || markerStyle != 0 || markerImage.Length > 0) { if (common.ProcessModePaint) { if (num == 0) { graph.StartHotRegion(point); graph.StartAnimation(); DrawPointMarker(graph, point.series, point, empty, (markerStyle == MarkerStyle.None) ? MarkerStyle.Circle : markerStyle, (int)markerSize2.Height, (point.MarkerColor == Color.Empty) ? point.Color : point.MarkerColor, (point.MarkerBorderColor == Color.Empty) ? point.BorderColor : point.MarkerBorderColor, GetMarkerBorderSize(point), markerImage, point.MarkerImageTransparentColor, (point.series != null) ? point.series.ShadowOffset : 0, (point.series != null) ? point.series.ShadowColor : Color.Empty, new RectangleF(empty.X, empty.Y, markerSize2.Width, markerSize2.Height)); graph.StopAnimation(); graph.EndHotRegion(); } if (common.ProcessModeRegions) { SetHotRegions(common, graph, point, markerSize2, point.series.Name, num2 - 1, markerStyle, empty); } } num++; if (item.MarkerStep == num) { num = 0; } } graph.StartHotRegion(point, labelRegion: true); graph.StartAnimation(); DrawLabels(area, graph, common, empty, (int)markerSize2.Height, point, item, num2 - 1); graph.StopAnimation(); graph.EndHotRegion(); num2++; } if (!selection) { common.EventsManager.OnPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } if (flag) { break; } } }
private void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, bool shadow, bool labels, Series seriesToDraw) { bool flag = false; AxisType axisType = AxisType.Primary; AxisType axisType2 = AxisType.Primary; string a = string.Empty; string a2 = string.Empty; for (int i = 0; i < common.DataManager.Series.Count; i++) { Series series = common.DataManager.Series[i]; if (string.Compare(series.ChartTypeName, Name, StringComparison.OrdinalIgnoreCase) == 0 && !(series.ChartArea != area.Name) && series.IsVisible()) { if (i == 0) { axisType = series.XAxisType; axisType2 = series.YAxisType; a = series.XSubAxisName; a2 = series.YSubAxisName; } else if (axisType != series.XAxisType || axisType2 != series.YAxisType || a != series.XSubAxisName || a2 != series.YSubAxisName) { flag = true; break; } } } if (flag) { for (int j = 0; j < common.DataManager.Series.Count; j++) { Series series2 = common.DataManager.Series[j]; if (string.Compare(series2.ChartTypeName, Name, StringComparison.OrdinalIgnoreCase) == 0 && !(series2.ChartArea != area.Name) && series2.IsVisible()) { string seriesStackGroupName = GetSeriesStackGroupName(series2); seriesStackGroupName = (series2["StackedGroupName"] = "_X_" + series2.XAxisType.ToString() + series2.XSubAxisName + "_Y_" + series2.YAxisType.ToString() + series2.YSubAxisName + "__"); } } } stackGroupNames = new ArrayList(); foreach (Series item in common.DataManager.Series) { if (string.Compare(item.ChartTypeName, Name, StringComparison.OrdinalIgnoreCase) == 0 && !(item.ChartArea != area.Name) && item.IsVisible()) { string seriesStackGroupName2 = GetSeriesStackGroupName(item); if (!stackGroupNames.Contains(seriesStackGroupName2)) { stackGroupNames.Add(seriesStackGroupName2); } } } if (area.Area3DStyle.Enable3D) { if (!shadow) { ProcessChartType3D(selection, graph, common, area, labels, seriesToDraw); } return; } string[] series4 = (string[])area.GetSeriesFromChartType(Name).ToArray(typeof(string)); int numberOfPoints = common.DataManager.GetNumberOfPoints(series4); bool flag2 = area.IndexedSeries(series4); for (int k = 0; k < numberOfPoints; k++) { for (int l = 0; l < stackGroupNames.Count; l++) { currentStackGroup = (string)stackGroupNames[l]; int num = 0; double num2 = 0.0; double num3 = 0.0; foreach (Series item2 in common.DataManager.Series) { if (string.Compare(item2.ChartTypeName, Name, StringComparison.OrdinalIgnoreCase) != 0 || item2.ChartArea != area.Name || !item2.IsVisible() || k >= item2.Points.Count || GetSeriesStackGroupName(item2) != currentStackGroup) { continue; } DataPoint dataPoint = item2.Points[k]; dataPoint.positionRel = new PointF(float.NaN, float.NaN); Axis axis = area.GetAxis(AxisName.Y, item2.YAxisType, item2.YSubAxisName); Axis axis2 = area.GetAxis(AxisName.X, item2.XAxisType, item2.XSubAxisName); bool sameInterval = false; double interval = 1.0; if (!flag2) { if (item2.Points.Count == 1 && (item2.XValueType == ChartValueTypes.Date || item2.XValueType == ChartValueTypes.DateTime || item2.XValueType == ChartValueTypes.Time || item2.XValueType == ChartValueTypes.DateTimeOffset)) { ArrayList seriesFromChartType = area.GetSeriesFromChartType(Name); area.GetPointsInterval(seriesFromChartType, axis2.Logarithmic, axis2.logarithmBase, checkSameInterval: true, out sameInterval); interval = ((double.IsNaN(axis2.majorGrid.Interval) || axis2.majorGrid.IntervalType == DateTimeIntervalType.NotSet) ? axis2.GetIntervalSize(axis2.minimum, axis2.Interval, axis2.IntervalType) : axis2.GetIntervalSize(axis2.minimum, axis2.majorGrid.Interval, axis2.majorGrid.IntervalType)); } else { interval = area.GetPointsInterval(axis2.Logarithmic, axis2.logarithmBase); } } double pointWidth = item2.GetPointWidth(graph, axis2, interval, 0.8); pointWidth /= (double)stackGroupNames.Count; if (!selection) { common.EventsManager.OnBackPaint(item2, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } double num4 = GetYValue(common, area, item2, dataPoint, k, 0); if (num != 0) { num4 = ((!(num4 >= 0.0)) ? (num4 + num3) : (num4 + num2)); } bool flag3 = false; double num5 = num4; num4 = axis.GetLogValue(num4); if (!(flag3 && labels)) { if (num4 > axis.GetViewMaximum()) { num4 = axis.GetViewMaximum(); } if (num4 < axis.GetViewMinimum()) { num4 = axis.GetViewMinimum(); } } double linearPosition = axis.GetLinearPosition(num4); double num6 = 0.0; num6 = ((num == 0) ? ((!(flag3 && labels)) ? axis.Crossing : 0.0) : ((!(GetYValue(common, area, item2, dataPoint, k, 0) >= 0.0)) ? num3 : num2)); double position = axis.GetPosition(num6); double num7 = dataPoint.XValue; if (flag2) { num7 = (double)k + 1.0; } double num8 = axis2.GetPosition(num7); if (stackGroupNames.Count > 1) { num8 = num8 - pointWidth * (double)stackGroupNames.Count / 2.0 + pointWidth / 2.0 + (double)l * pointWidth; } num7 = axis2.GetLogValue(num7); RectangleF empty = RectangleF.Empty; try { empty.X = (float)(num8 - pointWidth / 2.0); empty.Width = (float)pointWidth; if (position < linearPosition) { empty.Y = (float)position; empty.Height = (float)linearPosition - empty.Y; } else { empty.Y = (float)linearPosition; empty.Height = (float)position - empty.Y; } } catch (Exception) { num++; continue; } dataPoint.positionRel = new PointF((float)num8, empty.Top); if (dataPoint.Empty) { num++; continue; } if (common.ProcessModePaint) { bool flag4 = false; if (num7 < axis2.GetViewMinimum() || num7 > axis2.GetViewMaximum() || (num4 < axis.GetViewMinimum() && num6 < axis.GetViewMinimum()) || (num4 > axis.GetViewMaximum() && num6 > axis.GetViewMaximum())) { flag4 = true; } if (!flag4) { int num9 = 0; if (shadow) { num9 = item2.ShadowOffset; } if (!labels) { bool flag5 = false; if (empty.X < area.PlotAreaPosition.X || empty.Right > area.PlotAreaPosition.Right() || empty.Y < area.PlotAreaPosition.Y || empty.Bottom > area.PlotAreaPosition.Bottom()) { graph.SetClip(area.PlotAreaPosition.ToRectangleF()); flag5 = true; } graph.StartHotRegion(dataPoint); graph.StartAnimation(); if (!shadow || num9 != 0) { graph.FillRectangleRel(empty, (!shadow) ? dataPoint.Color : Color.Transparent, dataPoint.BackHatchStyle, dataPoint.BackImage, dataPoint.BackImageMode, dataPoint.BackImageTransparentColor, dataPoint.BackImageAlign, dataPoint.BackGradientType, (!shadow) ? dataPoint.BackGradientEndColor : Color.Transparent, dataPoint.BorderColor, dataPoint.BorderWidth, dataPoint.BorderStyle, item2.ShadowColor, num9, PenAlignment.Inset, (!shadow) ? ChartGraphics.GetBarDrawingStyle(dataPoint) : BarDrawingStyle.Default, isVertical: true); } graph.StopAnimation(); graph.EndHotRegion(); if (flag5) { graph.ResetClip(); } } else { graph.StartAnimation(); DrawLabels(common, graph, area, dataPoint, k, item2, empty); graph.StopAnimation(); } } } if (common.ProcessModeRegions && !shadow && !labels) { common.HotRegionsList.AddHotRegion(graph, empty, dataPoint, item2.Name, k); } if (!selection) { common.EventsManager.OnPaint(item2, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } if (axis.Logarithmic) { num4 = Math.Pow(axis.logarithmBase, num4); } num++; if (GetYValue(common, area, item2, dataPoint, k, 0) >= 0.0) { num2 = num5; } else { num3 = num5; } } } } if (!flag) { return; } for (int m = 0; m < common.DataManager.Series.Count; m++) { Series series6 = common.DataManager.Series[m]; if (string.Compare(series6.ChartTypeName, Name, StringComparison.OrdinalIgnoreCase) == 0 && !(series6.ChartArea != area.Name) && series6.IsVisible()) { string text2 = GetSeriesStackGroupName(series6); int num10 = text2.IndexOf("__", StringComparison.Ordinal); if (num10 >= 0) { text2 = text2.Substring(num10 + 2); } if (text2.Length > 0) { series6["StackedGroupName"] = text2; } else { series6.DeleteAttribute("StackedGroupName"); } } } }
private void ProcessChartType(bool labels, bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { if (area.Area3DStyle.Enable3D) { ProcessChartType3D(labels, selection, graph, common, area, seriesToDraw); return; } SizeF relativeSize = graph.GetRelativeSize(new SizeF(1.1f, 1.1f)); ArrayList seriesFromChartType = area.GetSeriesFromChartType(Name); bool flag = drawSeriesSideBySide; foreach (string item in seriesFromChartType) { if (common.DataManager.Series[item].IsAttributeSet("DrawSideBySide")) { string strA = common.DataManager.Series[item]["DrawSideBySide"]; if (string.Compare(strA, "False", StringComparison.OrdinalIgnoreCase) == 0) { flag = false; } else if (string.Compare(strA, "True", StringComparison.OrdinalIgnoreCase) == 0) { flag = true; } else if (string.Compare(strA, "Auto", StringComparison.OrdinalIgnoreCase) != 0) { throw new InvalidOperationException(SR.ExceptionAttributeDrawSideBySideInvalid); } } } double num = seriesFromChartType.Count; if (!flag) { num = 1.0; } bool flag2 = area.IndexedSeries((string[])area.GetSeriesFromChartType(Name).ToArray(typeof(string))); int num2 = 0; foreach (Series item2 in common.DataManager.Series) { if (string.Compare(item2.ChartTypeName, Name, ignoreCase: true, CultureInfo.CurrentCulture) != 0 || item2.ChartArea != area.Name || item2.Points.Count == 0 || !item2.IsVisible()) { continue; } ShiftedSerName = item2.Name; Axis axis = area.GetAxis(AxisName.Y, item2.YAxisType, item2.YSubAxisName); Axis axis2 = area.GetAxis(AxisName.X, item2.XAxisType, item2.XSubAxisName); double viewMaximum = axis2.GetViewMaximum(); double viewMinimum = axis2.GetViewMinimum(); double viewMaximum2 = axis.GetViewMaximum(); double viewMinimum2 = axis.GetViewMinimum(); double position = axis.GetPosition(axis.Crossing); bool sameInterval = false; double interval = 1.0; if (!flag2) { if (item2.Points.Count == 1 && (item2.XValueType == ChartValueTypes.Date || item2.XValueType == ChartValueTypes.DateTime || item2.XValueType == ChartValueTypes.Time || item2.XValueType == ChartValueTypes.DateTimeOffset)) { area.GetPointsInterval(seriesFromChartType, axis2.Logarithmic, axis2.logarithmBase, checkSameInterval: true, out sameInterval); interval = ((double.IsNaN(axis2.majorGrid.Interval) || axis2.majorGrid.IntervalType == DateTimeIntervalType.NotSet) ? axis2.GetIntervalSize(axis2.minimum, axis2.Interval, axis2.IntervalType) : axis2.GetIntervalSize(axis2.minimum, axis2.majorGrid.Interval, axis2.majorGrid.IntervalType)); } else { interval = area.GetPointsInterval(seriesFromChartType, axis2.Logarithmic, axis2.logarithmBase, checkSameInterval: true, out sameInterval); } } double num3 = item2.GetPointWidth(graph, axis2, interval, 0.8) / num; if (!selection) { common.EventsManager.OnBackPaint(item2, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } int num4 = 0; foreach (DataPoint point in item2.Points) { double num5 = axis.GetLogValue(GetYValue(common, area, item2, point, num4, useTwoValues ? 1 : 0)); if (num5 > viewMaximum2) { num5 = viewMaximum2; } if (num5 < viewMinimum2) { num5 = viewMinimum2; } double num6 = axis.GetLinearPosition(num5); double num7 = 0.0; if (useTwoValues) { double num8 = axis.GetLogValue(GetYValue(common, area, item2, point, num4, 0)); if (num8 > viewMaximum2) { num8 = viewMaximum2; } else if (num8 < viewMinimum2) { num8 = viewMinimum2; } num7 = axis.GetLinearPosition(num8); } else { num7 = position; } num4++; double num9; double position2; if (flag2) { num9 = axis2.GetPosition(num4) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3; position2 = axis2.GetPosition(num4); } else if (sameInterval) { num9 = axis2.GetPosition(point.XValue) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3; position2 = axis2.GetPosition(point.XValue); } else { num9 = axis2.GetPosition(point.XValue); position2 = axis2.GetPosition(point.XValue); } ShiftedX = num9 - position2; if (num6 < num7 && num7 - num6 < (double)relativeSize.Height) { num6 = num7 - (double)relativeSize.Height; } if (num6 > num7 && num6 - num7 < (double)relativeSize.Height) { num6 = num7 + (double)relativeSize.Height; } RectangleF empty = RectangleF.Empty; try { empty.X = (float)(num9 - num3 / 2.0); empty.Width = (float)num3; if (num7 < num6) { empty.Y = (float)num7; empty.Height = (float)num6 - empty.Y; } else { empty.Y = (float)num6; empty.Height = (float)num7 - empty.Y; } } catch (Exception) { continue; } if (point.Empty) { continue; } if (common.ProcessModePaint) { if (!labels) { double yValue = flag2 ? ((double)num4) : point.XValue; yValue = axis2.GetLogValue(yValue); if (yValue < viewMinimum || yValue > viewMaximum) { continue; } bool flag3 = false; if (empty.X < area.PlotAreaPosition.X || empty.Right > area.PlotAreaPosition.Right()) { graph.SetClip(area.PlotAreaPosition.ToRectangleF()); flag3 = true; } graph.StartHotRegion(point); graph.StartAnimation(); DrawColumn2D(graph, axis, empty, point, item2); graph.StopAnimation(); graph.EndHotRegion(); if (flag3) { graph.ResetClip(); } } else if (useTwoValues) { DrawLabel(area, graph, common, empty, point, item2, num4); } } if (common.ProcessModeRegions && !labels) { common.HotRegionsList.AddHotRegion(graph, empty, point, item2.Name, num4 - 1); } } if (!selection) { common.EventsManager.OnPaint(item2, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } if (flag) { num2++; } if (labels && !useTwoValues) { base.ProcessChartType(selection: false, graph, common, area, seriesToDraw); } } }
private void ProcessChartType3D(bool labels, bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { if (labels && !selection) { return; } SizeF relativeSize = graph.GetRelativeSize(new SizeF(1.1f, 1.1f)); ArrayList arrayList = null; bool flag = drawSeriesSideBySide; if ((area.Area3DStyle.Clustered && SideBySideSeries) || Stacked) { arrayList = area.GetSeriesFromChartType(Name); foreach (string item in arrayList) { if (common.DataManager.Series[item].IsAttributeSet("DrawSideBySide")) { string strA = common.DataManager.Series[item]["DrawSideBySide"]; if (string.Compare(strA, "False", StringComparison.OrdinalIgnoreCase) == 0) { flag = false; } else if (string.Compare(strA, "True", StringComparison.OrdinalIgnoreCase) == 0) { flag = true; } else if (string.Compare(strA, "Auto", StringComparison.OrdinalIgnoreCase) != 0) { throw new InvalidOperationException(SR.ExceptionAttributeDrawSideBySideInvalid); } } } } else { arrayList = new ArrayList(); arrayList.Add(seriesToDraw.Name); } foreach (DataPoint3D item2 in area.GetDataPointDrawingOrder(arrayList, this, selection, coordinates, null, yValueIndex, flag)) { DataPoint dataPoint = item2.dataPoint; Series series = dataPoint.series; BarDrawingStyle barDrawingStyle = ChartGraphics.GetBarDrawingStyle(dataPoint); Axis axis = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName); Axis axis2 = area.GetAxis(AxisName.X, series.XAxisType, series.XSubAxisName); float num = 0f; float num2 = 0f; double yValue = GetYValue(common, area, series, item2.dataPoint, item2.index - 1, useTwoValues ? 1 : 0); yValue = axis.GetLogValue(yValue); if (yValue > axis.GetViewMaximum()) { num = 0.5f; yValue = axis.GetViewMaximum(); } if (yValue < axis.GetViewMinimum()) { num = 0.5f; yValue = axis.GetViewMinimum(); } double num3 = axis.GetLinearPosition(yValue); double num4 = 0.0; if (useTwoValues) { double num5 = axis.GetLogValue(GetYValue(common, area, series, dataPoint, item2.index - 1, 0)); if (num5 > axis.GetViewMaximum()) { num2 = 0.5f; num5 = axis.GetViewMaximum(); } else if (num5 < axis.GetViewMinimum()) { num2 = 0.5f; num5 = axis.GetViewMinimum(); } num4 = axis.GetLinearPosition(num5); } else { num4 = axis.GetPosition(axis.Crossing); } if (!flag) { item2.xPosition = item2.xCenterVal; } ShiftedX = item2.xPosition - item2.xCenterVal; if (num3 < num4 && num4 - num3 < (double)relativeSize.Height) { num3 = num4 - (double)relativeSize.Height; } if (num3 > num4 && num3 - num4 < (double)relativeSize.Height) { num3 = num4 + (double)relativeSize.Height; } RectangleF empty = RectangleF.Empty; try { empty.X = (float)(item2.xPosition - item2.width / 2.0); empty.Width = (float)item2.width; if (num4 < num3) { float num6 = num2; num2 = num; num = num6; empty.Y = (float)num4; empty.Height = (float)num3 - empty.Y; } else { empty.Y = (float)num3; empty.Height = (float)num4 - empty.Y; } } catch (Exception) { continue; } GraphicsPath graphicsPath = null; double yValue2 = item2.indexedSeries ? ((double)item2.index) : dataPoint.XValue; yValue2 = axis2.GetLogValue(yValue2); if (yValue2 < axis2.GetViewMinimum() || yValue2 > axis2.GetViewMaximum()) { continue; } bool flag2 = false; if (empty.Right <= area.PlotAreaPosition.X || empty.X >= area.PlotAreaPosition.Right()) { continue; } if (empty.X < area.PlotAreaPosition.X) { empty.Width -= area.PlotAreaPosition.X - empty.X; empty.X = area.PlotAreaPosition.X; } if (empty.Right > area.PlotAreaPosition.Right()) { empty.Width -= empty.Right - area.PlotAreaPosition.Right(); } if (empty.Width < 0f) { empty.Width = 0f; } DrawingOperationTypes drawingOperationTypes = DrawingOperationTypes.DrawElement; if (common.ProcessModeRegions) { drawingOperationTypes |= DrawingOperationTypes.CalcElementPath; } if (!dataPoint.Empty && empty.Height > 0f && empty.Width > 0f) { graph.StartHotRegion(dataPoint); Init3DAnimation(common, empty, item2.zPosition, item2.depth, area.matrix3D, graph, yValue < axis2.Crossing, dataPoint); graph.StartAnimation(); graphicsPath = graph.Fill3DRectangle(empty, item2.zPosition, item2.depth, area.matrix3D, area.Area3DStyle.Light, dataPoint.Color, num, num2, dataPoint.BackHatchStyle, dataPoint.BackImage, dataPoint.BackImageMode, dataPoint.BackImageTransparentColor, dataPoint.BackImageAlign, dataPoint.BackGradientType, dataPoint.BackGradientEndColor, dataPoint.BorderColor, dataPoint.BorderWidth, dataPoint.BorderStyle, PenAlignment.Inset, barDrawingStyle, veticalOrientation: true, drawingOperationTypes); graph.StopAnimation(); graph.EndHotRegion(); if (common.ProcessModeRegions && !labels) { common.HotRegionsList.AddHotRegion(graphicsPath, relativePath: false, graph, dataPoint, series.Name, item2.index - 1); } } if (flag2) { graph.ResetClip(); } ProcessSinglePoint3D(item2, selection, graph, common, area, empty, item2.index - 1); } DrawAccumulated3DLabels(graph, common, area); }
protected override void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { ArrayList arrayList = null; ArrayList arrayList2 = null; if (area.Area3DStyle.Enable3D) { base.ProcessChartType(selection, graph, common, area, seriesToDraw); } else { bool flag = area.IndexedSeries((string[])area.GetSeriesFromChartType(this.Name).ToArray(typeof(string))); bool flag2 = false; bool flag3 = false; int num = -1; PointF absolutePoint; foreach (Series item in common.DataManager.Series) { if (string.Compare(item.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) == 0 && !(item.ChartArea != area.Name) && item.IsVisible()) { if (base.areaPath != null) { base.areaPath.Dispose(); base.areaPath = null; } this.areaBottomPath.Reset(); if (num == -1) { num = item.Points.Count; } else if (num != item.Points.Count) { throw new ArgumentException(SR.ExceptionStackedAreaChartSeriesDataPointsNumberMismatch); } base.hAxis = area.GetAxis(AxisName.X, item.XAxisType, item.XSubAxisName); base.vAxis = area.GetAxis(AxisName.Y, item.YAxisType, item.YSubAxisName); base.hAxisMin = base.hAxis.GetViewMinimum(); base.hAxisMax = base.hAxis.GetViewMaximum(); base.vAxisMin = base.vAxis.GetViewMinimum(); base.vAxisMax = base.vAxis.GetViewMaximum(); base.axisPos.X = (float)base.vAxis.GetPosition(base.vAxis.Crossing); base.axisPos.Y = (float)base.vAxis.GetPosition(base.vAxis.Crossing); base.axisPos = graph.GetAbsolutePoint(base.axisPos); if (arrayList2 == null) { arrayList2 = new ArrayList(item.Points.Count); } else { arrayList = arrayList2; arrayList2 = new ArrayList(item.Points.Count); } if (!selection) { common.EventsManager.OnBackPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } int num2 = 0; float num3 = base.axisPos.Y; float y = base.axisPos.Y; PointF pointF = PointF.Empty; PointF pointF2 = PointF.Empty; foreach (DataPoint point in item.Points) { point.positionRel = new PointF(float.NaN, float.NaN); double num4 = point.Empty ? 0.0 : this.GetYValue(common, area, item, point, num2, 0); double num5 = flag ? ((double)num2 + 1.0) : point.XValue; if (arrayList != null && num2 < arrayList.Count) { num4 += (double)arrayList[num2]; } arrayList2.Insert(num2, num4); float y2 = (float)base.vAxis.GetPosition(num4); float x = (float)base.hAxis.GetPosition(num5); point.positionRel = new PointF(x, y2); num4 = base.vAxis.GetLogValue(num4); num5 = base.hAxis.GetLogValue(num5); if (pointF == PointF.Empty) { pointF.X = x; pointF.Y = y2; if (arrayList != null && num2 < arrayList.Count) { num3 = (float)base.vAxis.GetPosition((double)arrayList[num2]); absolutePoint = graph.GetAbsolutePoint(new PointF(num3, num3)); num3 = absolutePoint.Y; } pointF = graph.GetAbsolutePoint(pointF); num2++; } else { pointF2.X = x; pointF2.Y = y2; if (arrayList != null && num2 < arrayList.Count) { y = (float)base.vAxis.GetPosition((double)arrayList[num2]); absolutePoint = graph.GetAbsolutePoint(new PointF(y, y)); y = absolutePoint.Y; } pointF2 = graph.GetAbsolutePoint(pointF2); pointF.X = (float)Math.Round((double)pointF.X); pointF2.X = (float)Math.Round((double)pointF2.X); GraphicsPath graphicsPath = new GraphicsPath(); graphicsPath.AddLine(pointF.X, pointF.Y, pointF2.X, pointF2.Y); graphicsPath.AddLine(pointF2.X, pointF2.Y, pointF2.X, y); graphicsPath.AddLine(pointF2.X, y, pointF.X, num3); graphicsPath.AddLine(pointF.X, num3, pointF.X, pointF.Y); if (common.ProcessModePaint) { if (!point.Empty) { this.GetYValue(common, area, item, item.Points[num2 - 1], num2 - 1, 0); } double num6 = flag ? ((double)num2) : item.Points[num2 - 1].XValue; if (num5 <= base.hAxisMin && num6 <= base.hAxisMin) { goto IL_053b; } if (num5 >= base.hAxisMax && num6 >= base.hAxisMax) { goto IL_053b; } Brush brush = null; if (point.BackHatchStyle != 0) { brush = graph.GetHatchBrush(point.BackHatchStyle, point.Color, point.BackGradientEndColor); } else if (point.BackGradientType != 0) { base.gradientFill = true; base.series = point.series; } else { brush = ((point.BackImage.Length <= 0 || point.BackImageMode == ChartImageWrapMode.Unscaled || point.BackImageMode == ChartImageWrapMode.Scaled) ? ((!point.Empty || !(point.Color == Color.Empty)) ? new SolidBrush(point.Color) : new SolidBrush(item.Color)) : graph.GetTextureBrush(point.BackImage, point.BackImageTransparentColor, point.BackImageMode, point.Color)); } if (point.BorderColor != Color.Empty && point.BorderWidth > 0) { flag2 = true; } if (point.Label.Length > 0 || point.ShowLabelAsValue) { flag3 = true; } if (!base.gradientFill) { graph.StartAnimation(); graph.StartHotRegion(point); SmoothingMode smoothingMode = graph.SmoothingMode; graph.SmoothingMode = SmoothingMode.None; graph.FillPath(brush, graphicsPath); graph.SmoothingMode = smoothingMode; Pen pen = new Pen(brush, 1f); if (pointF.X != pointF2.X && pointF.Y != pointF2.Y) { graph.DrawLine(pen, pointF.X, pointF.Y, pointF2.X, pointF2.Y); } if (pointF.X != pointF2.X && y != num3) { graph.DrawLine(pen, pointF2.X, y, pointF.X, num3); } graph.EndHotRegion(); graph.StopAnimation(); } if (base.areaPath == null) { base.areaPath = new GraphicsPath(); } base.areaPath.AddLine(pointF.X, pointF.Y, pointF2.X, pointF2.Y); this.areaBottomPath.AddLine(pointF.X, num3, pointF2.X, y); } if (common.ProcessModeRegions) { PointF pointF3 = PointF.Empty; float[] array = new float[graphicsPath.PointCount * 2]; PointF[] pathPoints = graphicsPath.PathPoints; for (int i = 0; i < graphicsPath.PointCount; i++) { pointF3 = graph.GetRelativePoint(pathPoints[i]); array[2 * i] = pointF3.X; array[2 * i + 1] = pointF3.Y; } common.HotRegionsList.AddHotRegion(graph, graphicsPath, false, array, point, item.Name, num2); if (point.BorderWidth > 1 && point.BorderStyle != 0 && point.BorderColor != Color.Empty) { GraphicsPath graphicsPath2 = new GraphicsPath(); graphicsPath2.AddLine(pointF.X, pointF.Y, pointF2.X, pointF2.Y); ChartGraphics.Widen(graphicsPath2, new Pen(point.Color, (float)(point.BorderWidth + 2))); pointF3 = PointF.Empty; array = new float[graphicsPath2.PointCount * 2]; for (int j = 0; j < graphicsPath2.PointCount; j++) { pointF3 = graph.GetRelativePoint(graphicsPath2.PathPoints[j]); array[2 * j] = pointF3.X; array[2 * j + 1] = pointF3.Y; } common.HotRegionsList.AddHotRegion(graph, graphicsPath2, false, array, point, item.Name, num2); } } pointF = pointF2; num3 = y; num2++; } continue; IL_053b: pointF = pointF2; num3 = y; num2++; } if (base.gradientFill && base.areaPath != null) { GraphicsPath graphicsPath3 = new GraphicsPath(); graphicsPath3.AddPath(base.areaPath, true); this.areaBottomPath.Reverse(); graphicsPath3.AddPath(this.areaBottomPath, true); Brush gradientBrush = graph.GetGradientBrush(graphicsPath3.GetBounds(), base.series.Color, base.series.BackGradientEndColor, base.series.BackGradientType); graph.FillPath(gradientBrush, graphicsPath3); base.areaPath.Dispose(); base.areaPath = null; base.gradientFill = false; } this.areaBottomPath.Reset(); if (!selection) { common.EventsManager.OnPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } } } if (flag2) { arrayList = null; arrayList2 = null; foreach (Series item2 in common.DataManager.Series) { if (string.Compare(item2.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) == 0 && !(item2.ChartArea != area.Name) && item2.IsVisible()) { base.hAxis = area.GetAxis(AxisName.X, item2.XAxisType, item2.XSubAxisName); base.vAxis = area.GetAxis(AxisName.Y, item2.YAxisType, item2.YSubAxisName); base.axisPos.X = (float)base.vAxis.GetPosition(base.vAxis.Crossing); base.axisPos.Y = (float)base.vAxis.GetPosition(base.vAxis.Crossing); base.axisPos = graph.GetAbsolutePoint(base.axisPos); if (arrayList2 == null) { arrayList2 = new ArrayList(item2.Points.Count); } else { arrayList = arrayList2; arrayList2 = new ArrayList(item2.Points.Count); } int num7 = 0; float num8 = base.axisPos.Y; float num9 = base.axisPos.Y; PointF pointF4 = PointF.Empty; PointF pointF5 = PointF.Empty; foreach (DataPoint point2 in item2.Points) { double num10 = point2.Empty ? 0.0 : this.GetYValue(common, area, item2, point2, num7, 0); double axisValue = flag ? ((double)num7 + 1.0) : point2.XValue; if (arrayList != null && num7 < arrayList.Count) { num10 += (double)arrayList[num7]; } arrayList2.Insert(num7, num10); float y3 = (float)base.vAxis.GetPosition(num10); float x2 = (float)base.hAxis.GetPosition(axisValue); if (pointF4 == PointF.Empty) { pointF4.X = x2; pointF4.Y = y3; if (arrayList != null && num7 < arrayList.Count) { num8 = (float)base.vAxis.GetPosition((double)arrayList[num7]); absolutePoint = graph.GetAbsolutePoint(new PointF(num8, num8)); num8 = absolutePoint.Y; } pointF4 = graph.GetAbsolutePoint(pointF4); pointF5 = pointF4; num9 = num8; } else { pointF5.X = x2; pointF5.Y = y3; if (arrayList != null && num7 < arrayList.Count) { num9 = (float)base.vAxis.GetPosition((double)arrayList[num7]); absolutePoint = graph.GetAbsolutePoint(new PointF(num9, num9)); num9 = absolutePoint.Y; } pointF5 = graph.GetAbsolutePoint(pointF5); } if (num7 != 0) { pointF4.X = (float)Math.Round((double)pointF4.X); pointF5.X = (float)Math.Round((double)pointF5.X); graph.StartAnimation(); graph.DrawLineRel(point2.BorderColor, point2.BorderWidth, point2.BorderStyle, graph.GetRelativePoint(pointF4), graph.GetRelativePoint(pointF5), point2.series.ShadowColor, point2.series.ShadowOffset); graph.StopAnimation(); } pointF4 = pointF5; num8 = num9; num7++; } } } } if (flag3) { arrayList = null; arrayList2 = null; foreach (Series item3 in common.DataManager.Series) { if (string.Compare(item3.ChartTypeName, this.Name, StringComparison.OrdinalIgnoreCase) == 0 && !(item3.ChartArea != area.Name) && item3.IsVisible()) { base.hAxis = area.GetAxis(AxisName.X, item3.XAxisType, item3.XSubAxisName); base.vAxis = area.GetAxis(AxisName.Y, item3.YAxisType, item3.YSubAxisName); base.axisPos.X = (float)base.vAxis.GetPosition(base.vAxis.Crossing); base.axisPos.Y = (float)base.vAxis.GetPosition(base.vAxis.Crossing); base.axisPos = graph.GetAbsolutePoint(base.axisPos); if (arrayList2 == null) { arrayList2 = new ArrayList(item3.Points.Count); } else { arrayList = arrayList2; arrayList2 = new ArrayList(item3.Points.Count); } int num11 = 0; float num12 = base.axisPos.Y; float num13 = base.axisPos.Y; PointF pointF6 = PointF.Empty; PointF pointF7 = PointF.Empty; foreach (DataPoint point3 in item3.Points) { double num14 = point3.Empty ? 0.0 : this.GetYValue(common, area, item3, point3, num11, 0); double axisValue2 = flag ? ((double)num11 + 1.0) : point3.XValue; if (arrayList != null && num11 < arrayList.Count) { num14 += (double)arrayList[num11]; } arrayList2.Insert(num11, num14); float y4 = (float)base.vAxis.GetPosition(num14); float x3 = (float)base.hAxis.GetPosition(axisValue2); if (pointF6 == PointF.Empty) { pointF6.X = x3; pointF6.Y = y4; if (arrayList != null && num11 < arrayList.Count) { num12 = (float)base.vAxis.GetPosition((double)arrayList[num11]); absolutePoint = graph.GetAbsolutePoint(new PointF(num12, num12)); num12 = absolutePoint.Y; } pointF6 = graph.GetAbsolutePoint(pointF6); pointF7 = pointF6; num13 = num12; } else { pointF7.X = x3; pointF7.Y = y4; if (arrayList != null && num11 < arrayList.Count) { num13 = (float)base.vAxis.GetPosition((double)arrayList[num11]); absolutePoint = graph.GetAbsolutePoint(new PointF(num13, num13)); num13 = absolutePoint.Y; } pointF7 = graph.GetAbsolutePoint(pointF7); } if (!point3.Empty && (item3.ShowLabelAsValue || point3.ShowLabelAsValue || point3.Label.Length > 0)) { StringFormat stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; string text; if (point3.Label.Length == 0) { double value = this.GetYValue(common, area, item3, point3, num11, 0); if (this.hundredPercentStacked && point3.LabelFormat.Length == 0) { value = Math.Round(value, 2); } text = ValueConverter.FormatValue(item3.chart, point3, value, point3.LabelFormat, item3.YValueType, ChartElementType.DataPoint); } else { text = point3.ReplaceKeywords(point3.Label); if (item3.chart != null && item3.chart.LocalizeTextHandler != null) { text = item3.chart.LocalizeTextHandler(point3, text, point3.ElementId, ChartElementType.DataPoint); } } Region clip = graph.Clip; graph.Clip = new Region(); graph.StartAnimation(); PointF pointF8 = PointF.Empty; pointF8.X = pointF7.X; pointF8.Y = (float)(pointF7.Y - (pointF7.Y - num13) / 2.0); pointF8 = graph.GetRelativePoint(pointF8); SizeF relativeSize = graph.GetRelativeSize(graph.MeasureString(text, point3.Font, new SizeF(1000f, 1000f), new StringFormat(StringFormat.GenericTypographic))); RectangleF empty = RectangleF.Empty; SizeF sizeF = new SizeF(relativeSize.Width, relativeSize.Height); sizeF.Height += (float)(relativeSize.Height / 8.0); sizeF.Width += sizeF.Width / (float)text.Length; empty = new RectangleF((float)(pointF8.X - sizeF.Width / 2.0), (float)(pointF8.Y - sizeF.Height / 2.0 - relativeSize.Height / 10.0), sizeF.Width, sizeF.Height); graph.DrawPointLabelStringRel(common, text, point3.Font, new SolidBrush(point3.FontColor), pointF8, stringFormat, point3.FontAngle, empty, point3.LabelBackColor, point3.LabelBorderColor, point3.LabelBorderWidth, point3.LabelBorderStyle, item3, point3, num11); graph.StopAnimation(); graph.Clip = clip; } pointF6 = pointF7; num12 = num13; num11++; } } } } } }
public void AddSmartLabelMarkerPositions(CommonElements common, ChartArea area, Series series, ArrayList list) { bool flag = area.IndexedSeries((string[])area.GetSeriesFromChartType(Name).ToArray(typeof(string))); Axis axis = area.GetAxis(AxisName.X, series.XAxisType, series.XSubAxisName); Axis axis2 = area.GetAxis(AxisName.Y, series.YAxisType, series.YSubAxisName); int num = 0; int num2 = 1; foreach (DataPoint point in series.Points) { double yValue = GetYValue(common, area, series, point, num2 - 1, 0); yValue = axis2.GetLogValue(yValue); if (yValue > axis2.GetViewMaximum() || yValue < axis2.GetViewMinimum()) { num2++; continue; } double yValue2 = flag ? ((double)num2) : point.XValue; yValue2 = axis.GetLogValue(yValue2); if (yValue2 > axis.GetViewMaximum() || yValue2 < axis.GetViewMinimum()) { num2++; continue; } PointF pointF = PointF.Empty; pointF.Y = (float)axis2.GetLinearPosition(yValue); if (flag) { pointF.X = (float)axis.GetPosition(num2); } else { pointF.X = (float)axis.GetPosition(point.XValue); } _ = point.MarkerSize; string markerImage = point.MarkerImage; MarkerStyle markerStyle = point.MarkerStyle; SizeF size = SizeF.Empty; size.Width = point.MarkerSize; size.Height = point.MarkerSize; if (point.MarkerImage.Length > 0 && common.graph != null) { common.ImageLoader.GetAdjustedImageSize(point.MarkerImage, common.graph.Graphics, ref size); } if (area.Area3DStyle.Enable3D) { area.GetSeriesZPositionAndDepth(series, out float depth, out float positionZ); Point3D[] array = new Point3D[1] { new Point3D(pointF.X, pointF.Y, positionZ + depth / 2f) }; area.matrix3D.TransformPoints(array); pointF = array[0].PointF; } if (markerStyle != 0 || markerImage.Length > 0) { if (num == 0) { size = common.graph.GetRelativeSize(size); RectangleF rectangleF = new RectangleF(pointF.X - size.Width / 2f, pointF.Y - size.Height, size.Width, size.Height); list.Add(rectangleF); } num++; if (series.MarkerStep == num) { num = 0; } } num2++; } }
protected virtual void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { if (area.Area3DStyle.Enable3D) { ProcessChartType3D(selection, graph, common, area, seriesToDraw); return; } ArrayList seriesFromChartType = area.GetSeriesFromChartType(Name); bool flag = area.IndexedSeries((string[])seriesFromChartType.ToArray(typeof(string))); foreach (Series item in common.DataManager.Series) { if (string.Compare(item.ChartTypeName, Name, StringComparison.OrdinalIgnoreCase) != 0 || item.ChartArea != area.Name || !item.IsVisible()) { continue; } if (item.YValuesPerPoint < 4) { throw new ArgumentException(SR.ExceptionChartTypeRequiresYValues("StockChart", "4")); } hAxis = area.GetAxis(AxisName.X, item.XAxisType, item.XSubAxisName); vAxis = area.GetAxis(AxisName.Y, item.YAxisType, item.YSubAxisName); double interval = flag ? 1.0 : area.GetPointsInterval(hAxis.Logarithmic, hAxis.logarithmBase); float num = (float)item.GetPointWidth(graph, hAxis, interval, 0.8); if (!selection) { common.EventsManager.OnBackPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } int num2 = 1; foreach (DataPoint point in item.Points) { point.positionRel = new PointF(float.NaN, float.NaN); double num3 = point.XValue; if (flag) { num3 = num2; } float num4 = (float)hAxis.GetPosition(num3); double logValue = vAxis.GetLogValue(point.YValues[0]); double logValue2 = vAxis.GetLogValue(point.YValues[1]); num3 = hAxis.GetLogValue(num3); if (num3 < hAxis.GetViewMinimum() || num3 > hAxis.GetViewMaximum() || (logValue < vAxis.GetViewMinimum() && logValue2 < vAxis.GetViewMinimum()) || (logValue > vAxis.GetViewMaximum() && logValue2 > vAxis.GetViewMaximum())) { num2++; continue; } double num5 = vAxis.GetLogValue(point.YValues[0]); double num6 = vAxis.GetLogValue(point.YValues[1]); if (num5 > vAxis.GetViewMaximum()) { num5 = vAxis.GetViewMaximum(); } if (num5 < vAxis.GetViewMinimum()) { num5 = vAxis.GetViewMinimum(); } num5 = (float)vAxis.GetLinearPosition(num5); if (num6 > vAxis.GetViewMaximum()) { num6 = vAxis.GetViewMaximum(); } if (num6 < vAxis.GetViewMinimum()) { num6 = vAxis.GetViewMinimum(); } num6 = vAxis.GetLinearPosition(num6); point.positionRel = new PointF(num4, (float)num5); if (common.ProcessModePaint) { bool flag2 = false; if (num3 == hAxis.GetViewMinimum() || num3 == hAxis.GetViewMaximum()) { graph.SetClip(area.PlotAreaPosition.ToRectangleF()); flag2 = true; } graph.StartHotRegion(point); graph.StartAnimation(); graph.DrawLineRel(point.Color, point.BorderWidth, point.BorderStyle, new PointF(num4, (float)num5), new PointF(num4, (float)num6), item.ShadowColor, item.ShadowOffset); DrawOpenCloseMarks(graph, area, item, point, num4, num); graph.StopAnimation(); graph.EndHotRegion(); if (flag2) { graph.ResetClip(); } } if (common.ProcessModeRegions) { RectangleF empty = RectangleF.Empty; empty.X = num4 - num / 2f; empty.Y = (float)Math.Min(num5, num6); empty.Width = num; empty.Height = (float)Math.Max(num5, num6) - empty.Y; common.HotRegionsList.AddHotRegion(graph, empty, point, item.Name, num2 - 1); } num2++; } int num7 = 0; num2 = 1; foreach (DataPoint point2 in item.Points) { double num8 = point2.XValue; if (flag) { num8 = num2; } float x = (float)hAxis.GetPosition(num8); double logValue3 = vAxis.GetLogValue(point2.YValues[0]); double logValue4 = vAxis.GetLogValue(point2.YValues[1]); num8 = hAxis.GetLogValue(num8); if (num8 < hAxis.GetViewMinimum() || num8 > hAxis.GetViewMaximum() || (logValue3 < vAxis.GetViewMinimum() && logValue4 < vAxis.GetViewMinimum()) || (logValue3 > vAxis.GetViewMaximum() && logValue4 > vAxis.GetViewMaximum())) { num2++; continue; } double num9 = vAxis.GetLogValue(point2.YValues[0]); double num10 = vAxis.GetLogValue(point2.YValues[1]); if (num9 > vAxis.GetViewMaximum()) { num9 = vAxis.GetViewMaximum(); } if (num9 < vAxis.GetViewMinimum()) { num9 = vAxis.GetViewMinimum(); } num9 = (float)vAxis.GetLinearPosition(num9); if (num10 > vAxis.GetViewMaximum()) { num10 = vAxis.GetViewMaximum(); } if (num10 < vAxis.GetViewMinimum()) { num10 = vAxis.GetViewMinimum(); } num10 = vAxis.GetLinearPosition(num10); if (point2.MarkerStyle != 0 || point2.MarkerImage.Length > 0) { SizeF size = SizeF.Empty; size.Width = point2.MarkerSize; size.Height = point2.MarkerSize; if (point2.MarkerImage.Length > 0) { common.ImageLoader.GetAdjustedImageSize(point2.MarkerImage, graph.Graphics, ref size); } PointF empty2 = PointF.Empty; empty2.X = x; empty2.Y = (float)num9 - graph.GetRelativeSize(size).Height / 2f; if (num7 == 0) { graph.StartAnimation(); graph.DrawMarkerRel(empty2, point2.MarkerStyle, (int)size.Height, (point2.MarkerColor == Color.Empty) ? point2.Color : point2.MarkerColor, (point2.MarkerBorderColor == Color.Empty) ? point2.BorderColor : point2.MarkerBorderColor, point2.MarkerBorderWidth, point2.MarkerImage, point2.MarkerImageTransparentColor, (point2.series != null) ? point2.series.ShadowOffset : 0, (point2.series != null) ? point2.series.ShadowColor : Color.Empty, new RectangleF(empty2.X, empty2.Y, size.Width, size.Height)); graph.StopAnimation(); if (common.ProcessModeRegions) { SizeF relativeSize = graph.GetRelativeSize(size); int insertIndex = common.HotRegionsList.FindInsertIndex(); common.HotRegionsList.FindInsertIndex(); if (point2.MarkerStyle == MarkerStyle.Circle) { float[] array = new float[3] { empty2.X, empty2.Y, relativeSize.Width / 2f }; common.HotRegionsList.AddHotRegion(insertIndex, graph, array[0], array[1], array[2], point2, item.Name, num2 - 1); } else { common.HotRegionsList.AddHotRegion(graph, new RectangleF(empty2.X - relativeSize.Width / 2f, empty2.Y - relativeSize.Height / 2f, relativeSize.Width, relativeSize.Height), point2, item.Name, num2 - 1); } } } num7++; if (item.MarkerStep == num7) { num7 = 0; } } graph.StartAnimation(); DrawLabel(common, area, graph, item, point2, new PointF(x, (float)Math.Min(num9, num10)), num2); graph.StopAnimation(); num2++; } if (!selection) { common.EventsManager.OnPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } } }
protected virtual void ProcessChartType(bool selection, ChartGraphics graph, CommonElements common, ChartArea area, Series seriesToDraw) { if (area.Area3DStyle.Enable3D) { ProcessChartType3D(selection, graph, common, area, seriesToDraw); return; } ArrayList seriesFromChartType = area.GetSeriesFromChartType(Name); bool flag = area.IndexedSeries((string[])seriesFromChartType.ToArray(typeof(string))); int num = 0; foreach (Series item in common.DataManager.Series) { if (string.Compare(item.ChartTypeName, Name, StringComparison.OrdinalIgnoreCase) != 0 || item.ChartArea != area.Name || !item.IsVisible()) { continue; } hAxis = area.GetAxis(AxisName.X, item.XAxisType, item.XSubAxisName); vAxis = area.GetAxis(AxisName.Y, item.YAxisType, item.YSubAxisName); double interval = flag ? 1.0 : area.GetPointsInterval(hAxis.Logarithmic, hAxis.logarithmBase); bool flag2 = showSideBySide; if (item.IsAttributeSet("DrawSideBySide")) { string strA = item["DrawSideBySide"]; if (string.Compare(strA, "False", StringComparison.OrdinalIgnoreCase) == 0) { flag2 = false; } else if (string.Compare(strA, "True", StringComparison.OrdinalIgnoreCase) == 0) { flag2 = true; } else if (string.Compare(strA, "Auto", StringComparison.OrdinalIgnoreCase) != 0) { throw new InvalidOperationException(SR.ExceptionAttributeDrawSideBySideInvalid); } } double num2 = seriesFromChartType.Count; if (!flag2) { num2 = 1.0; } float num3 = (float)(item.GetPointWidth(graph, hAxis, interval, 0.8) / num2); if (!selection) { common.EventsManager.OnBackPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } int num4 = 1; foreach (DataPoint point in item.Points) { if (point.YValues.Length < YValuesPerPoint) { throw new InvalidOperationException(SR.ExceptionChartTypeRequiresYValues(Name, YValuesPerPoint.ToString(CultureInfo.InvariantCulture))); } point.positionRel = new PointF(float.NaN, float.NaN); float num5 = 0f; double num6 = point.XValue; if (!flag) { num5 = ((!flag2) ? ((float)hAxis.GetPosition(num6)) : ((float)(hAxis.GetPosition(num6) - (double)num3 * num2 / 2.0 + (double)(num3 / 2f) + (double)((float)num * num3)))); } else { num6 = num4; num5 = (float)(hAxis.GetPosition(num4) - (double)num3 * num2 / 2.0 + (double)(num3 / 2f) + (double)((float)num * num3)); } double logValue = vAxis.GetLogValue(point.YValues[0]); double logValue2 = vAxis.GetLogValue(point.YValues[1]); num6 = hAxis.GetLogValue(num6); if (num6 < hAxis.GetViewMinimum() || num6 > hAxis.GetViewMaximum() || (logValue < vAxis.GetViewMinimum() && logValue2 < vAxis.GetViewMinimum()) || (logValue > vAxis.GetViewMaximum() && logValue2 > vAxis.GetViewMaximum())) { num4++; continue; } double num7 = vAxis.GetLogValue(point.YValues[0]); double num8 = vAxis.GetLogValue(point.YValues[1]); if (num8 > vAxis.GetViewMaximum()) { num8 = vAxis.GetViewMaximum(); } if (num8 < vAxis.GetViewMinimum()) { num8 = vAxis.GetViewMinimum(); } num8 = (float)vAxis.GetLinearPosition(num8); if (num7 > vAxis.GetViewMaximum()) { num7 = vAxis.GetViewMaximum(); } if (num7 < vAxis.GetViewMinimum()) { num7 = vAxis.GetViewMinimum(); } num7 = vAxis.GetLinearPosition(num7); point.positionRel = new PointF(num5, (float)Math.Min(num8, num7)); if (common.ProcessModePaint) { bool flag3 = false; if (num6 == hAxis.GetViewMinimum() || num6 == hAxis.GetViewMaximum()) { graph.SetClip(area.PlotAreaPosition.ToRectangleF()); flag3 = true; } Color color = point.BorderColor; if (color == Color.Empty) { color = point.Color; } graph.StartHotRegion(point); graph.StartAnimation(); graph.DrawLineRel(color, point.BorderWidth, point.BorderStyle, new PointF(num5, (float)num7), new PointF(num5, (float)vAxis.GetPosition(point.YValues[2])), item.ShadowColor, item.ShadowOffset); graph.DrawLineRel(color, point.BorderWidth, point.BorderStyle, new PointF(num5, (float)num8), new PointF(num5, (float)vAxis.GetPosition(point.YValues[3])), item.ShadowColor, item.ShadowOffset); RectangleF empty = RectangleF.Empty; empty.X = num5 - num3 / 2f; empty.Width = num3; empty.Y = (float)vAxis.GetPosition(point.YValues[3]); empty.Height = (float)Math.Abs((double)empty.Y - vAxis.GetPosition(point.YValues[2])); graph.FillRectangleRel(empty, point.Color, point.BackHatchStyle, point.BackImage, point.BackImageMode, point.BackImageTransparentColor, point.BackImageAlign, point.BackGradientType, point.BackGradientEndColor, point.BorderColor, point.BorderWidth, point.BorderStyle, item.ShadowColor, item.ShadowOffset, PenAlignment.Inset); bool flag4 = true; if (point.IsAttributeSet("BoxPlotShowAverage") || item.IsAttributeSet("BoxPlotShowAverage")) { string strA2 = item["BoxPlotShowAverage"]; if (point.IsAttributeSet("BoxPlotShowAverage")) { strA2 = point["BoxPlotShowAverage"]; } if (string.Compare(strA2, "True", StringComparison.OrdinalIgnoreCase) != 0) { if (string.Compare(strA2, "False", StringComparison.OrdinalIgnoreCase) != 0) { throw new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(point["BoxPlotShowAverage"], "BoxPlotShowAverage")); } flag4 = false; } } SizeF relativeSize = graph.GetRelativeSize(new SizeF(point.BorderWidth, point.BorderWidth)); if (point.BorderColor == Color.Empty) { relativeSize.Height = 0f; relativeSize.Width = 0f; } Color color2 = color; if (color2 == point.Color) { color2 = ((!(Math.Sqrt(point.Color.R * point.Color.R + point.Color.G * point.Color.G + point.Color.B * point.Color.B) > 220.0)) ? ChartGraphics.GetGradientColor(point.Color, Color.White, 0.4) : ChartGraphics.GetGradientColor(point.Color, Color.Black, 0.4)); } if (!double.IsNaN(point.YValues[4]) && flag4) { graph.DrawLineRel(color2, 1, ChartDashStyle.Solid, new PointF(empty.Left + relativeSize.Width, (float)vAxis.GetPosition(point.YValues[4])), new PointF(empty.Right - relativeSize.Width, (float)vAxis.GetPosition(point.YValues[4])), Color.Empty, 0); } bool flag5 = true; if (point.IsAttributeSet("BoxPlotShowMedian") || item.IsAttributeSet("BoxPlotShowMedian")) { string strA3 = item["BoxPlotShowMedian"]; if (point.IsAttributeSet("BoxPlotShowMedian")) { strA3 = point["BoxPlotShowMedian"]; } if (string.Compare(strA3, "True", StringComparison.OrdinalIgnoreCase) != 0) { if (string.Compare(strA3, "False", StringComparison.OrdinalIgnoreCase) != 0) { throw new InvalidOperationException(SR.ExceptionCustomAttributeValueInvalid(point["BoxPlotShowMedian"], "BoxPlotShowMedian")); } flag5 = false; } } if (!double.IsNaN(point.YValues[5]) && flag5) { float y = (float)vAxis.GetPosition(point.YValues[5]); float val = (empty.Width - relativeSize.Width * 2f) / 9f; val = Math.Max(val, graph.GetRelativeSize(new SizeF(2f, 2f)).Width); for (float num9 = empty.Left + relativeSize.Width; num9 < empty.Right - relativeSize.Width; num9 += val * 2f) { graph.DrawLineRel(color2, 1, ChartDashStyle.Solid, new PointF(num9, y), new PointF(Math.Min(empty.Right, num9 + val), y), Color.Empty, 0); } } DrawBoxPlotMarks(graph, area, item, point, num5, num3); graph.StopAnimation(); graph.EndHotRegion(); if (flag3) { graph.ResetClip(); } } if (common.ProcessModeRegions) { RectangleF empty2 = RectangleF.Empty; empty2.X = num5 - num3 / 2f; empty2.Y = (float)Math.Min(num8, num7); empty2.Width = num3; empty2.Height = (float)Math.Max(num8, num7) - empty2.Y; common.HotRegionsList.AddHotRegion(graph, empty2, point, item.Name, num4 - 1); } num4++; } if (!selection) { num4 = 1; foreach (DataPoint point2 in item.Points) { float num10 = 0f; double num11 = point2.XValue; if (!flag) { num10 = ((!flag2) ? ((float)hAxis.GetPosition(num11)) : ((float)(hAxis.GetPosition(num11) - (double)num3 * num2 / 2.0 + (double)(num3 / 2f) + (double)((float)num * num3)))); } else { num11 = num4; num10 = (float)(hAxis.GetPosition(num4) - (double)num3 * num2 / 2.0 + (double)(num3 / 2f) + (double)((float)num * num3)); } double logValue3 = vAxis.GetLogValue(point2.YValues[0]); double logValue4 = vAxis.GetLogValue(point2.YValues[1]); num11 = hAxis.GetLogValue(num11); if (num11 < hAxis.GetViewMinimum() || num11 > hAxis.GetViewMaximum() || (logValue3 < vAxis.GetViewMinimum() && logValue4 < vAxis.GetViewMinimum()) || (logValue3 > vAxis.GetViewMaximum() && logValue4 > vAxis.GetViewMaximum())) { num4++; continue; } double num12 = double.MaxValue; for (int i = 0; i < point2.YValues.Length; i++) { if (!double.IsNaN(point2.YValues[i])) { double num13 = vAxis.GetLogValue(point2.YValues[i]); if (num13 > vAxis.GetViewMaximum()) { num13 = vAxis.GetViewMaximum(); } if (num13 < vAxis.GetViewMinimum()) { num13 = vAxis.GetViewMinimum(); } num13 = (float)vAxis.GetLinearPosition(num13); num12 = Math.Min(num12, num13); } } num12 -= (double)(graph.GetRelativeSize(new SizeF(point2.MarkerSize, point2.MarkerSize)).Height / 2f); graph.StartHotRegion(point2, labelRegion: true); graph.StartAnimation(); DrawLabel(common, area, graph, item, point2, new PointF(num10, (float)num12), num4); graph.StopAnimation(); graph.EndHotRegion(); num4++; } } if (!selection) { common.EventsManager.OnPaint(item, new ChartPaintEventArgs(graph, common, area.PlotAreaPosition)); } if (flag2) { num++; } } }