How to hide columns in a bar chart with value = 0

Thread is closed for posting
5 posts, 0 answers
  1. Dean
    Dean avatar
    12 posts
    Member since:
    Feb 2008

    Posted 19 Mar 2009 Link to this post

    How can I accomplish this using RadChart? With the Microsoft Chart control, you can set the minimum scale to 1 for the axis.
    I've tried setting the YAxis minvalue, but this does not have the desired effect

    <

     

    YAxis MinValue="1">

    Thanks for your help,
    Dean

     

  2. Dessy
    Admin
    Dessy avatar
    73 posts

    Posted 20 Mar 2009 Link to this post

    Hi Dean Jurecic,

    In order to be able to edit the MinValue and MaxValue of the YAxis, you should fist set AutoScale property equal to false.

    <YAxis AutoScale="False" MaxValue="51" MinValue="1" Step="10"

    Hope this helps. 

    Greetings,
    Dessy
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Dean
    Dean avatar
    12 posts
    Member since:
    Feb 2008

    Posted 20 Mar 2009 Link to this post

    Dessy,
     Thanks for your reply. That solution does change the labels on the Y axis, but it does not solve the problem. I realize that I need to be more specific. It would be great if we could attach an image to the posts on this forum.

    The series values and labels in my chart are taken from a database field  
       

    <telerik:ChartSeries DataYColumn="Budget" DefaultLabelValue="#Y{C0}" Name="Budget">  
     

    What I would like to do is hide the series label if the value of that series is 0.

     

     

     

     

     

     

     

     

     

     

     

  4. Dessy
    Admin
    Dessy avatar
    73 posts

    Posted 23 Mar 2009 Link to this post

    Hi Dean Jurecic,

    Thanks for the additional details. To achieve this you will have to loop through all the ChartSeriesItems and hide their label if the value of YValue property is 0:

    foreach (var item in RadChart1.Series[0].Items) 
            { 
                if (item.YValue == 0) 
                    item.Label.Visible = false
            } 

    Hope this help.

    Regards,
    Dessy
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. Dean
    Dean avatar
    12 posts
    Member since:
    Feb 2008

    Posted 23 Mar 2009 Link to this post

    Thanks Dessy. I included that code in chart1.PreRender and it works great!
Back to Top