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

Telerik graph ignoring LabelFormat value for DateTime

1 Answer 138 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 07 Aug 2013, 06:47 PM
I am trying to format the date on my Y-axis label so it shows "August, 2013"  I have set the axis LabelFormat property to {0:Y} but it still displays the full date time.  See attached picture.  
Also the data point label for March extends beyond the right side of the graph.  Is there a way to shrink the graph so the label always appears within the border of the graph?

//
// cartesianCoordinateSystem1
//
this.cartesianCoordinateSystem1.Name = "cartesianCoordinateSystem1";
this.cartesianCoordinateSystem1.XAxis = this.graphAxis1;
this.cartesianCoordinateSystem1.YAxis = this.graphAxis2;
//
// graphAxis1
//
this.graphAxis1.LabelFormat = "{0:C0}";
this.graphAxis1.MajorGridLineStyle.LineColor = System.Drawing.Color.LightGray;
this.graphAxis1.MajorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D);
this.graphAxis1.MinorGridLineStyle.LineColor = System.Drawing.Color.LightGray;
this.graphAxis1.MinorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D);
this.graphAxis1.MinorGridLineStyle.Visible = false;
this.graphAxis1.Name = "graphAxis1";
this.graphAxis1.Scale = numericalScale1;
//
// graphAxis2
//
this.graphAxis2.LabelFormat = "{0:Y}";
this.graphAxis2.MajorGridLineStyle.LineColor = System.Drawing.Color.LightGray;
this.graphAxis2.MajorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D);
this.graphAxis2.MinorGridLineStyle.LineColor = System.Drawing.Color.LightGray;
this.graphAxis2.MinorGridLineStyle.LineWidth = Telerik.Reporting.Drawing.Unit.Pixel(1D);
this.graphAxis2.MinorGridLineStyle.Visible = false;
this.graphAxis2.Name = "graphAxis2";
this.graphAxis2.Scale = categoryScale1;


Thank you
Thomas

1 Answer, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 09 Aug 2013, 03:56 PM
Hi Thomas,

The reason is that you are using CategoryScale and labels are treated as strings instead of DateTime. Select the labels and change the scale to DatetimeScale. Then set the series Data.X property to the DateTime field and labels will be formatted as expected.

About the data point label rendered outside the Graph item, try to set the Scale.Maximum of the scale to a greater value. Other approach we can suggest you is to use other option of the DataPointLabelAlignment enumeration, e.g. Center.

I hope this helps.

Regards,
Stef
Telerik

Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.

Tags
General Discussions
Asked by
Thomas
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or