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

Message ListMessage List     Post MessagePost Message

  discrete heatmap axis labels not showing negative sign
Posted by David on Jun-22-2022 19:10
Hello,

There seems an issue with axis labels in discrete heatmap in ChartDirector 7:

As an example, modifying the labels of the discreteheatmap example in mfcdemo:

void discreteheatmap(CChartViewer *viewer, int /* chartIndex */)
{
    // The x-axis and y-axis labels
    const char* xLabels[] = {"-10", "-5", "-0.0001", "0.0001", "E", "F", "G", "H", "I", "J"};
    const int xLabels_size = (int)(sizeof(xLabels)/sizeof(*xLabels));
    const char* yLabels[] = {"-10", "1000", "2", "3", "4", "5", "6", "7", "8", "9"};
    const int yLabels_size = (int)(sizeof(yLabels)/sizeof(*yLabels));

....


The negative signs were not shown in the chart.

  Re: discrete heatmap axis labels not showing negative sign
Posted by Peter Kwan on Jun-22-2022 22:36
Hi David,

Strange as it seems, it is by design.

Due to a decision we made a long long time ago when we first supported minor ticks, we chose to use the "-" character to mean that the label is associated with a minor tick. In the discrete heat map examples, they hide the ticks. But in charts that show the ticks, you can see the ticks associated with the "-" labels are shorter.

We now think using "-" for minor ticks is not a good idea, but due to our commitment to backwards compatibility, we have not changed this behaviour. See:

https://www.advsofteng.com/doc/cdcpp.htm#Axis.setLabels.htm

To add the "-0.0001", we need to escape it to "-0.0001". Now "" has a special meaning in C++ literal string, and we need to escape it too. So in C++, it becomes "\\-0.0001".

Regards
Peter Kwan

  Re: discrete heatmap axis labels not showing negative sign
Posted by Peter Kwan on Jun-22-2022 22:38
Hi David,

For the last paragraph, I mean:

To add the "-0.0001", we need to escape it to "\\-0.0001". Now "" has a special meaning in C++ literal string, and we need to escape it too. So in C++, it becomes "\\\\-0.0001".

(The forum itself will escape the \\ character. So I need to type 4 backslashes in order to display 2 backslashes in the forum.)

Regards
Peter Kwan

  Re: discrete heatmap axis labels not showing negative sign
Posted by David on Jun-22-2022 22:48
Cool. I'll get it a try. Thanks!