Пример #1
0
        internal override void PlotCore(AxisUpdateContext context)
        {
            int count = this.categories.Count;

            if (count == 0)
            {
                return;
            }

            double step = this.CalculateRelativeStep(count);

            double value  = 0;
            double gap    = this.GapLength * step;
            double length = step - gap;

            double offset = this.actualPlotMode == AxisPlotMode.OnTicks ? 0 : step / 2;
            double position;

            for (int i = 0; i < count; i++)
            {
                AxisCategory category = this.categories[i];
                position = this.IsInverse ? 1 - value - offset : value + offset;
                foreach (DataPoint point in category.Points)
                {
                    CategoricalAxisPlotInfo info = CategoricalAxisPlotInfo.Create(this, value);
                    info.CategoryKey = category.KeySource;
                    info.Position    = position;
                    info.Length      = length;

                    point.SetValueFromAxis(this, info);
                }

                value += step;
            }
        }
Пример #2
0
        private AxisCategory CreateCategory(object key, object keySource)
        {
            AxisCategory category = new AxisCategory()
            {
                Key = key, KeySource = keySource
            };

            this.categories.Add(category);

            return(category);
        }
Пример #3
0
        internal override object ConvertPhysicalUnitsToData(double coordinate, RadRect axisVirtualSize)
        {
            int categoriesCount = this.categories.Count;

            if (!this.isUpdated || categoriesCount == 0)
            {
                return(null);
            }

            double step             = this.CalculateRelativeStep(categoriesCount);
            double stepOffset       = this.actualPlotMode == AxisPlotMode.OnTicks ? 0.5 * step : 0;
            double relativePosition = this.CalculateRelativePosition(coordinate, axisVirtualSize, stepOffset);

            int categoryIndex = (int)(relativePosition / step);

            if (categoryIndex < 0 || categoryIndex > categoriesCount - 1)
            {
                return(null);
            }

            AxisCategory category = this.categories[categoryIndex];

            return(category.KeySource);
        }
Пример #4
0
        internal override AxisPlotInfo CreatePlotInfo(object value)
        {
            for (int index = 0; index < this.categories.Count; index++)
            {
                AxisCategory category = this.categories[index];
                if (object.Equals(category.KeySource, value))
                {
                    double step        = this.CalculateRelativeStep(this.categories.Count);
                    double gap         = this.GapLength * step;
                    double length      = step - gap;
                    double valueLength = index * step;
                    double offset      = this.actualPlotMode == AxisPlotMode.OnTicks ? 0 : step / 2;

                    CategoricalAxisPlotInfo info = CategoricalAxisPlotInfo.Create(this, valueLength);
                    info.CategoryKey = value;
                    info.Position    = this.IsInverse ? 1 - valueLength - offset : valueLength + offset;
                    info.Length      = length;

                    return(info);
                }
            }

            return(null);
        }