Gregor Suttie
Top achievements
Rank 1
Gregor Suttie
asked on 27 Oct 2011, 08:49 AM
I have my grid working nicely with x and y values as I want - I just want to add a label on the Y axis to signify what kind of data it is - for example say the graph showed money id like a y axis of £, if the y axis was showing temperature data id like to show centigrade.
Note this label im talking about isnt the actual y axis just a textual label to show what the values relate to.
Cheers
Gregor
Note this label im talking about isnt the actual y axis just a textual label to show what the values relate to.
Cheers
Gregor
8 Answers, 1 is accepted
0
Hi Gregor Suttie,
You can change your Y-Axis format by using the CustomFormat property like this:
Alternatively you could assign the currency formatter, which will automatically format the label value according to user's local:
More about label values can be found here.
Best wishes,
Peshito
the Telerik team
You can change your Y-Axis format by using the CustomFormat property like this:
radChart.PlotArea.YAxis.Appearance.CustomFormat = ("#£");
Alternatively you could assign the currency formatter, which will automatically format the label value according to user's local:
radChart.PlotArea.YAxis.Appearance.CustomFormat = ("C");
More about label values can be found here.
Best wishes,
Peshito
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Gregor Suttie
Top achievements
Rank 1
answered on 02 Nov 2011, 10:23 AM
Hi there
On the y axis i have values going from 0-100 as an example. I dont want a label next to each value, I just want to have one word Units next to the values.
100
90
80
70
60
Units 50
40
30
20
10
0
Like so, how can I accomplish this.
On the y axis i have values going from 0-100 as an example. I dont want a label next to each value, I just want to have one word Units next to the values.
100
90
80
70
60
Units 50
40
30
20
10
0
Like so, how can I accomplish this.
0
Gregor Suttie
Top achievements
Rank 1
answered on 02 Nov 2011, 10:44 AM
Its ok I have managed to work it out - I wasnt setting the visibility to true - it must default to false.
0
Nathan
Top achievements
Rank 1
answered on 02 Nov 2011, 09:32 PM
How would I got about just appending a '%' to the end of the value of the Y axis label? Trying ("#%") multiplies by 100 and then appends the % this is not what I want. I just need to append a % to the end of the value being displayed.
0
Nathan
Top achievements
Rank 1
answered on 02 Nov 2011, 09:46 PM
I got it working by adding:
to the code, but this seems ugly and unnecessary. Especially since I had to declare the chart at the class level so I could access it in the event handler. Is there an easier way of doing this?
void comparisonChart_BeforeLayout(object sender, EventArgs e)
{
foreach(ChartAxisItem item in comparisonChart.PlotArea.YAxis.Items)
{
item.TextBlock.Text += "%";
}
}
to the code, but this seems ugly and unnecessary. Especially since I had to declare the chart at the class level so I could access it in the event handler. Is there an easier way of doing this?
0
Hello Nathan,
Try using the following approach which should do the job and only add a "% sign at the end your Y-Axis labels:
I am using the Escape character in order to achieve this, which causes the next character to be interpreted as a literal rather than as a custom format specifier.
You can find more about custom numeric format strings here:
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
Greetings,
Peshito
the Telerik team
Try using the following approach which should do the job and only add a "% sign at the end your Y-Axis labels:
radChart.PlotArea.YAxis.Appearance.CustomFormat = ("#\\%");
You can find more about custom numeric format strings here:
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx
Greetings,
Peshito
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Chris
Top achievements
Rank 1
answered on 03 Jul 2013, 07:01 PM
Thanks, that was helpful. However, I ran into two subsequent problems:
1. "#\\%" results in, for example, "100\%". I'm sure everyone can figure out to take out the extra "\".
2. For the 0% on my chart, it was defaulting to no label. With the custom format that became "%". The final custom format for me was: "#\%;;0\%". Semicolons separate formats for positive, negative, and zero values, respectively.
By the way, I ran into these issues trying to make a StackedBar100 chart with Y-values that don't add up to 1. I like how the RadChart automatically labeled the Y-axis from 0 to 100, but it would be nice if it were 0% to 100% instead.
Telerik.Web.UI Version 2012.3.1308.35
1. "#\\%" results in, for example, "100\%". I'm sure everyone can figure out to take out the extra "\".
2. For the 0% on my chart, it was defaulting to no label. With the custom format that became "%". The final custom format for me was: "#\%;;0\%". Semicolons separate formats for positive, negative, and zero values, respectively.
By the way, I ran into these issues trying to make a StackedBar100 chart with Y-values that don't add up to 1. I like how the RadChart automatically labeled the Y-axis from 0 to 100, but it would be nice if it were 0% to 100% instead.
Telerik.Web.UI Version 2012.3.1308.35
0
Hi Chris,
Thank you for your feedback.
I am glad you have found the appropriate solutions to the issues you have faced. Regarding the format used for labeling the axis, this is the default label format used by the control and as you properly mentioned using a custom format solves this.
Regards,
Peshito
Telerik
Thank you for your feedback.
I am glad you have found the appropriate solutions to the issues you have faced. Regarding the format used for labeling the axis, this is the default label format used by the control and as you properly mentioned using a custom format solves this.
Regards,
Peshito
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.