Jump to content
Software FX Community

Align Y Axis Labels


wallsy

Recommended Posts

Hi,

I have a chart with y-axis labels that I don't know how to align properly. I would like to left-align the values.

The values are:

A++

  A+

  A

A-

A--

B++

  B+

  B

etc...

I have tried padding the labels out with spaces on the right - but they must be trimmed of any whitespace before rendering as it does not have any effect.

Any ideas? Is this possible?

Thanks,

Dan.

ps. See attached image as well for further example of where I'm up to. 

 

 

Link to comment
Share on other sites

I tried the following - but it didn't work.

scoreTrendChart.AxisY.Font = new Font("Courier New",10);

scoreTrendChart.AxisY.Label[0] = ""; scoreTrendChart.AxisY.Label[1] = "E--"; scoreTrendChart.AxisY.Label[2] = "E- "; scoreTrendChart.AxisY.Label[3] = "E "; scoreTrendChart.AxisY.Label[4] = "E+ "; scoreTrendChart.AxisY.Label[5] = "E++";

 any ideas? 

Thanks,Dan.

Link to comment
Share on other sites

To hide the Y-Axis labels:

chart.AxisY.Style |= AxisStyle.HideLabels;

For some reason .NET is trimming your strings when drawing them right-aligned. I debugged the code and the strings are correct (with the spaces) all the way to the .NET API call. Weird :-(

You could replace the last space with some other character (there are a few in COurier New that are pretty small). For example:

chart1.AxisY.Label[0] = "";

chart1.AxisY.Label[1] =

"E--"; chart1.AxisY.Label[2] = "E-\x2D1";

chart1.AxisY.Label[3] =

"E \x2D1"; chart1.AxisY.Label[4] = "E+\x2D1";

chart1.AxisY.Label[5] =

"E++";
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...