/// <summary> /// Gets maximum Unsigned stacked Y value from many series ( Stacked Area chart ) /// </summary> /// <param name="valueIndex">Index of Y value to use</param> /// <param name="series">Series IDs</param> /// <returns>Maximum stacked Y value</returns> public double GetMaxUnsignedStackedYValue(int valueIndex, params string[] series) { double returnValue = 0; double maxValue = Double.MinValue; double numberOfPoints = GetNumberOfPoints(series); for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++) { double stackedMax = 0; double noStackedMax = 0; foreach (string seriesName in series) { if (_series[seriesName].Points.Count > pointIndex) { // Take chart type from the series ChartTypeRegistry chartTypeRegistry = Common.ChartTypeRegistry; IChartType chartType = chartTypeRegistry.GetChartType(_series[seriesName].ChartTypeName); // If stacked column and bar if (chartType.StackSign || double.IsNaN(_series[seriesName].Points[pointIndex].YValues[valueIndex])) { continue; } if (chartType.Stacked) { maxValue = Double.MinValue; stackedMax += _series[seriesName].Points[pointIndex].YValues[valueIndex]; if (stackedMax > maxValue) { maxValue = stackedMax; } } else { noStackedMax = Math.Max(noStackedMax, _series[seriesName].Points[pointIndex].YValues[valueIndex]); } } } maxValue = Math.Max(maxValue, noStackedMax); returnValue = Math.Max(returnValue, maxValue); } return(returnValue); }
/// <summary> /// Gets maximum stacked Y value from many series /// </summary> /// <param name="valueIndex">Index of Y value to use</param> /// <param name="series">Series IDs</param> /// <returns>Maximum stacked Y value</returns> public double GetMaxStackedYValue(int valueIndex, params string[] series) { double returnValue = 0; double numberOfPoints = GetNumberOfPoints(series); for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++) { double stackedMax = 0; double noStackedMax = 0; foreach (string seriesName in series) { if (_series[seriesName].Points.Count > pointIndex) { // Take chart type from the series ChartTypeRegistry chartTypeRegistry = Common.ChartTypeRegistry; IChartType chartType = chartTypeRegistry.GetChartType(_series[seriesName].ChartTypeName); // If stacked area if (!chartType.StackSign) { continue; } if (chartType.Stacked) { if (_series[seriesName].Points[pointIndex].YValues[valueIndex] > 0) { stackedMax += _series[seriesName].Points[pointIndex].YValues[valueIndex]; } } else { noStackedMax = Math.Max(noStackedMax, _series[seriesName].Points[pointIndex].YValues[valueIndex]); } } } stackedMax = Math.Max(stackedMax, noStackedMax); returnValue = Math.Max(returnValue, stackedMax); } return(returnValue); }
/// <summary> /// Gets minimum stacked Y value from many series /// </summary> /// <param name="valueIndex">Index of Y value to use</param> /// <param name="series">Series IDs</param> /// <returns>Minimum stacked Y value</returns> public double GetMinStackedYValue(int valueIndex, params string[] series) { double returnValue = Double.MaxValue; double numberOfPoints = GetNumberOfPoints(series); for (int pointIndex = 0; pointIndex < numberOfPoints; pointIndex++) { double stackedMin = 0; double noStackedMin = 0; foreach (string seriesName in series) { if (_series[seriesName].Points.Count > pointIndex) { // Take chart type from the series ChartTypeRegistry chartTypeRegistry = Common.ChartTypeRegistry; IChartType chartType = chartTypeRegistry.GetChartType(_series[seriesName].ChartTypeName); // If stacked area if (!chartType.StackSign || double.IsNaN(_series[seriesName].Points[pointIndex].YValues[valueIndex])) { continue; } if (chartType.Stacked) { if (_series[seriesName].Points[pointIndex].YValues[valueIndex] < 0) { stackedMin += _series[seriesName].Points[pointIndex].YValues[valueIndex]; } } else { noStackedMin = Math.Min(noStackedMin, _series[seriesName].Points[pointIndex].YValues[valueIndex]); } } } stackedMin = Math.Min(stackedMin, noStackedMin); if (stackedMin == 0) { stackedMin = _series[series[0]].Points[^ 1].YValues[valueIndex];