]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Adds the ability to draw custom point styles 2031/head
authorMathias Küsel <mathiask@hotmail.de>
Sun, 7 Feb 2016 03:55:42 +0000 (04:55 +0100)
committerMathias Küsel <mathiask@hotmail.de>
Thu, 18 Feb 2016 21:03:20 +0000 (22:03 +0100)
src/elements/element.point.js

index b73e2bea8b6f9359d48611d5cd9c27f3d3589390..12d09f557c60ceea92fbf0442d19e8b1cdfd9b69 100644 (file)
@@ -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;