Function for translating a XY coordinate between different coordinate systems.
A coordinate system can be selected by a scale property of chart, or by specifying a pair of Axis.
// Example 1, translate from percentage location in chart, to pixel location in chart. constpixelLocation = translatePoint( // percentage location within chart, where [0,0] = bottom left, and [100,100] = top right. { x:10, y:10 }, chart.uiScale, chart.pixelScale )
// Example 2, translate axis coordinate to pixel location in chart. constpixelLocation = translatePoint( // axis coordinate. { x:116.9, y:26.4 }, { x:chart.getDefaultAxisX(), y:chart.getDefaultAxisY(), }, chart.pixelScale )
// NOTE: Translation from chart pixel coordinates to *document* is done using `engineLocation2Client` method. constpixelLocationDocument = chart.engine.engineLocation2Client(pixelLocation.x, pixelLocation.y) // `pixelLocationDocument` can now be used for absolute positioning HTML elements, or other such things...
Available chart coordinate systems:
Every LCJS chart class has two available coordinate systems:
uiScale | Percentage based coordinate system, where [0,0] = bottom left, and [100,100] = top right.
pixelScale | Pixel based coordinate system, where [0,0] = bottom left.
With ChartXY, axes can be also used (see example usage above).
Returns
Coordinate that corresponds value on target coordinate system.
Function for translating a
XY
coordinate between different coordinate systems.A coordinate system can be selected by a scale property of chart, or by specifying a pair of
Axis
.Available chart coordinate systems:
Every LCJS chart class has two available coordinate systems:
uiScale
| Percentage based coordinate system, where [0,0] = bottom left, and [100,100] = top right.pixelScale
| Pixel based coordinate system, where [0,0] = bottom left.With
ChartXY
, axes can be also used (see example usage above).Returns
Coordinate that corresponds
value
on target coordinate system.