scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
54 lines (53 loc) • 3.02 kB
TypeScript
import { NumberRange } from "../../../Core/NumberRange";
import { IndexCalculator, TSciChart } from "../../../types/TSciChart";
import { CoordinateCalculatorBase } from "./CoordinateCalculatorBase";
/**
* Provides an implementation of Flipped Index {@link CoordinateCalculatorBase | Coordinate Calculator} which transforms
* numeric data-values to pixel coordinates and vice versa using base values.
* @remarks
* SciChart's {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts} perform conversion operations between
* data-coordinates for all drawing and axis measurements.
*
* You can fetch a CoordinateCalculator instance by calling {@link AxisCore.getCurrentCoordinateCalculator}. This will return a unique calculator
* for the current draw pass.
*
* You can convert pixel to data-coordinates and back by using the following code:
* ```ts
* const axis: AxisCore;
* const calc = axis.getCurrentCoordinateCalculator();
*
* const pixel = calc.getCoordinate(1.23); // Gets the pixel coordinate for data-value 1.23
* const dataValue = cald.getDataValue(pixel); // Performs the inverse operation to get data-value
* ```
*
* Use the Coordinate calculators when drawing, placing markers, annotations or if you want to place a tooltip over the chart.
*/
export declare class FlippedIndexCoordinateCalculator extends CoordinateCalculatorBase {
private indexCalculator;
private indexRange;
private dimensionOverMaxMinusMin;
private minEdgeCoord;
/**
* Creates an instance of IndexCoordinateCalculator
* @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} or {@link TSciChart2D | SciChart 2D WebAssembly Context}
* @param indexCalculator The index calculator, it is used to set base values
* @param viewportDimension The size of the associated {@link AxisCore | Axis} at the time of drawing
* @param visibleMin The {@link AxisCore.visibleRange}.min at the time of drawing
* @param visibleMax The {@link AxisCore.visibleRange}.max at the time of drawing
* @param indexMin The minimal visible index
* @param indexMax The maximum visible index
* @param offset A constant pixel offset used in coordinate calculations
* @param viewportOffset
*/
constructor(webAssemblyContext: TSciChart, indexCalculator: IndexCalculator, viewportDimension: number, visibleMin: number, visibleMax: number, indexMin: number, indexMax: number, offset?: number, viewportOffset?: number);
/** @inheritDoc */
getCoordinate(dataValue: number): number;
/** @inheritDoc */
getDataValue(coordinate: number): number;
/** @inheritDoc */
translateBy(pixels: number, range: NumberRange): NumberRange;
transformIndexToData(index: number): number;
transformDataToIndex(dataValue: number): number;
/** @inheritDoc */
zoomTranslateBy(minFraction: number, maxFraction: number, inputRange: NumberRange): NumberRange;
}