From e758798798d65f27079be8369dff44730b3bf686 Mon Sep 17 00:00:00 2001 From: Simon Brunel Date: Thu, 24 Aug 2017 10:31:17 +0200 Subject: [PATCH] Fix scriptable options documentation snippet --- docs/general/options.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/general/options.md b/docs/general/options.md index 2fd59029e..e05cd33ee 100644 --- a/docs/general/options.md +++ b/docs/general/options.md @@ -8,8 +8,11 @@ Example: ```javascript color: function(context) { - return context.data < 0 ? 'red' : // draw negative values in red - index%2 ? 'blue' : 'green'; // else, alternate values in blue and green + var index = context.dataIndex; + var value = context.dataset.data[index]; + return value < 0 ? 'red' : // draw negative values in red + index % 2 ? 'blue' : // else, alternate values in blue and green + 'green'; } ```