* `TimeScale.tickFormatFunction` was renamed to `TimeScale._tickFormatFunction`
* `TimeScale.getPixelForOffset` was renamed to `TimeScale._getPixelForOffset`
+#### Renamed private APIs
+
+* `helpers._alignPixel` was renamed to `helpers.canvas._alignPixel`
+
### Changed
#### Scales
return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
};
- /**
- * Returns the aligned pixel value to avoid anti-aliasing blur
- * @param {Chart} chart - The chart instance.
- * @param {number} pixel - A pixel value.
- * @param {number} width - The width of the element.
- * @returns {number} The aligned pixel value.
- * @private
- */
- helpers._alignPixel = function(chart, pixel, width) {
- var devicePixelRatio = chart.currentDevicePixelRatio;
- var halfWidth = width / 2;
- return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
- };
-
helpers.splineCurve = function(firstPoint, middlePoint, afterPoint, t) {
// Props to Rob Spencer at scaled innovation for his post on splining between points
// http://scaledinnovation.com/analytics/splines/aboutSplines.html
const helpers = require('../helpers/index');
const Ticks = require('./core.ticks');
+const alignPixel = helpers.canvas._alignPixel;
const isArray = helpers.isArray;
const isFinite = helpers.isFinite;
const isNullOrUndef = helpers.isNullOrUndef;
};
var axisWidth = gridLines.drawBorder ? resolve([gridLines.lineWidth, 0], context, 0) : 0;
var axisHalfWidth = axisWidth / 2;
- var alignPixel = helpers._alignPixel;
var alignBorderValue = function(pixel) {
return alignPixel(chart, pixel, axisWidth);
};
var ctx = me.ctx;
var chart = me.chart;
- var alignPixel = helpers._alignPixel;
var context = {
scale: me,
tick: me.ticks[0],
'use strict';
-var PI = Math.PI;
-var RAD_PER_DEG = PI / 180;
-var DOUBLE_PI = PI * 2;
-var HALF_PI = PI / 2;
-var QUARTER_PI = PI / 4;
-var TWO_THIRDS_PI = PI * 2 / 3;
+const PI = Math.PI;
+const RAD_PER_DEG = PI / 180;
+const DOUBLE_PI = PI * 2;
+const HALF_PI = PI / 2;
+const QUARTER_PI = PI / 4;
+const TWO_THIRDS_PI = PI * 2 / 3;
/**
* @namespace Chart.helpers.canvas
*/
-var exports = {
+module.exports = {
+ /**
+ * Returns the aligned pixel value to avoid anti-aliasing blur
+ * @param {Chart} chart - The chart instance.
+ * @param {number} pixel - A pixel value.
+ * @param {number} width - The width of the element.
+ * @returns {number} The aligned pixel value.
+ * @private
+ */
+ _alignPixel: function(chart, pixel, width) {
+ const devicePixelRatio = chart.currentDevicePixelRatio;
+ const halfWidth = width / 2;
+ return Math.round((pixel - halfWidth) * devicePixelRatio) / devicePixelRatio + halfWidth;
+ },
+
/**
* Clears the entire canvas associated to the given `chart`.
* @param {Chart} chart - The chart for which to clear the canvas.
target.y);
}
};
-
-module.exports = exports;