Skip to content

Commit 1d499a0

Browse files
committed
Rename variables
1 parent 6de0bdf commit 1d499a0

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

docs/docs/configuration/tooltip.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ var chart = new Chart(ctx, {
140140
if (label) {
141141
label += ': ';
142142
}
143-
if (!isNaN(context.dataPoint.y)) {
144-
label += new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(context.dataPoint.y);
143+
if (!isNaN(context.parsed.y)) {
144+
label += new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(context.parsed.y);
145145
}
146146
return label;
147147
}
@@ -220,7 +220,10 @@ The tooltip items passed to the tooltip callbacks implement the following interf
220220
label: string,
221221

222222
// Parsed data values for the given `dataIndex` and `datasetIndex`
223-
dataPoint: object,
223+
parsed: object,
224+
225+
// Raw data values for the given `dataIndex` and `datasetIndex`
226+
raw: object,
224227

225228
// Formatted value for the tooltip
226229
formattedValue: string,

docs/docs/general/options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ In addition to [dataset](#dataset)
7272

7373
- `active`: true if element is active (hovered)
7474
- `dataIndex`: index of the current data
75-
- `dataPoint`: the parsed data values for the given `dataIndex` and `datasetIndex`
76-
- `rawPoint`: the raw data values for the given `dataIndex` and `datasetIndex`
75+
- `parsed`: the parsed data values for the given `dataIndex` and `datasetIndex`
76+
- `raw`: the raw data values for the given `dataIndex` and `datasetIndex`
7777
- `element`: the element (point, arc, bar, etc.) for this data
7878
- `index`: getter for `dataIndex`
7979
- `type`: `'data'`

samples/scriptable/bubble.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
}
3434

3535
function colorize(opaque, context) {
36-
var value = context.rawPoint;
36+
var value = context.raw;
3737
var x = value.x / 100;
3838
var y = value.y / 100;
3939
var r = channelValue(x, y, [250, 150, 50, 0]);
@@ -90,12 +90,12 @@
9090
},
9191

9292
hoverBorderWidth: function(context) {
93-
return Math.round(8 * context.rawPoint.v / 1000);
93+
return Math.round(8 * context.raw.v / 1000);
9494
},
9595

9696
radius: function(context) {
9797
var size = context.chart.width;
98-
var base = Math.abs(context.rawPoint.v) / 1000;
98+
var base = Math.abs(context.raw.v) / 1000;
9999
return (size / 24) * base;
100100
}
101101
}

samples/scriptable/polar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
utils.srand(110);
2727

2828
function colorize(opaque, hover, ctx) {
29-
var v = ctx.rawPoint;
29+
var v = ctx.raw;
3030
var c = v < 35 ? '#D60000'
3131
: v < 55 ? '#F46300'
3232
: v < 75 ? '#0358B6'

src/core/core.datasetController.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function createDatasetContext(parent, index, dataset) {
171171
});
172172
}
173173

174-
function createDataContext(parent, index, point, rawPoint, element) {
174+
function createDataContext(parent, index, point, raw, element) {
175175
return Object.create(parent, {
176176
active: {
177177
writable: true,
@@ -180,11 +180,11 @@ function createDataContext(parent, index, point, rawPoint, element) {
180180
dataIndex: {
181181
value: index
182182
},
183-
dataPoint: {
183+
parsed: {
184184
value: point
185185
},
186-
rawPoint: {
187-
value: rawPoint
186+
raw: {
187+
value: raw
188188
},
189189
element: {
190190
value: element

src/plugins/plugin.tooltip.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ function createTooltipItem(chart, item) {
122122
return {
123123
chart,
124124
label,
125-
dataPoint: controller.getParsed(index),
125+
parsed: controller.getParsed(index),
126+
raw: chart.data.datasets[datasetIndex].data[index],
126127
formattedValue: value,
127128
dataset: controller.getDataset(),
128129
dataIndex: index,

test/specs/plugin.tooltip.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ describe('Plugin.Tooltip', function() {
506506
mode: 'index',
507507
callbacks: {
508508
beforeLabel: function(ctx) {
509-
return ctx.dataPoint.x + ',' + ctx.dataPoint.y;
509+
return ctx.parsed.x + ',' + ctx.parsed.y;
510510
}
511511
}
512512
}

0 commit comments

Comments
 (0)