Position of Bars

3 posts, 1 answers
  1. NickZ
    NickZ avatar
    45 posts
    Member since:
    Apr 2009

    Posted 23 Feb 2011 Link to this post

    I created a simple bar series chart.  Every looks fine except the postion of bars.  There are three bars, the middle one is centered, the left one is aligned to left and right one is aligned to right.  How can I put left and right bars in the center of its own section.  I attach an image of my chart. 
    Thank a lot for your help.
  2. Answer
    Evgenia avatar
    1437 posts

    Posted 28 Feb 2011 Link to this post

    Hi Shilong,

    The issue with Bars alignment occurs because you created 3 Series with single Bar in each. When the ChartArea is populated with 3 series for example, RadChart makes each Bar with Width = 1/3 of the space between each two Major Tickpoints. This way the three Bar items (from the three series) which have XAxis=1 will be positioned accordingly.
    What I can suggest is that you create single DataSerie with 3 items instead of 3 DataSeries with 1 item. To make them colored differently just set the LegendDisplayMode property of the SeriesDefinition  to DataPointLabel and set LegendLabel for each of the DataPoints as shown in our help topic
    Here is how you can achieve this declaratively:
    <control:RadChart x:Name="chart">
                            <chart:ChartArea LegendName="CustomLegend">
                                    <chart:DataSeries LegendLabel="Store Sales">
                                            <chart:BarSeriesDefinition LegendDisplayMode="DataPointLabel" />
                                        <chart:DataPoint YValue="15" LegendLabel="Telerik" />
                                        <chart:DataPoint YValue="5" LegendLabel="Microsoft"/>
                                        <chart:DataPoint YValue="11" LegendLabel="Others"/>
                            <chart:ChartLegend x:Name="CustomLegend" />
                            <chart:ChartTitle Content="Sales Summary" />

    Kind regards,
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. NickZ
    NickZ avatar
    45 posts
    Member since:
    Apr 2009

    Posted 28 Feb 2011 Link to this post

    Thanks a lot, Evgenia.  This solved my problem.
Back to Top