We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Understanding behavior of custom chart axis labels

We've noticed some unexpected behavior with custom chart axis labels. We are adding several custom labels to a chart axis, but the labels do not appear on the chart past a certain value. Below is some sample code which yields similar results:

ChartControl chartControl1;
.
.
.

//Creation of New Series
ChartSeries series = chartControl1.Model.NewSeries("MySeries", ChartSeriesType.Line);
this.chartControl1.Model.Series.Add(series);

.
.
.

// Format the axis and add custom labels
ChartAxis axis = chartControl1.PrimaryXAxis;
axis.ValueType = ChartValueType.Logarithmic;
axis.RangeType = ChartAxisRangeType.Set;
axis.Range.Min = -1;
axis.Range.Max = 1;
axis.TickLabelsDrawingMode = ChartAxisTickLabelDrawingMode.UserMode;
axis.Labels.Clear();
axis.TickSize = new Size(1, 6);

for (double power = -1.0; power <= 1.0; power += 0.25)
{
ChartAxisLabel label = new ChartAxisLabel(Math.Pow(10.0, power), "0.00");
label.RoundingPlaces = 5;
axis.Labels.Add(label);
}

.
.
.

We were expecting to see nine custom chart labels, ranging from 10^-1 to 10^1. However, as shown in the attached screenshot, half of the labels do not appear on the chart. The last displayed label is 10^0, leaving off four labels (10^0.25 thru 10^1).

We can confirm that the last four labels are definitely being added to the label collection, and with the debugger we can see them inside the label collection. But for some reason the labels are not being drawn on the chart.

We'd like to know if there's a way to get all of the custom labels to appear.


ChartAxisLabels.zip

1 Reply

RF Rashidha F Syncfusion Team May 30, 2007 09:57 AM UTC

Hi Roger,

Thanks for using Syncfusion Products.

If your intension is to create a custom axis label means please set ChartAxisValuetype as Custom. I have modified your sample.

Please take a look at the attached sample.

http://websamples.syncfusion.com/samples/Chart.Windows/F61598/main.htm

The above sample exhibit how to draw a custom labels in chart control.

Please let me know if this helps.

Regards,
Rashidha.

Loader.
Live Chat Icon For mobile
Up arrow icon