Show axis labels on multiple sides? left, right , top and bottom...

Thread is closed for posting
6 posts, 1 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 16 Jun 2011 Link to this post

    Hi all,

    In a chart displayed on the page, there are normally 2 sets of axis labels, One that goes up and down on the left hand side (Y axis), and one at the bottom going from left to right (X axis).

    Is it possible to have these labels displayed on both sides (Left and right AND/OR top and bottom) ?

    Thanks
  2. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 20 Jun 2011 Link to this post

    Anyone?
  3. Peshito
    Admin
    Peshito avatar
    581 posts

    Posted 21 Jun 2011 Link to this post

    Hello Karl,

    Yes it is possible to be done for the YAxis. You can set multiple YAxis using the ChartSeries YAxisType property and set it to "Secondary".

    For instance:
    <telerik:ChartSeries Name="Series 2" Type="Bar" YAxisType="Secondary">

    Unfortunately we don't support multiple XAxis and you cannot do the same for the XAxis.

    Best wishes,
    Peshito
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  4. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 27 Jun 2011 Link to this post

    Hi Peshito,

    Thanks for your answer which works well if I have multiple series in the chart.

    However, suppose I only have one series, and only one value in my data is being charted? Can I then show the yaxis labels on both sides? My chart spans all the way across my page (currently 960 pixels wide) and isn't very high, so by the time the users eyes have scanned across the page, they may lose sight of the true value of the point on the chart.

    Supposing my chart spanned the entire width of my screen (large screen in a call centre for example), then reading the correct value would become even more difficult.

    I think this feature would be would be welcomed by great many developers if it doesn't currently exist. 
  5. Answer
    Peshito
    Admin
    Peshito avatar
    581 posts

    Posted 30 Jun 2011 Link to this post

    Hello Karl,

    You can show the secondary Y axis in a single-series chart too. You will have to set its Visible property to ChartAxisVisibility.True. Now, you will need to configure it to mirror the primary one. If the primary Y axis is manually configured, then you know the min, max and step values. However, if the primary Y axis is auto-scaled, you will need to wire the BeforeLayout event of RadChart. At the time it is triggered, the automatic calculation is done and the MinValue, MaxValue and Step properties are already set. You can get them and configure the secondary Y axis:

    void RadChart1_BeforeLayout(object sender, EventArgs e)
        {
            double min = RadChart1.PlotArea.YAxis.MinValue;
            double max = RadChart1.PlotArea.YAxis.MaxValue;
            double step = RadChart1.PlotArea.YAxis.Step;
     
            RadChart1.PlotArea.YAxis2.Visible = Telerik.Charting.Styles.ChartAxisVisibility.True;
            RadChart1.PlotArea.YAxis2.AutoScale = false;
            RadChart1.PlotArea.YAxis2.AddRange(min, max, step);
        }


    Hope that helps.

    Kind regards,
    Peshito
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  6. Karl
    Karl avatar
    172 posts
    Member since:
    Sep 2010

    Posted 30 Jun 2011 Link to this post

    Excellent.

    Thanks Peshito.
Back to Top