@politicalwatch/tipi-uikit 1.7.11 → 1.7.14

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@politicalwatch/tipi-uikit",
3
- "version": "1.7.11",
3
+ "version": "1.7.14",
4
4
  "main": "src/components/index.js",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -406,15 +406,16 @@ class d3barchart extends d3chart {
406
406
  .attr('height', 0)
407
407
  .attr('width', 0)
408
408
  .on('mouseover', (d, i) => {
409
+ console.log('cfg in barchart', this.cfg);
409
410
  console.log('MOUSEOVER in barchart', d);
410
411
  const key = this.cfg.values[i % this.cfg.values.length];
411
412
  const label = this.cfg.tooltip.suffixPlural
412
- ? pluralize(this.cfg.tooltip.suffix, d.target.__data__[key])
413
+ ? pluralize(this.cfg.tooltip.suffix, d[key])
413
414
  : this.cfg.tooltip.suffix;
414
415
 
415
416
  const labelKey = this.cfg.keys[key];
416
417
 
417
- const percentage = this.calculatePercentage(d.target.__data__[key], totals[key]).toFixed(2);
418
+ const percentage = this.calculatePercentage(d[key], totals[key]).toFixed(2);
418
419
 
419
420
  const text = this.cfg.tooltip.suffix
420
421
  ? `<div>${labelKey}: ${percentage}% ${label}</div>`
@@ -189,7 +189,10 @@ class d3sunburst extends d3chart {
189
189
  const partition = (data) => {
190
190
  const root = d3
191
191
  .hierarchy(data)
192
- .sum((d) => d[this.cfg.value])
192
+ .sum((d) => {
193
+ console.log('d en binddata', d);
194
+ return d[this.cfg.value];
195
+ })
193
196
  .sort((a, b) => b.name - a.name);
194
197
  return d3.partition()(root);
195
198
  };
@@ -245,8 +248,8 @@ class d3sunburst extends d3chart {
245
248
  .enter()
246
249
  .append('g')
247
250
  .attr('class', 'chart__slice-group chart__slice-group--sunburst clickable')
248
- .on('click', (event, d) => {
249
- event.stopPropagation();
251
+ .on('click', (d) => {
252
+ window.event.stopPropagation();
250
253
  this.focusOn(d);
251
254
  });
252
255
 
@@ -256,8 +259,9 @@ class d3sunburst extends d3chart {
256
259
  .attr('class', 'chart__slice chart__slice--sunburst')
257
260
  .style('fill', (d) => this.colorElement(d.data))
258
261
  .on('mouseover', (d) => {
262
+ console.log('MOUSEOVER in sunburst', d);
259
263
  const label = this.cfg.tooltip.suffixPlural
260
- ? pluralize(this.cfg.tooltip.suffix, d.value)
264
+ ? pluralize(this.cfg.tooltip.suffix, d.target.__data__.data.value)
261
265
  : this.cfg.tooltip.suffix;
262
266
  const text = this.cfg.tooltip.suffix
263
267
  ? `<div>${d.target.__data__.data[this.cfg.key]}: ${d.target.__data__.data.value} ${label}</div>`
@@ -258,7 +258,6 @@ class d3wordscloud extends d3chart {
258
258
  .attr('fill', (d) => d.color)
259
259
  .attr('transform', (d) => `translate(${[d.x, d.y]})rotate(${d.rotate})`)
260
260
  .on('mouseover', (d) => {
261
- console.log('MOUSEOVER in wordscoud', d);
262
261
  const label = this.cfg.tooltip.suffixPlural
263
262
  ? pluralize(this.cfg.tooltip.suffix, d.target.__data__.value)
264
263
  : this.cfg.tooltip.suffix;