Hello!
I use the following line in my code:
this.telerikChart.DefaultView.ChartArea.AxisY.DefaultLabelFormat = "#VAL{N0} " + unitName + " ";
I try to format the Y axis labels in a way that it shows the actual value concatenated with a specific unit name, but the way provided by you in the tutorial give me only rounded values concatenated with the unit name - like in the image attached labelformat.png - and I get on Y axis few times 0 values, few 1 values and not the real values that I need (shown correctly but without unit in labelformatnorounding.png)
What is the correct format string if I don.t want this rounding?
Thank you!
Roxana
I use the following line in my code:
this.telerikChart.DefaultView.ChartArea.AxisY.DefaultLabelFormat = "#VAL{N0} " + unitName + " ";
I try to format the Y axis labels in a way that it shows the actual value concatenated with a specific unit name, but the way provided by you in the tutorial give me only rounded values concatenated with the unit name - like in the image attached labelformat.png - and I get on Y axis few times 0 values, few 1 values and not the real values that I need (shown correctly but without unit in labelformatnorounding.png)
What is the correct format string if I don.t want this rounding?
Thank you!
Roxana
10 Answers, 1 is accepted
0
Accepted
Hello Roxana,
You can use this format:
"#VAL" + unitName + " "
Note that #VAL is used with no additional formatting.
Regards,
Ves
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
You can use this format:
"#VAL" + unitName + " "
Note that #VAL is used with no additional formatting.
Regards,
Ves
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
RoxanaC
Top achievements
Rank 1
answered on 10 Feb 2010, 09:59 AM
Right! I should have tried it!
Thank you!
Thank you!
0
Muhammad
Top achievements
Rank 1
answered on 24 Mar 2011, 10:38 AM
Hi,
Can i have labels of Y-axis displayed in the center of graph. Right now Y axis on the left side and X xis labels on the bottom. I want both to be displayed i the middle of graph.
Can i have labels of Y-axis displayed in the center of graph. Right now Y axis on the left side and X xis labels on the bottom. I want both to be displayed i the middle of graph.
0
Hi Muhammad,
Presently, the requested functionality is not available out of the box. The labels are positioned along the x and y axis, and there is no straightforward option to reposition them along the middle of the graph.
Regards,
Yavor
the Telerik team
Presently, the requested functionality is not available out of the box. The labels are positioned along the x and y axis, and there is no straightforward option to reposition them along the middle of the graph.
Regards,
Yavor
the Telerik team
0
sai
Top achievements
Rank 1
answered on 14 May 2015, 12:20 PM
hi,
please check attaches screen shot.
as of now we are showing 148.75. instead of that we want to show 148.45
means curently its shoiwng in decimal.we need to show in minutes.
Please provide the fix for this asap.
i am using wpf cartecian chart.
0
Hi Sai,
I am not sure that I understand what is the issue that you are experiencing. The label of a data point will display the point's value without any formatting applied. However, keep in mind that the numeric values of the data points are stored in a property of type System.Double and if you set too big decimal number, this number will be round in order to fit in the System.Double's range.
Furthermore, I am not sure what you mean by saying that you need to show minutes. Can you please clarify this? Also, it would be helpful if you can provide us with an isolated project that demonstrates your implementation and drawings with the expected result. This will help us in better understanding your case and assist you further. In addition you can take a look at the Label Definitions help article that demonstrates how you can customize the data point's labels.
Regards,
Martin
Telerik
I am not sure that I understand what is the issue that you are experiencing. The label of a data point will display the point's value without any formatting applied. However, keep in mind that the numeric values of the data points are stored in a property of type System.Double and if you set too big decimal number, this number will be round in order to fit in the System.Double's range.
Furthermore, I am not sure what you mean by saying that you need to show minutes. Can you please clarify this? Also, it would be helpful if you can provide us with an isolated project that demonstrates your implementation and drawings with the expected result. This will help us in better understanding your case and assist you further. In addition you can take a look at the Label Definitions help article that demonstrates how you can customize the data point's labels.
Regards,
Martin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
sai
Top achievements
Rank 1
answered on 21 May 2015, 09:43 AM
Hi,
In my application some of the graph showing the value as 15.50. it means 15 hours and 30mins.
but its showing like 15.50 in decimla format.
i want to show the value in datetime for mat like 15.30
please test and let me know the exact format for this label to show.
0
Hi Sai,
In order to achieve the desired effect you can use a LabelDefinition for the series and a custom Template along with an IValueConverter. This way you can define a text element for the label and bind its text with a converter which will convert the decimal part into minutes representation. Here is an example:
Please try this and let me know if it works for you.
Regards,
Martin
Telerik
In order to achieve the desired effect you can use a LabelDefinition for the series and a custom Template along with an IValueConverter. This way you can define a text element for the label and bind its text with a converter which will convert the decimal part into minutes representation. Here is an example:
public
class
NumberToMinutesNumberConverter : IValueConverter
{
public
object
Convert(
object
value, Type targetType,
object
parameter, CultureInfo culture)
{
var labelValue =
double
.Parse((
string
)value);
// convert the label's value
// return the converted value
}
}
<
local:NumberToMinutesNumberConverter
x:Key
=
"numberToMinutesNumberConverter"
/>
.....
<
telerik:BarSeries.LabelDefinitions
>
<
telerik:ChartSeriesLabelDefinition
>
<
telerik:ChartSeriesLabelDefinition.Template
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Label, Converter={StaticResource numberToMinutesNumberConverter}}"
/>
</
DataTemplate
>
</
telerik:ChartSeriesLabelDefinition.Template
>
</
telerik:ChartSeriesLabelDefinition
>
</
telerik:BarSeries.LabelDefinitions
>
Please try this and let me know if it works for you.
Regards,
Martin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items
0
sai
Top achievements
Rank 1
answered on 25 May 2015, 11:52 AM
Hi,
Thank you for yourreply.
I am uisng cartesian chart.
and i am taking care of binding and chart creation from codebehind.
please let me know the solution for this to implement from codebehind.
0
Hello Sai,
Here is an example how you can create the LabelDefinition in code and add it to the LabelDefinitions collection of the series:
If you want to define the DataTemplate also in code you can use several approach about which you can read in StackOverflow or in the corresponding Microsoft WPF documentation. You can also take a look at the Creating WPF Data Templates in Code: The Right Way blog post.
I hope this is useful.
Regards,
Martin
Telerik
Here is an example how you can create the LabelDefinition in code and add it to the LabelDefinitions collection of the series:
<
Window.Resources
>
<
local:numberToMinutesNumberConverter
x:Key
=
"numberToMinutesNumberConverter"
/>
<
DataTemplate
x:Key
=
"seriesLabelTemplate"
>
<
TextBlock
Text
=
"{Binding Label, Converter={StaticResource numberToMinutesNumberConverter}}"
/>
</
DataTemplate
>
</
Window.Resources
>
var series =
new
BarSeries();
// code that set up the series
var definition =
new
ChartSeriesLabelDefinition() { Template = (DataTemplate)
this
.Resources[
"seriesLabelTemplate"
] };
series.LabelDefinitions.Add(definition);
If you want to define the DataTemplate also in code you can use several approach about which you can read in StackOverflow or in the corresponding Microsoft WPF documentation. You can also take a look at the Creating WPF Data Templates in Code: The Right Way blog post.
I hope this is useful.
Regards,
Martin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items