Bar series width problem

3 posts, 1 answers
  1. heallven
    heallven avatar
    2 posts
    Member since:
    Jul 2012

    Posted 20 Mar 2011 Link to this post

    I am using RadChart to draw two series in one ChartArea.
    The two series are LineSeries and BarSeries.

    And I also set the ItemWidthPercent = "2" in ChartArea, because there are almost 200-300 point in chart.

    But the each bar in BarSeries have different width.
    Please see the screenshot in attachment.

    Is it a bug?
  2. Answer
    Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 24 Mar 2011 Link to this post

    Hi Liu,

    The width of the bars depends on the mechanism of calculating the ItemWidthPercent, as well as the number of ticks/length between ticks. Up until a specific point , the way it's calculated is based on a portion of the step, for example, if you have Step = 5 and ItemWidthPercent = 10, it'd mean that the width of the individual bar would be only 2% of the step ( i.e. 10% of 1/5th ). After that specific point the ItemWidthPercent is applied to the available space between two ticks, which is why the bars would become wider or thinner.

    As you have set very small value for ItemWidthPercent this is causing the Bars to look like they are with different Width. What I can suggest you is to set bigger ItemWidthPercent.


    Greetings,
    Evgenia
    the Telerik team
  3. heallven
    heallven avatar
    2 posts
    Member since:
    Jul 2012

    Posted 25 Mar 2011 Link to this post

    Thanks, Evgenia.
    I have understand this mechanism.

    And I already have another solutions.

    radKlineChart.CreateItemStyleDelegate = BuildCustomItemStyle;
      
    public Style BuildCustomItemStyle(Control item, Style style, DataPoint point, DataSeries dataSeries)
    {
        if ((item as Bar) != null && point != null)
        {
            Canvas canvas = item.FindChildByType<Canvas>();
            Rectangle definingGeometry = canvas.Children[0] as Rectangle;
            definingGeometry.Width = 1;
        }
        return style;
    }

    Then I'd like to calculate the width by myself.

    Thank for your support : )
Back to Top