Hi,
I am using latest telerik winform dll for my C#.net windows application. In my app, I have populated a radchartview( Line chart) control programatically by the following lines:
LineSeries lineSeria = new LineSeries();
lineSeria.VerticalAxis.LabelFormat = "{0:#,###}"; // Y axis label formatting
lineSeria.HorizontalAxis.LabelFormat = "{0:MM/dd/yyyy}"; //X axis label formatting
lineSeria.HorizontalAxis.LabelRotationAngle = 300;
lineSeria.HorizontalAxis.LabelFitMode = AxisLabelFitMode.Rotate;
lineSeria.HorizontalAxis.LabelInterval = graphInterval;
lineSeria.VerticalAxis.LabelInterval = 2;
List<Graph_Stat> lstGraph = _oGraphBal.LoadGraphs(); //Loading a generic list for populating chartview
lineSeria.ValueMember = "Value"; //decimal value
lineSeria.CategoryMember = "Date"; //date time
lineSeria.DataSource = lstGraph; //setting datasouce for line series
this.chartFrontedContractsSold.Series.Add(lineSeria); //adding line series to chartview and populating it
Here in this example , I have formatted both X and Y axis labels of chartview. The datetime value in X axis shows the correct formatting result. But the Y axis label not shows any formatted output ( for Eg, if I have a value 1000, it should have to be displayed as 1,000).
Please help me.
-Praveen.
I am using latest telerik winform dll for my C#.net windows application. In my app, I have populated a radchartview( Line chart) control programatically by the following lines:
LineSeries lineSeria = new LineSeries();
lineSeria.VerticalAxis.LabelFormat = "{0:#,###}"; // Y axis label formatting
lineSeria.HorizontalAxis.LabelFormat = "{0:MM/dd/yyyy}"; //X axis label formatting
lineSeria.HorizontalAxis.LabelRotationAngle = 300;
lineSeria.HorizontalAxis.LabelFitMode = AxisLabelFitMode.Rotate;
lineSeria.HorizontalAxis.LabelInterval = graphInterval;
lineSeria.VerticalAxis.LabelInterval = 2;
List<Graph_Stat> lstGraph = _oGraphBal.LoadGraphs(); //Loading a generic list for populating chartview
lineSeria.ValueMember = "Value"; //decimal value
lineSeria.CategoryMember = "Date"; //date time
lineSeria.DataSource = lstGraph; //setting datasouce for line series
this.chartFrontedContractsSold.Series.Add(lineSeria); //adding line series to chartview and populating it
Here in this example , I have formatted both X and Y axis labels of chartview. The datetime value in X axis shows the correct formatting result. But the Y axis label not shows any formatted output ( for Eg, if I have a value 1000, it should have to be displayed as 1,000).
Please help me.
-Praveen.
7 Answers, 1 is accepted
0
Accepted
Hello Praveen,
Thank you for writing.
I can confirm that there is an issue with the formatting of the labels in Linear axes. I have logged this issue in our Public Issue Tracking System - PITS. You can track the progress of the issue, subscribe for status changes and add your vote/comment to it on the following link - PITS Issue.
Until the issue is resolved you can workaround it by creating a custom format provider and assigning it to the linear axis of your chart:
And here is how to use this format provider:
I have also updated your Telerik points for bringing this issue to our attention.
I hope this will be useful. Should you have further questions, I would be glad to help.
Regards,
Ivan Petrov
the Telerik team
Thank you for writing.
I can confirm that there is an issue with the formatting of the labels in Linear axes. I have logged this issue in our Public Issue Tracking System - PITS. You can track the progress of the issue, subscribe for status changes and add your vote/comment to it on the following link - PITS Issue.
Until the issue is resolved you can workaround it by creating a custom format provider and assigning it to the linear axis of your chart:
public
class
MyFormatProvider : IFormatProvider, ICustomFormatter
{
public
object
GetFormat(Type formatType)
{
if
(formatType ==
typeof
(ICustomFormatter))
{
return
this
;
}
return
null
;
}
public
string
Format(
string
format,
object
arg, IFormatProvider formatProvider)
{
if
(arg ==
null
)
{
throw
new
ArgumentNullException(
"arg"
);
}
double
value;
if
(!
double
.TryParse(arg.ToString(),
out
value))
{
throw
new
ArgumentNullException(
"arg"
);
}
return
string
.Format(
"{0:"
+ format +
"}"
, value);
}
}
And here is how to use this format provider:
lineSeria.VerticalAxis.LabelFormatProvider =
new
MyFormatProvider();
I have also updated your Telerik points for bringing this issue to our attention.
I hope this will be useful. Should you have further questions, I would be glad to help.
Regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more.
Check out all of the latest highlights.
0
Praveen
Top achievements
Rank 1
answered on 13 Mar 2013, 09:48 AM
Hi Ivan Petrov,
The solution helped me a lot and it works fine. Thank you very much..!! :)
Regards,
Praveen
,
The solution helped me a lot and it works fine. Thank you very much..!! :)
Regards,
Praveen
,
0
Mark
Top achievements
Rank 1
answered on 03 Jun 2013, 02:34 PM
Hello Telerik support,
I still have a similar problem, even after upgrading to your latest version.
I have a stacked bar chart in horizontal form, so the x-axis is linear. The linear input are ticks, so of type long, and i would like to format this to hours, or datetimes; ideally i would set a datetime at the origin and then the labels should count on from there.
At the moment my Format function returns the ToString of (value/TimeSpan.TickPerHour). My value variable is of type long.
Any ideas how I can get this to work?
Thanks,
Mark
I still have a similar problem, even after upgrading to your latest version.
I have a stacked bar chart in horizontal form, so the x-axis is linear. The linear input are ticks, so of type long, and i would like to format this to hours, or datetimes; ideally i would set a datetime at the origin and then the labels should count on from there.
At the moment my Format function returns the ToString of (value/TimeSpan.TickPerHour). My value variable is of type long.
Any ideas how I can get this to work?
Thanks,
Mark
0
Hello Mark,
Thank you for writing.
Please, find attached an example project where I have tried to implement what I understand is your case. If this is not what you want to achieve or if this does not replicate your setup, I would kindly ask you to send me a more detailed explanation. Any additional materials like screenshots or sketches would also be helpful.
Looking forward to your reply.
Regards,
Ivan Petrov
Telerik
Thank you for writing.
Please, find attached an example project where I have tried to implement what I understand is your case. If this is not what you want to achieve or if this does not replicate your setup, I would kindly ask you to send me a more detailed explanation. Any additional materials like screenshots or sketches would also be helpful.
Looking forward to your reply.
Regards,
Ivan Petrov
Telerik
RadChart for WinForms is obsolete. Now what?
0
Roger
Top achievements
Rank 1
answered on 08 Oct 2013, 07:19 PM
Hi Ivan,
Would it be possible to have a VS 2010 version please of RadChartViewExample.zip, preferably VB.net? c# ok, though.
cheers
Roger
0
Hi Roger,
Thank you for writing.
I have attached a VS 2010 VB version of the project.
I hope you find this useful. Should you need further assistance, I would be glad to provide it.
Regards,
Ivan Petrov
Telerik
Thank you for writing.
I have attached a VS 2010 VB version of the project.
I hope you find this useful. Should you need further assistance, I would be glad to provide it.
Regards,
Ivan Petrov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Roger
Top achievements
Rank 1
answered on 14 Oct 2013, 05:24 PM
Thanks Ivan,
Appreciated.
Roger
Appreciated.
Roger