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); } } }
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)); } } }
internal ArrayList GetDataPointDrawingOrder(ArrayList seriesNamesList, IChartType chartType, bool selection, COPCoordinates coord, IComparer comparer, int mainYValueIndex, bool sideBySide) { ChartArea chartArea = (ChartArea)this; ArrayList arrayList = new ArrayList(); double num = 1.0; if (chartArea.Area3DStyle.Clustered && !chartType.Stacked && sideBySide) { num = seriesNamesList.Count; } if (chartType.SupportStackedGroups) { int numberOfStackGroups = GetNumberOfStackGroups(seriesNamesList); if (Area3DStyle.Clustered && seriesNamesList.Count > 0) { num = numberOfStackGroups; } } bool flag = chartArea.IndexedSeries((string[])seriesNamesList.ToArray(typeof(string))); int num2 = 0; foreach (object seriesNames in seriesNamesList) { Series series = base.Common.DataManager.Series[(string)seriesNames]; if (chartType.SupportStackedGroups && stackGroupNames != null) { string stackGroupName = string.Empty; num2 = GetSeriesStackGroupIndex(series, ref stackGroupName); if (chartType is StackedColumnChart) { ((StackedColumnChart)chartType).currentStackGroup = stackGroupName; } else if (chartType is StackedBarChart) { ((StackedBarChart)chartType).currentStackGroup = stackGroupName; } } Axis axis = (series.YAxisType == AxisType.Primary) ? chartArea.AxisY : chartArea.AxisY2; Axis axis2 = (series.XAxisType == AxisType.Primary) ? chartArea.AxisX : chartArea.AxisX2; axis2.GetViewMinimum(); axis2.GetViewMaximum(); axis.GetViewMinimum(); axis.GetViewMaximum(); bool sameInterval = true; double interval = 1.0; if (!flag) { interval = chartArea.GetPointsInterval(seriesNamesList, axis2.Logarithmic, axis2.logarithmBase, checkSameInterval: true, out sameInterval); } double num3 = series.GetPointWidth(chartArea.Common.graph, axis2, interval, 0.8) / num; GetSeriesZPositionAndDepth(series, out float depth, out float positionZ); int num4 = 0; foreach (DataPoint point in series.Points) { num4++; double xPosition; double position; if (flag) { xPosition = axis2.GetPosition(num4) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3; position = axis2.GetPosition(num4); } else if (sameInterval) { xPosition = axis2.GetPosition(point.XValue) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3; position = axis2.GetPosition(point.XValue); } else { xPosition = axis2.GetPosition(point.XValue); position = axis2.GetPosition(point.XValue); } DataPoint3D dataPoint3D = new DataPoint3D(); dataPoint3D.indexedSeries = flag; dataPoint3D.dataPoint = point; dataPoint3D.index = num4; dataPoint3D.xPosition = xPosition; dataPoint3D.xCenterVal = position; dataPoint3D.width = series.GetPointWidth(chartArea.Common.graph, axis2, interval, 0.8) / num; dataPoint3D.depth = depth; dataPoint3D.zPosition = positionZ; double yValue = chartType.GetYValue(base.Common, chartArea, series, point, num4 - 1, mainYValueIndex); dataPoint3D.yPosition = axis.GetPosition(yValue); dataPoint3D.height = axis.GetPosition(yValue - chartType.GetYValue(base.Common, chartArea, series, point, num4 - 1, -1)); arrayList.Add(dataPoint3D); } if (num > 1.0 && sideBySide) { num2++; } } if (comparer == null) { comparer = new PointsDrawingOrderComparer((ChartArea)this, selection, coord); } arrayList.Sort(comparer); return(arrayList); }
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++; } } }