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.

33 lines 1.15 kB
export class PieRadarHighlighter { constructor(chart) { /** * buffer for storing previously highlighted values */ this.mHighlightBuffer = []; this.mChart = chart; } getHighlightsAtXValue(xVal, x, y) { // not implemented return null; } getHighlight(x, y) { const touchDistanceToCenter = this.mChart.distanceToCenter(x, y); // Check if a slice was touched if (touchDistanceToCenter > this.mChart.radius) { // if no slice was touched, highlight nothing return null; } let angle = this.mChart.getAngleForPoint(x, y); // detect PieChart while preventing circular dep if (!this.mChart['mCircleBox']) { angle /= this.mChart.animator.phaseY; } const index = this.mChart.getIndexForAngle(angle); // check if the index could be found if (index < 0 || index >= this.mChart.data.maxEntryCountSet.entryCount) { return null; } return [this.getClosestHighlight(index, x, y)]; } } //# sourceMappingURL=PieRadarHighlighter.js.map