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.

51 lines 2.1 kB
import { Utils } from '../utils/Utils'; import { XAxisRenderer } from './XAxisRenderer'; export class XAxisRendererRadarChart extends XAxisRenderer { constructor(viewPortHandler, xAxis, chart) { super(viewPortHandler, xAxis, null); this.mForceLongestLabelComputation = true; this.mChart = chart; } renderAxisLabels(c) { const axis = this.xAxis; const chart = this.mChart; if (!axis.enabled || !axis.drawLabels) return; const customRender = axis.customRenderer; const customRenderFunction = customRender && customRender.drawLabel; const labelRotationAngleDegrees = axis.labelRotationAngle; const drawLabelAnchor = { x: 0.5, y: 0.25 }; const paint = this.axisLabelsPaint; paint.setFont(axis.typeface); paint.setTextAlign(axis.labelTextAlign); paint.setColor(axis.textColor); const sliceangle = chart.sliceAngle; // calculate the factor that is needed for transforming the value to // pixels const factor = chart.factor; const center = chart.centerOffsets; const pOut = { x: 0, y: 0 }; const labels = axis.mLabels; for (let i = 0; i < chart.data.maxEntryCountSet.entryCount; i++) { const label = labels[i]; if (!label) { continue; } const angle = (sliceangle * i + chart.rotationAngle) % 360; Utils.getPosition(center, chart.yRange * factor + axis.mLabelRotatedWidth / 2, angle, pOut); this.drawLabel(c, label, pOut.x, pOut.y - axis.mLabelRotatedHeight / 2, drawLabelAnchor, labelRotationAngleDegrees, paint, customRenderFunction); } // MPPointF.recycleInstance(center); // MPPointF.recycleInstance(pOut); // MPPointF.recycleInstance(drawLabelAnchor); } /** * XAxis LimitLines on RadarChart not yet supported. * * @param c */ renderLimitLines(c) { // this space intentionally left blank } } //# sourceMappingURL=XAxisRendererRadarChart.js.map