@nativescript-community/ui-chart
Version:
A powerful chart / graph plugin, supporting line, bar, pie, radar, bubble, and candlestick charts as well as scaling, panning and animations.
61 lines • 2.7 kB
JavaScript
import { ScatterShape } from '../charts/ScatterChart';
import { ChevronDownShapeRenderer } from '../renderer/scatter/ChevronDownShapeRenderer';
import { ChevronUpShapeRenderer } from '../renderer/scatter/ChevronUpShapeRenderer';
import { CircleShapeRenderer } from '../renderer/scatter/CircleShapeRenderer';
import { CrossShapeRenderer } from '../renderer/scatter/CrossShapeRenderer';
import { SquareShapeRenderer } from '../renderer/scatter/SquareShapeRenderer';
import { TriangleShapeRenderer } from '../renderer/scatter/TriangleShapeRenderer';
import { XShapeRenderer } from '../renderer/scatter/XShapeRenderer';
import { ColorTemplate } from '../utils/ColorTemplate';
import { LineScatterCandleRadarDataSet } from './LineScatterCandleRadarDataSet';
export class ScatterDataSet extends LineScatterCandleRadarDataSet {
/**
* Sets the ScatterShape this DataSet should be drawn with. This will search for an available IShapeRenderer and set this
* renderer for the DataSet.
*/
set scatterShape(shape) {
this.shapeRenderer = ScatterDataSet.getRendererForShape(shape);
}
constructor(yVals, label, xProperty, yProperty) {
super(yVals, label, xProperty, yProperty);
/**
* the size the scattershape will have, in density pixels
*/
this.scatterShapeSize = 15;
/**
* Renderer responsible for rendering this DataSet, default: square
*/
this.shapeRenderer = new SquareShapeRenderer();
/**
* The radius of the hole in the shape (applies to Square, Circle and Triangle)
* - default: 0.0
*/
this.scatterShapeHoleRadius = 0;
/**
* Color for the hole in the shape.
* Setting to `ColorTemplate.COLOR_NONE` will behave as transparent.
* - default: ColorTemplate.COLOR_NONE
*/
this.scatterShapeHoleColor = ColorTemplate.COLOR_NONE;
this.init();
}
static getRendererForShape(shape) {
switch (shape) {
case ScatterShape.SQUARE:
return new SquareShapeRenderer();
case ScatterShape.CIRCLE:
return new CircleShapeRenderer();
case ScatterShape.TRIANGLE:
return new TriangleShapeRenderer();
case ScatterShape.CROSS:
return new CrossShapeRenderer();
case ScatterShape.X:
return new XShapeRenderer();
case ScatterShape.CHEVRON_UP:
return new ChevronUpShapeRenderer();
case ScatterShape.CHEVRON_DOWN:
return new ChevronDownShapeRenderer();
}
}
}
//# sourceMappingURL=ScatterDataSet.js.map