@politicalwatch/tipi-uikit 1.7.10 → 1.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -409,12 +409,12 @@ class d3barchart extends d3chart {
|
|
|
409
409
|
console.log('MOUSEOVER in barchart', d);
|
|
410
410
|
const key = this.cfg.values[i % this.cfg.values.length];
|
|
411
411
|
const label = this.cfg.tooltip.suffixPlural
|
|
412
|
-
? pluralize(this.cfg.tooltip.suffix, d[key])
|
|
412
|
+
? pluralize(this.cfg.tooltip.suffix, d.target.__data__[key])
|
|
413
413
|
: this.cfg.tooltip.suffix;
|
|
414
414
|
|
|
415
415
|
const labelKey = this.cfg.keys[key];
|
|
416
416
|
|
|
417
|
-
const percentage = this.calculatePercentage(d[key], totals[key]).toFixed(2);
|
|
417
|
+
const percentage = this.calculatePercentage(d.target.__data__[key], totals[key]).toFixed(2);
|
|
418
418
|
|
|
419
419
|
const text = this.cfg.tooltip.suffix
|
|
420
420
|
? `<div>${labelKey}: ${percentage}% ${label}</div>`
|
|
@@ -424,10 +424,10 @@ class d3barchart extends d3chart {
|
|
|
424
424
|
.on('mouseout', () => {
|
|
425
425
|
this.tooltip.classed('active', false);
|
|
426
426
|
})
|
|
427
|
-
.on('mousemove', () => {
|
|
427
|
+
.on('mousemove', (event) => {
|
|
428
428
|
this.tooltip
|
|
429
|
-
.style('left',
|
|
430
|
-
.style('top',
|
|
429
|
+
.style('left', event['pageX'] - 28 + 'px')
|
|
430
|
+
.style('top', event['pageY'] - 40 + 'px');
|
|
431
431
|
});
|
|
432
432
|
}
|
|
433
433
|
|
|
@@ -260,20 +260,20 @@ class d3wordscloud extends d3chart {
|
|
|
260
260
|
.on('mouseover', (d) => {
|
|
261
261
|
console.log('MOUSEOVER in wordscoud', d);
|
|
262
262
|
const label = this.cfg.tooltip.suffixPlural
|
|
263
|
-
? pluralize(this.cfg.tooltip.suffix, d.value)
|
|
263
|
+
? pluralize(this.cfg.tooltip.suffix, d.target.__data__.value)
|
|
264
264
|
: this.cfg.tooltip.suffix;
|
|
265
265
|
const text = this.cfg.tooltip.suffix
|
|
266
|
-
? `<div>${d.text}: ${d.value} ${label}</div>`
|
|
267
|
-
: `<div>${d.text}: ${d.value}</div>`;
|
|
266
|
+
? `<div>${d.target.__data__.text}: ${d.target.__data__.value} ${label}</div>`
|
|
267
|
+
: `<div>${d.target.__data__.text}: ${d.target.__data__.value}</div>`;
|
|
268
268
|
this.tooltip.html(text).classed('active', true);
|
|
269
269
|
})
|
|
270
270
|
.on('mouseout', () => {
|
|
271
271
|
this.tooltip.classed('active', false);
|
|
272
272
|
})
|
|
273
|
-
.on('mousemove', () => {
|
|
273
|
+
.on('mousemove', (event) => {
|
|
274
274
|
this.tooltip
|
|
275
|
-
.style('left',
|
|
276
|
-
.style('top',
|
|
275
|
+
.style('left', event['pageX'] - 28 + 'px')
|
|
276
|
+
.style('top', event['pageY'] - 40 + 'px');
|
|
277
277
|
})
|
|
278
278
|
.text((d) => d.text);
|
|
279
279
|
}
|