@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.
31 lines • 1.28 kB
JavaScript
import { Style } from '@nativescript-community/ui-canvas';
/**
* Created by wajdic on 15/06/2016.
* Created at Time 09:08
*/
export class CircleShapeRenderer {
renderShape(c, dataSet, viewPortHandler, posX, posY, renderPaint) {
const shapeSize = dataSet.scatterShapeSize;
const shapeHalf = shapeSize / 2;
const shapeHoleSizeHalf = dataSet.scatterShapeHoleRadius;
const shapeHoleSize = shapeHoleSizeHalf * 2;
const shapeStrokeSize = (shapeSize - shapeHoleSize) / 2;
const shapeStrokeSizeHalf = shapeStrokeSize / 2;
const shapeHoleColor = dataSet.scatterShapeHoleColor;
if (shapeSize > 0.0) {
renderPaint.setStyle(Style.STROKE);
renderPaint.setStrokeWidth(shapeStrokeSize);
c.drawCircle(posX, posY, shapeHoleSizeHalf + shapeStrokeSizeHalf, renderPaint);
if (shapeHoleColor) {
renderPaint.setStyle(Style.FILL);
renderPaint.setColor(shapeHoleColor);
c.drawCircle(posX, posY, shapeHoleSizeHalf, renderPaint);
}
}
else {
renderPaint.setStyle(Style.FILL);
c.drawCircle(posX, posY, shapeHalf, renderPaint);
}
}
}
//# sourceMappingURL=CircleShapeRenderer.js.map