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