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

Message ListMessage List     Post MessagePost Message

  Tooltip on mouse move event over a chart
Posted by yogesh.sherekar on Feb-11-2015 12:07
I have used chartdirector to show linelayers i.e. XY chart in VB6. I want to show tool tip on mousemove event, By seeing previous post, I used following methodology to show tooltip

xPixel = ScaleX(x, ScaleMode, vbPixels)
yPixel = ScaleY(y, ScaleMode, vbPixels)
xValue = (xPixel - leftXpossition) / plotWidth* (maxX1 - minX1)
yvalue = (HeightUptoBottom- yPixel) / plotHeight* (maxY1 - minY1)

above calculation shows correct x,y position if MaxX1 i.e. lower range starts with zero
but shows some offset in the result if lower range is other than zero.

Is there any setting needs to be performed prior using of this calculation.
I have set scale mode as Pixel only.

  Re: Tooltip on mouse move event over a chart
Posted by Peter Kwan on Feb-12-2015 02:39
Hi yogesh,

I think the code for the xValue should be:

xValue = (xPixel - leftX) / plotWidth * (maxX1 - minX1) + minX1

where leftX is the x-pixel coordinate of the position x = minX1, and plotWidth is the pixel
length of the range x = maxX1 to x = minX1. They can be obtained from ChartDirector as:


minX1 = c.xAxis().getMinValue()
maxX1 = c.xAxis().getMaxValue()
leftX = c.getXCoor(minX1)
plotWidth = c.getXCoor(maxX1) - leftX


Hope this can help.

Regards
Peter Kwan

  Re: Tooltip on mouse move event over a chart
Posted by yogesh.sherekar on Feb-12-2015 16:59
Thank for your input. X value is updating correctly on tooltip.
Please provide the input on y values.

  Re: Tooltip on mouse move event over a chart
Posted by Peter Kwan on Feb-12-2015 22:54
Hi

I would expect the formula for the y value is exactly the same, as the formula is just a
standard linear interpolation formula found in mathematics textbooks, and should apply to all
linear systems (I assume your y-axis is linear, not logarithmic). The only differences are the
"names". For example, instead of xValue, you may change the name of the variable to
yValue. Instead of getXCoor, you may use getYCoor, Intead of "xAxis()", you may use
"yAxis()", etc..


minY1 = c.yAxis().getMinValue()
maxY1 = c.yAxis().getMaxValue()
bottomY = c.getYCoor(minY1)
plotHeight = c.getYCoor(maxY1) - topY

yValue = (yPixel - bottomY) / plotHeight * (maxY1 - minY1) + minY1


Hope this can help.

Regards
Peter Kwan