Пример #1
0
        private NumericalAxisPlotInfo CreateAxisPlotInfo(double delta, double doubleValue)
        {
            NumericalAxisPlotInfo plotInfo;
            double normalizedValue;

            if (delta == 0)
            {
                normalizedValue = 0;
            }
            else
            {
                normalizedValue = (doubleValue - this.actualRange.minimum) / delta;
            }

            if (this.IsInverse)
            {
                plotInfo = NumericalAxisPlotInfo.Create(this, 1 - this.normalizedOrigin, 1 - normalizedValue, 1 - this.normalizedOrigin);
            }
            else
            {
                plotInfo = NumericalAxisPlotInfo.Create(this, this.normalizedOrigin, normalizedValue, this.normalizedOrigin);
            }

            plotInfo.SnapTickIndex = this.GetSnapTickIndex(doubleValue);

            return(plotInfo);
        }
Пример #2
0
        private void PlotCombineGroup(CombineGroup group, StackValueProcessor stackValueProcessor)
        {
            double plotPositionPositiveStack, plotPositionNegativeStack;
            double value, plotOriginOffset, normalizedValue;

            double stackSum;
            double valuesSum;
            double delta = this.actualRange.maximum - this.actualRange.minimum;

            foreach (CombineStack stack in group.Stacks)
            {
                double positiveValuesSum = 0d, negativeValuesSum = 0d;
                valuesSum = 0d;
                plotPositionPositiveStack = plotPositionNegativeStack = this.normalizedOrigin;

                foreach (DataPoint point in stack.Points)
                {
                    if (point.isEmpty)
                    {
                        continue;
                    }

                    value = (double)point.GetValueForAxis(this);

                    if (value >= DefaultOrigin)
                    {
                        valuesSum        = positiveValuesSum;
                        plotOriginOffset = plotPositionPositiveStack;
                    }
                    else
                    {
                        valuesSum        = negativeValuesSum;
                        plotOriginOffset = plotPositionNegativeStack;
                    }

                    valuesSum += double.IsNaN(value) ? 0d : value;

                    // TODO: Remove insignificant datapoints from drawing stack.
                    stackSum = this.TransformValue(stackValueProcessor(stack, valuesSum));

                    if (delta == 0)
                    {
                        normalizedValue = 0;
                    }
                    else
                    {
                        normalizedValue = (stackSum - this.actualRange.minimum) / delta;
                    }

                    NumericalAxisPlotInfo plotInfo;
                    if (this.IsInverse)
                    {
                        plotInfo = NumericalAxisPlotInfo.Create(this, 1 - plotOriginOffset, 1 - normalizedValue, 1 - this.normalizedOrigin);
                    }
                    else
                    {
                        plotInfo = NumericalAxisPlotInfo.Create(this, plotOriginOffset, normalizedValue, this.normalizedOrigin);
                    }

                    plotInfo.SnapTickIndex = this.GetSnapTickIndex(stackSum);
                    point.SetValueFromAxis(this, plotInfo);

                    if (value >= DefaultOrigin)
                    {
                        positiveValuesSum         = valuesSum;
                        plotPositionPositiveStack = normalizedValue;
                    }
                    else
                    {
                        negativeValuesSum         = valuesSum;
                        plotPositionNegativeStack = normalizedValue;
                    }
                }
            }
        }