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

x-axis label step and scale

2 Answers 265 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 06 Jan 2012, 04:10 PM
i have been struggling, googling and searching my problem to no avail.

i am using reporting v5.3.11.1116  for exporting a chart. The axis are dates. I have played around with autoscale and setting step and label step, min value, and max value.

However, it seem to get the same result: The line is constructed and scaled properly, but the x-axis labels are always spaced evenly apart even when the time between points is varied.  Please see my attachment.

You will notice that one major tick is 2 months, but the next is 12 days. It conitnues like that.

Here are some of my current settings that wil not work.

            chart1.PlotArea.XAxis.MinValue = dataSeriesDisplayChartViewModel.DataSeriesDisplay.SelectedStartDate.AddDays(-1).ToOADate();
            chart1.PlotArea.XAxis.MaxValue = dataSeriesDisplayChartViewModel.DataSeriesDisplay.SelectedEndDate.AddDays(1).ToOADate();
            chart1.PlotArea.XAxis.Step = (chart1.PlotArea.XAxis.MaxValue - chart1.PlotArea.XAxis.MinValue)/10;

           this.chart1.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Top;
            this.chart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 45F;
            this.chart1.PlotArea.XAxis.Appearance.MajorGridLines.Color = System.Drawing.Color.Gainsboro;
            this.chart1.PlotArea.XAxis.Appearance.MajorGridLines.EndCap = System.Drawing.Drawing2D.LineCap.Flat;
            this.chart1.PlotArea.XAxis.Appearance.MajorGridLines.PenStyle = System.Drawing.Drawing2D.DashStyle.Solid;
            this.chart1.PlotArea.XAxis.Appearance.MajorTick.Color = System.Drawing.Color.Black;
            this.chart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black;
            this.chart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Reporting.Charting.Styles.ChartValueFormat.ShortDate;
            this.chart1.PlotArea.XAxis.AutoScale = false;
            this.chart1.PlotArea.XAxis.AxisLabel.Appearance.Visible = true;
            this.chart1.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Black;
            this.chart1.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.chart1.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Observation Date";
            this.chart1.PlotArea.XAxis.AxisLabel.Visible = true;
            this.chart1.PlotArea.XAxis.DataLabelsColumn = "ObservationDateOADate";
            this.chart1.PlotArea.XAxis.IsZeroBased = false;


how do i get the x axis labels to display evenly spaced out values. It is okay if the labels do not match up with the points. For example, a data point on 1/15/12 could be by the actual label of 1/12/12.  we are printing out a separate report for the raw values in a different report.

2 Answers, 1 is accepted

Sort by
0
Accepted
Elian
Telerik team
answered on 09 Jan 2012, 08:03 PM
Hi,

In this scenario you don't need this line:

            this.chart1.PlotArea.XAxis.DataLabelsColumn = "ObservationDateOADate";

because the chart will calculate the labels and this property binds the XAxis values to the dataSource field.
Try removing it and see if there is any change. If the problem persists, please open a support ticket and send us a runnable project that we can examine. 

Greetings,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Robert
Top achievements
Rank 1
answered on 09 Jan 2012, 11:40 PM
that worked. thank you.
Tags
General Discussions
Asked by
Robert
Top achievements
Rank 1
Answers by
Elian
Telerik team
Robert
Top achievements
Rank 1
Share this question
or