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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...