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

Message ListMessage List     Post MessagePost Message

  Tooltip for Y-Axis Labels
Posted by Manoj.D on Dec-17-2021 00:57
Attachments:
Hi,

In ChartDirectory do we get an option to set the Tooltip only for Y-Axis labels?

Detailed Description:
If we Mouse hover on the Y-Axis Labels we need to show that particular Label as its tooltip.
For Example: If we refer to the attached image when we mouse hover on truncated label -10000... we need to show its complete label -100000000 as its tooltip.

These Y-axis labels vary dynamically when the user clicks on ZoomIn and ZoomOut.

Please give me some inputs to show the Tooltip for Y-Axis Labels.

I have tried this chart viewer.ShowToolTip(label), but it is showing a single tooltip if we mouse hover anywhere in the chart.


Coding Languge we are using: C# and WPF.

Thanks in Advance.


Regards,
Manoj.D
Trend.png

  Re: Tooltip for Y-Axis Labels
Posted by Peter Kwan on Dec-17-2021 17:24
Hi Manoj.D,

To configure tooltips for the axis labels, you can generate an image map using Axis.getHTMLImageMap.

For example:

// Display the chart first
viewer.Chart = c;

// Configure tooltips for the y-axis labels
viewer.ImageMap = c.yAxis().getHTMLImageMap("", "", "title={value}");

If you have other tooltips for the chart (other image maps), you can simply concatenate the image maps together. (The image map is just a text string.)

For your case, another alternative is to change the display unit. For example. instead of 100,000,000, you can use 100M. If the axis range can vary widely depending on the data and zoom level, you can use conditional format. In our Zoomable and Scrollable sample code, we commonly use conditional format for the x-axis, as it can vary from a few years to a few seconds when the user zooms in and out. For the y-axis, an example is:

c.yAxis().setFormatCondition("align", 1000000);   // if all the labels are multiples of 1000000
c.yAxis().setLabelFormat("{={value}/1000000}M");   // divide the value by 1000000, and use M as the unit

c.yAxis().setFormatCondition("align", 1000);   // otherwise if all the labels are multiples of 1000
c.yAxis().setLabelFormat("{={value}/1000}K");   // divide the value by 1000, and use K as the unit

c.yAxis().setFormatCondition("else");   // otherwise
c.yAxis().setlabelFormat("{value}");    // display the label using the default format

The above method can be extended further to make it work for most cases. One case this cannot handle is if the labels must have many decimal places. Foe example, if the labels are (1.00000000001, 1.00000000002, 1.00000000003, 1.00000000004), then there is no way to shorten the label using any unit.

Regards
Peter Kwan

  Re: Tooltip for Y-Axis Labels
Posted by Manoj.D on Dec-17-2021 21:31
Hi Peter,

Thank you so much for the inputs.

It's working now.

Thanks and Regards,
Manoj.D