private void initValues()
        {
            _maxValueItem = Items.OrderByDescending(x => x.Value).First();
            var maxValueWidth = getTextWidth(_maxValueItem.Value.ToString(CultureInfo.InvariantCulture));

            _leftMargin = maxValueWidth + Margin;
            _chartWidth = _leftMargin + (Items.Count() * (SpaceBetweenBars + BarWidth)) + (2 * Margin);
        }
        private float drawVerticalBar(float left, BarChartItem item)
        {
            var barValue = (((float)item.Value * 100f / (float)_maxValueItem.Value)) * (ChartHeight - BottomMargin - Margin - Margin) / 100f;

            _template.SetColorStroke(VerticalBarBorderColor);
            _template.SetLineWidth(VerticalBarBorderLineWidth);
            _template.SetColorFill(item.Color);
            _template.Rectangle(left, Margin + BottomMargin, BarWidth, barValue);
            _template.FillStroke();

            return(barValue);
        }
 private void drawXAxisLabel(float left, BarChartItem item)
 {
     ColumnText.ShowTextAligned(
         canvas: _template,
         alignment: Element.ALIGN_LEFT,
         phrase: PdfFont.FontSelector.Process(item.Label),
         x: left + XAxisLabelXLocationDelta,
         y: XAxisLabelYLocation,
         rotation: XAxisLabelRotation,
         runDirection: (int)Direction,
         arabicOptions: 0);
 }
 private void drawYAxisLabel(float top, BarChartItem item)
 {
     ColumnText.ShowTextAligned(
         canvas: _template,
         alignment: Element.ALIGN_LEFT,
         phrase: PdfFont.FontSelector.Process(item.Label),
         x: Margin,
         y: top + 2,
         rotation: 0,
         runDirection: (int)Direction,
         arabicOptions: 0);
 }
 private void drawHorizontalLabel(float top, BarChartItem item, float barValue)
 {
     ColumnText.ShowTextAligned(
         canvas: _template,
         alignment: Element.ALIGN_LEFT,
         phrase: PdfFont.FontSelector.Process(item.Value.ToString(CultureInfo.InvariantCulture)),
         x: _leftMargin + Margin + barValue + 2,
         y: top + 2,
         rotation: 0,
         runDirection: (int)Direction,
         arabicOptions: 0);
 }
        private float drawHorizontalBar(float top, BarChartItem item)
        {
            var barValue = (((float)item.Value * 100f / (float)_maxValueItem.Value)) * (ChartWidth - _leftMargin - Margin - Margin) / 100f;

            _template.SetColorStroke(HorizontalBarBorderColor);
            _template.SetLineWidth(HorizontalBarBorderLineWidth);
            _template.SetColorFill(item.Color);
            _template.Rectangle(_leftMargin + Margin, top, barValue, BarWidth);
            _template.FillStroke();

            return(barValue);
        }
        private void initValues()
        {
            _maxValueItem       = Items.OrderByDescending(x => x.Value).First();
            _maxLabelLengthItem = Items.OrderByDescending(x => x.Label.Length).First();
            _maxValueWidth      = getTextWidth(_maxValueItem.Value.ToString(CultureInfo.InvariantCulture));

            var maxLabelLengthItemWidth = getTextWidth(_maxLabelLengthItem.Label);

            _leftMargin = maxLabelLengthItemWidth + Margin;

            _textHeight       = getTextHeight(_maxLabelLengthItem.Label);
            _spaceBetweenBars = _textHeight * 0.7f;
            _bottomMargin     = _textHeight;
            _chartHeight      = _bottomMargin + (2 * Margin) + (Items.Count() * (_spaceBetweenBars + BarWidth));
        }
        private void drawVerticalBarLabel(float left, BarChartItem item, float barValue)
        {
            var itemValueWidth = getTextWidth(item.Value.ToString(CultureInfo.InvariantCulture));

            left = left - ((itemValueWidth - BarWidth) / 2);

            ColumnText.ShowTextAligned(
                canvas: _template,
                alignment: Element.ALIGN_LEFT,
                phrase: PdfFont.FontSelector.Process(item.Value.ToString(CultureInfo.InvariantCulture)),
                x: left,
                y: barValue + Margin + BottomMargin + 1.2f,
                rotation: 0,
                runDirection: (int)Direction,
                arabicOptions: 0);
        }