UNPKG

@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.56 kB
import { Style } from '@nativescript-community/ui-canvas'; /** * Created by wajdic on 15/06/2016. * Created at Time 09:08 */ export class SquareShapeRenderer { 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 (shapeHoleSize > 0.0) { renderPaint.setStyle(Style.STROKE); renderPaint.setStrokeWidth(shapeStrokeSize); c.drawRect(posX - shapeHoleSizeHalf - shapeStrokeSizeHalf, posY - shapeHoleSizeHalf - shapeStrokeSizeHalf, posX + shapeHoleSizeHalf + shapeStrokeSizeHalf, posY + shapeHoleSizeHalf + shapeStrokeSizeHalf, renderPaint); if (shapeHoleColor && shapeHoleColor) { renderPaint.setStyle(Style.FILL); renderPaint.setColor(shapeHoleColor); c.drawRect(posX - shapeHoleSizeHalf, posY - shapeHoleSizeHalf, posX + shapeHoleSizeHalf, posY + shapeHoleSizeHalf, renderPaint); } } else { renderPaint.setStyle(Style.FILL); c.drawRect(posX - shapeHalf, posY - shapeHalf, posX + shapeHalf, posY + shapeHalf, renderPaint); } } } //# sourceMappingURL=SquareShapeRenderer.js.map