ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  bar chart labels with a - sign
Posted by Peter W on Oct-07-2019 13:33
Hi,

I have labels for a bar chart
string[] labels = { "-45", "-35", "0", "+35", "+45" };

The "-45" and "-35" values appear as "45" and "35" yet the "+35" and "+45" appear as "+35" and "+45"

I would like the -45 and -35 values to appear with the -ve sign. Is there a formatting I can use to facilitate this?

Thanks

  Re: bar chart labels with a - sign
Posted by Peter Kwan on Oct-07-2019 15:49
Hi Peter,

Yes, please change "-45" to "\-45" or @"-45" or " -45 "

For historical reasons, a leading minus character will be treated to mean the label is associated with a minor tick. (The tick will be slightly shorter.) To display the leading minus character, there are two methods:

(a) Escape with a leading backslash. In C# syntax, the backslash is also a special character and it needs to be escape by another backslash, so it becomes "\-45".

or

(b) Use a space character as the leading character like " -45 ". It is also good to also add a trialing space. This ensures the label will stay at the same position as it is center aligned at the same point. (The center of the label does not change even if the length changes.)

Hope this can help.

Regards
Peter Kwan