Tech Tock

Time is of the essence.

XCeed Chart Axis Labels

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.

Advertisements

November 13, 2009 - Posted by | Uncategorized | , , , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: