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

Message ListMessage List     Post MessagePost Message

  formatting decimal points on a field label for hovering?
Posted by jef smit on May-20-2025 05:44
Peter:

I'm trying to format the labels that appear when I hover over a data point in my xy chart by adding additional fields like this:

c->addExtraField(StringArray(labels, m_numalts)); //field0
c->addExtraField(DoubleArray(euData, m_numalts)); //field1
c->addExtraField(DoubleArray(sdData, m_numalts)); //field2

which I then use in:

m_PlotChart.setImageMap(c->getHTMLImageMap("clickable", "",
"title='Alternative:{field0}\nEU:{field1}\nSD:{field2}'"));

which works great except the numeric data in field1 and field2 have too many decimal
values so field1 shows up as EU:0.17564 and I would like it to display EU:0.176 or EU:0.18.

Is it possible to format the field1 variable to show as x.xxx? From the documentation it looks like the DataSet class or parameters are for this but can't find an example.

thanks,
jeff

  Re: formatting decimal points on a field label for hovering?
Posted by Peter Kwan on May-20-2025 12:59
Hi jef smit,

Please try:

m_PlotChart.setImageMap(c->getHTMLImageMap("clickable", "",
"title='Alternative:{field0}\nEU:{field1|3}\nSD:{field2|3}'"));

In the page:

https://www.advsofteng.com/doc/cdcpp.htm#paramsub.htm

there is a section called "Number Formatting" (near the bottom of the page) that describes all the formatting options available.

Best Regards
Peter Kwan

  Re: formatting decimal points on a field label for hovering?
Posted by jef smit on May-22-2025 01:26
Worked!!
thank you!
regards,
jeff