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

Message ListMessage List     Post MessagePost Message

  tooltip in crosssection
Posted by jean-michel on Mar-23-2022 18:34
Attachments:
hello,
i was trying to add tooltip on crosssection of contourcrosssectiondlg example.
i have modified drawCrossSectionX function by adding:
const char *pt = c->getHTMLImageMap("", "",
"title='<*cdml*><*font=Arial Bold*>X={x|2}nY={y|2}'");
viewer->setImageMap(pt);

A tooltip appeared and display the x value but not the y value . In fact
Y={y|2} is displayed (see tooltip.png).
What is the trick to have the correct display ?

Best regards
jean-michel

void CContourCrossSectionDlg::drawCrossSectionX(CChartViewer* viewer)
{
// Get data of the vertical cross section data at the given x coordinate
XYChart* mainChart = (XYChart*)m_ChartViewer.getChart();
PlotArea* p = mainChart->getPlotArea();
DoubleArray z = m_ContourLayer->getCrossSection(m_crossHairX, p->getBottomY(), m_crossHairX,
p->getTopY());

// Create XYChat of the same height as the main chart. Align the plot area with that of the
// main chart.
XYChart* c = new XYChart(100, mainChart->getHeight());
c->setPlotArea(10, p->getTopY(), c->getWidth() - 22, p->getHeight(), -1, -1, -1,
c->dashLineColor((int)0xaf000000, Chart::DotLine), -1);

// The vertical chart will have the x-axis vertical and y-axis horizontal. Synchroinze the
// vertical axis (x-axis) with the y-axis of the main chart. Synchroinze the horizontal
// axis (y-axis) with the color axis.
c->swapXY();
c->xAxis()->syncAxis(mainChart->yAxis());
c->yAxis()->syncScale(m_ContourLayer->colorAxis());

// The vertical axis (x-axis) does not need labels as it is aligned with the main chart y-axis.
c->xAxis()->setLabelStyle("normal", 8, Chart::Transparent);

// Rotate the horizontal axis (y-axis) labels by 270 degrees
c->yAxis()->setLabelStyle("normal", 8, Chart::TextColor, 270);

// Add an area layer using the cross section data and the color scale of the color axis.
int scaleColor = c->yScaleColor(m_ContourLayer->colorAxis()->getColorScale());
AreaLayer* layer = c->addAreaLayer(z, scaleColor);
layer->setBorderColor(Chart::SameAsMainColor);
layer->setXData(mainChart->getYValue(p->getBottomY()), mainChart->getYValue(p->getTopY()));


// Display the chart
delete viewer->getChart();
viewer->setChart(c);

const char *pt = c->getHTMLImageMap("", "",
"title='<*cdml*><*font=Arial Bold*>X={x|2}nY={y|2}'");
viewer->setImageMap(pt);
}
tooltip.png

  Re: tooltip in crosssection
Posted by Peter Kwan on Mar-23-2022 21:33
Hi Jean,

The cross section chart is an area chart. Instead of {y|2}, please try {value|2}.

The available parameters for the various chart types are described in:

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

Hope this can help.

Regards
Peter Kwan

  Re: tooltip in crosssection
Posted by jean-michel on Mar-24-2022 02:03
Attachments:
Hello,
thank you, it works!

I 've modified contour plot zoom/scroll example to add
2 contours layers in a MultiChart and 4 crossections and a big bunch of data
to display.

Unfortunatly execution make an access violation in chartdirector.dll when
mouse cursor come over one of the 2 contourlayer. It seems to be the contourlayer
tooltip this time.

Tooltip is initialised in line 1105 of ContourZoomScrollDlgMultiChart.cpp
i just modified the call to MultiChart->getHTMLImageMap as contour
layers are inside a multichart

it seems that the call to function getHotSpot in ChartViewer.cpp @ 417 trig this event.

The rar file contains the different sources and resource i have modified, normaly it should compile.

hope you can answer for this problem.

best regards jean-michel
ChartDirector.rar
ChartDirector.rar

102.59 Kb
    
Crash.png

  Re: tooltip in crosssection
Posted by Peter Kwan on Mar-24-2022 15:38
Hi Jean-Michel,

I confirm it is a bug in ChartDirector. For contour or surface charts that have tooltips and are placed inside a MultiChart, it will crash when attempting to display the tooltip.

We will issue a patch as soon as possible (possibly within 24 hours).

Regards
Peter Kwan

  Re: tooltip in crosssection
Posted by jean-michel on Mar-24-2022 16:22
thank you very much peter.

  Re: tooltip in crosssection
Posted by Peter Kwan on Mar-25-2022 03:15
Hi jean-michel,

The following file contains the updated DLLs for Windows 32-bit and 64-bit. Please use them to replace the DLLs in the ChartDirector download. This should solve the problem.

https://www.advsofteng.com/support/cdcppwin700p2.zip

Regards
Peter Kwan

  Re: tooltip in crosssection
Posted by jean-michel on Mar-25-2022 21:07
Attachments:
Hello Peter,
thnaks you very much it works perfectly.

i' ve got a last little problem.
when i use the zoom with the mouse. If i choose a point in the chart
and turn the mouse wheel with the mouse cursor of it.
The display is zoomed but the point which is the reference point of the zoom shift.
I think it comes from the fact that i use a multichart and not a single chart
for the display.
In the attached graphics , you can see the zoom effect and the fact that the
drawing has shifted despite the fact that the mouse did'nt move. I just turned the
mouse wheel. (shifting is only on vertical axis not horizontal)
I think the modification must be done in the ChartViewer in OnMouseWheel function
but i have no idea.

Best regards
Jean-michel
BeforeZoom.png
AfterZoom.png

  Re: tooltip in crosssection
Posted by Peter Kwan on Mar-26-2022 01:23
Hi jean-michel,

For a MultiChart, if the charts inside are vertically stacked, only the shared x-axis is "pinned" when zooming. It is because the y-axis of the charts do not overlap, and they can be of different lengths and different scales, so they are not pinned.

For your case, I think an alternative method is to use two separate CChartViewer controls for the two charts, instead of using a MultiChart. If you want them to zoom synchronously, you can update both charts whenever one of the charts is zoomed or panned. It is like:

- When the OnViewPortChanged event is fired in one of the CChartViewers, copy the viewport positions to the other CChartViewer "if necessary" (see below), and call CChartViewer.updateViewPort on the other CChartViewer to update the other chart too.

If both CChartViewer updates each other, it will become an infinite loop. To break the loop, a CChartViewer can check if the other CChartViewer has already had the same viewport positions. If this is the case, the other CChartViewer must be the source of the update, so the current CChartViewer only needs to update the its own chart. It does not need to update the other CChartViewer or other controls shared by the CChartViewers (eg. the scrollbars). The source CChartViewer should be responsible to update other controls.

Regards
Peter Kwan

  Re: tooltip in crosssection
Posted by jean-michel on Mar-28-2022 16:15
Ok thank you very much peter.
i'm gonna try this.

regards jean-michel