This is a migrated thread and some comments may be shown as answers.

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

4 Answers 411 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Dean
Top achievements
Rank 1
Dean asked on 19 Mar 2009, 07:40 PM
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

 

4 Answers, 1 is accepted

Sort by
0
Dessy
Telerik team
answered on 20 Mar 2009, 03:34 PM
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.
0
Dean
Top achievements
Rank 1
answered on 20 Mar 2009, 04:10 PM
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.

 

 

 

 

 

 

 

 

 

 

 

0
Dessy
Telerik team
answered on 23 Mar 2009, 09:36 AM
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.
0
Dean
Top achievements
Rank 1
answered on 23 Mar 2009, 06:09 PM
Thanks Dessy. I included that code in chart1.PreRender and it works great!
Tags
Chart (Obsolete)
Asked by
Dean
Top achievements
Rank 1
Answers by
Dessy
Telerik team
Dean
Top achievements
Rank 1
Share this question
or