|
Mapping y-axis values for creating Tooltips using "setHTMLImageMap" |
Posted by Pablo on Apr-13-2018 00:59 |
|
Is there any way of inserting in a tooltip a mapped string from a numeric y-axis value?
I mean, imagine I have a dataset containing one million points, x-axis for time and y-axis for number values (within the 0, 1, 2 set).
I would like to show a tooltip mapping y-axis as this:
0-> AAA
1-> BBB
2-> CCC
I understand the extra field solution, but it forces to add 1 extra million string values to RAM.
Is there a more "not RAM gready" solution?
Thank you! |
Re: Mapping y-axis values for creating Tooltips using "setHTMLImageMap" |
Posted by Peter Kwan on Apr-14-2018 00:04 |
|
Hi Pablo,
Creating one million tooltips are CPU and memory consuming. Would you consider to use "programmable track cursor" instead? See:
http://www.advsofteng.com/gallery_track.html
The programmable track cursor, as its name implies, are programmable, and you can displays AAA, BBB, CCC instead of 0, 1, 2 by looking up the name from the value in the program code.
If you prefer to use image map, another method is to just use the image map to set up an "hotspot mousemove" handler. When the mouse is over the hotspot, the event handling code can generate the tooltip in the way you like. The "Crosshair with Axis Labels" example in the above track cursor page demonstrates this method. In this example, the crosshair and axis labels are achieved using "programmable track cursor", while the tooltips for the scatter symbols and trend line are by using "hotspot mousemove" events.
(The exact code depends on the programming language and whether it is a desktop or web application.)
Regards
Peter Kwan |
Re: Mapping y-axis values for creating Tooltips using "setHTMLImageMap" |
Posted by Pablo on Apr-16-2018 18:30 |
|
Hi Peter, thank you for your answer.
I have not fully understaood it. If I have not missunderstood, in that example the tooltips are created with "setHTMLImageMap" and the crosshair with the window event "CVN_MouseMovePlotArea". Do you mean that I should use the event handler function to set a specifically created HTML image with "setHTMLImageMap" every time that mouse moves? I mean somethink like this:
void CcrosshairDlg::OnMouseMovePlotArea()
{
.....
const char* mapped_value = map[y_value];
ostream os = "tittle: Y_value: " << mapped_value;
pLayer->setHTMLImageMap("", "", os.str().c_str());
}
I am using c++ for a desktop application.
Thank a lot! |
Re: Mapping y-axis values for creating Tooltips using "setHTMLImageMap" |
Posted by Peter Kwan on Apr-17-2018 01:48 |
|
Hi Pablo,
In the "ChartDirector/mfcdemo/mfcdemo" sample project, most of the charts are clickable. It demonstrates how to detect clicking on the hotspots. Basically, the image map is created at the same time as the chart. In the click event handler, the ImageMapHandler is used to determine which hotspot is clicked and then the code can perform the necessary action.
For your case, instead of using the click event, you can use the ImageMapHandler in the MouseMovePlotArea event to determine which hotspot the mouse is over. The action to perform is to draw a textbox near the mouse showing information about the hotspot.
I have attached an example based on the "Crosshair with Axis Labels" sample code for your reference. To try the code, please copy the files inside to the "ChartDirectormfcdemocrosshair" subdirectory, replacing the existing sample code there. Then you can try the "ChartDirectormfcdemomfcdemo.sln" Visual Studio solution, set "crosshair" as the active project, and compile and run it.
Regards
Peter Kwan
|
Re: Mapping y-axis values for creating Tooltips using "setHTMLImageMap" |
Posted by Pablo on Apr-17-2018 16:24 |
|
Thank you very much, Peter.
You have an awesome product support. It is really worthy having invested in your framework. |
|