From 0bc4cb546af5d1ce157ad701a45169cc07c9c839 Mon Sep 17 00:00:00 2001 From: Sanjay Rohila Date: Sun, 2 Oct 2016 20:58:50 +0530 Subject: [PATCH] [Feature Request] Provide option to set color and width for annotation line (#703) * Provide option to set color and width for annotation line * documentation for new annotation options --- docs/annotations.html | 2 ++ src/plugins/annotations.js | 3 ++- tests/annotation.html | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/annotations.html b/docs/annotations.html index 9ed49b1..7a0c1e3 100644 --- a/docs/annotations.html +++ b/docs/annotations.html @@ -194,6 +194,8 @@ g.ready(function() { heightHeight (in pixels) of the annotation flag or icon. cssClassCSS class to use for styling the annotation. tickHeightHeight of the tick mark (in pixels) connecting the point to its flag or icon. +tickWidthWidth of the tick mark connecting the point to its flag or icon. +tickColorColor of the tick mark connecting the point to its flag or icon. attachAtBottomIf true, attach annotations to the x-axis, rather than to actual points. clickHandler See Handlers, below mouseOverHandlerSee Handlers, below diff --git a/src/plugins/annotations.js b/src/plugins/annotations.js index 87153c8..f6dd68e 100644 --- a/src/plugins/annotations.js +++ b/src/plugins/annotations.js @@ -148,7 +148,8 @@ annotations.prototype.didDrawChart = function(e) { var ctx = e.drawingContext; ctx.save(); - ctx.strokeStyle = g.colorsMap_[p.name]; + ctx.strokeStyle = a.hasOwnProperty('tickColor') ? a.tickColor : g.colorsMap_[p.name]; + ctx.lineWidth = a.hasOwnProperty('tickWidth') ? a.tickWidth : g.getOption('strokeWidth'); ctx.beginPath(); if (!a.attachAtBottom) { ctx.moveTo(p.canvasx, p.canvasy); diff --git a/tests/annotation.html b/tests/annotation.html index 4cdcb10..002d4dd 100644 --- a/tests/annotation.html +++ b/tests/annotation.html @@ -93,6 +93,8 @@ width: 18, height: 23, tickHeight: 4, + tickColor: 'indianred', + tickWidth: 2, text: 'Another one', cssClass: 'annotation', clickHandler: function() { -- 2.7.4