XCeed Chart Axis Labels
November 13, 2009
Maybe its me, but XCeed scatter charts don’t seem to play very well with labels. Showing numbers or dates on the axes is directly supported and there are good examples, but there are no examples for labels in scatter charts.
Here’s a solution I used:
Convert your labels to numbers (e.g. for states: AK = 0, AL = 1…) and then set the points in the chart (the x value here would be the state number):
foreach (var point in points){
points.AddPoint(point.Y, point.X, point.Z);
}
Use a custom label at every number:
Axis axis = theChart.Axis(StandardAxis.PrimaryX);
foreach(var state in states)
{
AxisLabel label = axis.CustomLabels.Add();
label.TextProps.Backplane.Visible = false;
label.TextProps.Border.Width = 0;
label.Value = state.Number;
label.Text = state.Abbreviation;
}
Then just tell your numbers to disappear with a “no thanks I don’t want any numbers” format:
theChart.Axis(axis).ValueFormatting.Format = ValueFormat.CustomNumber; theChart.Axis(axis).ValueFormatting.CustomFormat = "\\";
If you’re interested in a full working demo, leave a comment. I may get around to it eventually. If anyone can point me to the census data that might be helpful too.
Entry Filed under: Uncategorized. Tags: Chart, Code, labels, Points, XCeed.
Trackback this post | Subscribe to the comments via RSS Feed