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: , , , , .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Please Comment

Please leave even a brief comment. Thanks.

Tags

.Net .Net 4.0 49Q @Lab Book C# C# 4.0 Chart Charts Code Demo App EF Entity Framework Interview Lab49 Linq Linq2SQL MBUnit Multithreading NUnit Optimization ORM PDC Performance Points Primer Project Management Reading Requirements Gathering Scatter Security Silverlight Slashdot Software Requirements SSL Steve Yegge TDD ToString Unit Testing Utility Visual Studio WCF WPF WTF XCeed

What's New

Popular

Recent Comments

Happy Holidays @Lab … on About
Adam Miller on “Throwing exceptions can…
A Free Database You… on In Memory of Linq2SQL – …
goldmanalpha on “Throwing exceptions can…
Andre de Cavaignac on “Throwing exceptions can…

History

November 2009
M T W T F S S
« Oct   Dec »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Subscribe

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Top Clicks