|
How to use tips without dislplaying labels |
Posted by Leonid on Apr-21-2009 23:02 |
|
I use CharDirector v. 5.0 (C++ Edition) and VS 2008.
I need to use
1) TIPS without displaying x-axe labels for vertical bar-charts
2) TIPS without displaying labels for pie-charts
Is it possible?
Thanks in advance,
Leonid |
Re: How to use tips without dislplaying labels |
Posted by Peter Kwan on Apr-22-2009 00:46 |
|
Hi Leonid,
In ChartDirector, the tooltips are configurable. You can display anything you like.
For example, in mfcdemo version of the "Simple Bar Chart" sample code, the tooltip is configured as:
"title='{xLabel}: US${value}K'"
If you just want to show the value, you may remove the {xLabel}, like:
"title='{value}'"
Similarly, in the mfcdemo version of the "Simple Bar Chart" sample code, the tooltip is configured as:
"title='{label}: US${value}K ({percent}%)'"
If you just want to show the value and/or the percentage, you may use:
"title='{value} ({percent}%)'"
Hope this can help.
Regards
Peter Kwan |
Re: How to use tips without dislplaying labels |
Posted by Leonid on Apr-22-2009 14:52 |
|
Hi Peter,
thank you for such fast answer!
But my problem is another one you tried to help me. Probably I explained it not well.
This is the fragment om my usage of Simple Bar Chart:
...
double data[] = {26, 14, ...};
const char *labels[] = {"124/002 Normal Mode", "026/014 Testing Mode",...};
...
c->addBarLayer(DoubleArray(data, sizeof(data)/sizeof(data[0])))
c->xAxis()->setLabels(StringArray(labels, sizeof(labels)/sizeof(labels[0])));
*imageMap = c->getHTMLImageMap("clickable", "", "title='Device {xLabel} : Failed {value}%'");
In that case tips are "Device 124/002 Normal Mode : Failed 26%" and
"Device 026/014 Testing Mode : Failed 14%"...
Now the problem.
I don't want to display lables at all because of two reasons: large amount of labels (more than 40-50) and long label names. From another side, the information in tip completely satisfies me.
That is why I want TO HIDE (if possible) x-axis lables at all and use only tips.
As I understand, getHTMLImageMap(...) uses lables array only if previously was called xAxis()->setLabels(...). If "//c->xAxis()->setLabels(...)" tips are
"Device : Failed 26%" and
"Device : Failed 14%"...
That is unacceptable.
In the case of Simple Bar Chart I partially solved the problem with
"c->xAxis()->setLabelStep(1000)". Better than nothing:) But I have the first lable mandatory.
Another solution for bar-charts is to use Borderless Bars, but it is something else:(
In the case of Pie-Chart the problem becomes awful...I can't use them at all:(
Once more, thanks a lot, Peter! Maybe you'll have any ideas: )
Leonid. |
Re: How to use tips without dislplaying labels |
Posted by Peter Kwan on Apr-22-2009 16:26 |
|
Hi Leonid,
There are many methods to hide the x-axis labels. For example, you may set their colors to transparent:
c->xAxis()->setLabelStyle("normal", 8, Chart::Transparent);
Alternatively, you can choose not to use x-axis labels at all. Instead, the text strings can be added as an "extra field" to the chart, like:
c->addExtraField(StringArray(labels, sizeof(labels)/sizeof(labels[0])));
Your tooltips can then be configured to show the extra field instead of the x-axis labels.
*imageMap = c->getHTMLImageMap("clickable", "", "title='Device {field0} : Failed {value}%'");
Hope this can help.
Regards
Peter Kwan |
Re: How to use tips without dislplaying labels |
Posted by Leonid on Apr-22-2009 18:24 |
|
Hi, Peter, thank you very much! You solved my problem:)
Regards,
Leonid. |
Re: How to use tips without dislplaying labels |
Posted by Rob on Sep-03-2009 01:47 |
|
I to need to format the tool-tip differently, but am having an issue with the syntax.
My need is to format the value as currency, but based on the regional settings.
Here is what I am currently doing:
.ImageMap = c.getHTMLImageMap("clickable", "PrimaryKey={field0}", "title='{label}: " & _
NumberFormatInfo.CurrentInfo.CurrencySymbol & "{value}'")
What I need is more detail. I need the commas and decimal point also. |
Re: How to use tips without dislplaying labels |
Posted by Peter Kwan on Sep-03-2009 03:01 |
|
Hi Rob,
You may try:
NumberFormatInfo.CurrentInfo.CurrencySymbol & "{value|" & NumberFormatInfo.CurrentInfo.NumberGroupSeparator & NumberFormatInfo.CurrentInfo.NumberDecimalSeparator "}'"
Hope this can help.
Regards
Peter Kwan |
|