Tooltip: add dataPoint and rename value to formattedValue (#7618)

* Tooltip: add dataPoint and rename value to formattedValue
* Add a test
This commit is contained in:
Ben McCann
2020-07-14 14:40:32 -07:00
committed by Evert Timberg
parent 766c3e9a51
commit 46b216003e
14 changed files with 67 additions and 18 deletions

View File

@@ -27,7 +27,7 @@
utils.srand(110);
function colorize(opaque, ctx) {
var v = ctx.dataset.data[ctx.dataIndex];
var v = ctx.dataPoint.y;
var c = v < -50 ? '#D60000'
: v < 0 ? '#F46300'
: v < 50 ? '#0358B6'

View File

@@ -40,7 +40,7 @@
}
function adjustRadiusBasedOnData(ctx) {
var v = ctx.dataset.data[ctx.dataIndex];
var v = ctx.dataPoint.y;
return v < 10 ? 5
: v < 25 ? 7
: v < 50 ? 9

View File

@@ -27,7 +27,7 @@
utils.srand(110);
function colorize(opaque, hover, ctx) {
var v = ctx.dataset.data[ctx.dataIndex];
var v = ctx.dataPoint;
var c = v < -50 ? '#D60000'
: v < 0 ? '#F46300'
: v < 50 ? '#0358B6'

View File

@@ -44,7 +44,7 @@
}
function adjustRadiusBasedOnData(ctx) {
var v = ctx.dataset.data[ctx.dataIndex];
var v = ctx.dataPoint.y;
return v < 10 ? 5
: v < 25 ? 7
: v < 50 ? 9