From: Mathias Küsel Date: Sun, 7 Feb 2016 03:55:42 +0000 (+0100) Subject: Adds the ability to draw custom point styles X-Git-Tag: v2.0.0~36^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2031%2Fhead;p=thirdparty%2FChart.js.git Adds the ability to draw custom point styles --- diff --git a/src/elements/element.point.js b/src/elements/element.point.js index b73e2bea8..12d09f557 100644 --- a/src/elements/element.point.js +++ b/src/elements/element.point.js @@ -55,6 +55,11 @@ module.exports = function(Chart) { return; } + if (typeof vm.pointStyle === 'object' && ((vm.pointStyle.toString() === '[object HTMLImageElement]') || (vm.pointStyle.toString() === '[object HTMLCanvasElement]'))) { + ctx.drawImage(vm.pointStyle, vm.x - vm.pointStyle.width / 2, vm.y - vm.pointStyle.height / 2); + return; + } + if (vm.radius > 0 || vm.borderWidth > 0) { ctx.strokeStyle = vm.borderColor || Chart.defaults.global.defaultColor;