Пример #1
0
        /// <summary>
        /// To calculate the current label's start and end position
        /// </summary>
        /// <param name="label">The Label</param>
        /// <returns>Returns a value indicating whether the range permissible.</returns>
        private bool SetValues(ChartMultiLevelLabel label)
        {
            startValue = CalculatePosition(label.Start);
            endValue   = CalculatePosition(label.End);
            if (startValue > endValue || startValue == endValue)
            {
                return(true);
            }
            if (Axis.Orientation == Orientation.Horizontal)
            {
                start = Math.Round(Axis.ValueToCoefficient(startValue)
                                   * (Axis.RenderedRect.Width)) + Axis.ActualPlotOffset;
                end = Math.Round(Axis.ValueToCoefficient(endValue)
                                 * (Axis.RenderedRect.Width)) + Axis.ActualPlotOffset;
            }
            else
            {
                start = (1 - Axis.ValueToCoefficientCalc(startValue)) *
                        Axis.RenderedRect.Height + Axis.ActualPlotOffset;
                end = (1 - Axis.ValueToCoefficientCalc(endValue)) *
                      Axis.RenderedRect.Height + Axis.ActualPlotOffset;
            }

            return(false);
        }
Пример #2
0
        // To Clone the multi level label properties
        protected virtual DependencyObject CloneMultiAxisLabel(DependencyObject obj)
        {
            ChartMultiLevelLabel multiLevelLabel = new ChartMultiLevelLabel();

            multiLevelLabel.Start          = this.Start;
            multiLevelLabel.End            = this.End;
            multiLevelLabel.Level          = this.Level;
            multiLevelLabel.Text           = this.Text;
            multiLevelLabel.FontSize       = this.FontSize;
            multiLevelLabel.Foreground     = this.Foreground;
            multiLevelLabel.FontFamily     = this.FontFamily;
            multiLevelLabel.LabelAlignment = this.LabelAlignment;
            return(multiLevelLabel);
        }
Пример #3
0
 /// <summary>
 /// To reset the current values of <see cref="MultiLevelLabelsPanel"/>
 /// </summary>
 private void ResetLabelValues()
 {
     currentBorderPos = 0;
     currentBracePos  = 0;
     currentLabel     = null;
     currentRow       = 0;
     if (Axis.Orientation == Orientation.Horizontal)
     {
         height = 0;
         top    = 0;
     }
     else
     {
         width = 0;
         left  = 0;
     }
 }
Пример #4
0
        /// <summary>
        /// To set the text blocks and borders of horizontal axis's <see cref="MultiLevelLabelsPanel"/>.
        /// </summary>
        /// <param name="finalSize">The Final Size</param>
        private void ArrangeHorizontalLabels(Size finalSize)
        {
            int j = 0, row = 0;

            top = isOpposed ? finalSize.Height : 0;
            foreach (IGrouping <int, ChartMultiLevelLabel> level in groupedLabels)
            {
                var collection = Axis.IsInversed ? level.Reverse() : level;
                foreach (ChartMultiLevelLabel label in collection)
                {
                    currentLabel = label;
                    if (SetValues(currentLabel))
                    {
                        CheckLabelRange();
                        continue;
                    }

                    SetTextBlockPosition();
                    SetBorderStyle(j, row, collection, true);
                    j++;
                }

                if (isOpposed)
                {
                    top -= height;
                }
                else
                {
                    top += height;
                }
                j = 0;
                row++;
                currentRow = row;
            }

            ResetLabelValues();
        }
Пример #5
0
        /// <summary>
        /// To arrange the text blocks and border of vertical axis's <see cref="MultiLevelLabelsPanel"/>.
        /// </summary>
        /// <param name="finalSize">The Final Size</param>
        private void ArrangeVerticalLables(Size finalSize)
        {
            int j = 0, row = 0;

            left = isOpposed ? width - margin.Right :
                   (finalSize.Width - (width - (margin.Right + margin.Left)));
            foreach (IGrouping <int, ChartMultiLevelLabel> level in groupedLabels)
            {
                var collection = Axis.IsInversed ? level.Reverse() : level;
                foreach (ChartMultiLevelLabel label in collection)
                {
                    currentLabel = label;
                    if (SetValues(label))
                    {
                        CheckLabelRange();
                        continue;
                    }

                    SetTextBlockPosition();
                    SetBorderStyle(j, row, collection, false);
                    j++;
                }

                if (isOpposed)
                {
                    left += width;
                }
                else
                {
                    left -= width;
                }
                j = 0;
                row++;
            }

            ResetLabelValues();
        }