From 006f8f42618ad4c4e7712f68c28a744dbbd6431f Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Thu, 27 Aug 2020 15:28:45 +0530 Subject: [PATCH 01/17] Alternate way of avoiding infinite recursion while brush and zoom operations --- src/base/coordinate-grid-mixin.js | 69 ++++++++++++++++++------------- src/charts/scatter-plot.js | 31 ++++---------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/base/coordinate-grid-mixin.js b/src/base/coordinate-grid-mixin.js index bb0617553..5db27cb51 100644 --- a/src/base/coordinate-grid-mixin.js +++ b/src/base/coordinate-grid-mixin.js @@ -67,6 +67,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { this._brushOn = true; this._parentBrushOn = false; this._round = undefined; + this._ignoreBrushEvents = false; // ignore when carrying out programmatic brush operations this._renderHorizontalGridLine = false; this._renderVerticalGridLine = false; @@ -80,6 +81,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { this._zoom = zoom().on('zoom', () => this._onZoom()); this._nullZoom = zoom().on('zoom', null); this._hasBeenMouseZoomable = false; + this._ignoreZoomEvents = false; // ignore when carrying out programmatic zoom operations this._rangeChart = undefined; this._focusChart = undefined; @@ -973,17 +975,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { } _brushing () { - // Avoids infinite recursion (mutual recursion between range and focus operations) - // Source Event will be null when brush.move is called programmatically (see below as well). - if (!event.sourceEvent) { - return; - } - - // Ignore event if recursive event - i.e. not directly generated by user action (like mouse/touch etc.) - // In this case we are more worried about this handler causing brush move programmatically which will - // cause this handler to be invoked again with a new d3.event (and current event set as sourceEvent) - // This check avoids recursive calls - if (event.sourceEvent.type && ['start', 'brush', 'end'].indexOf(event.sourceEvent.type) !== -1) { + if (this._ignoreBrushEvents) { return; } @@ -1009,9 +1001,22 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { this.redrawGroup(); } + _withoutBrushEvents (closure) { + const oldValue = this._ignoreBrushEvents; + this._ignoreBrushEvents = true; + + try { + closure(); + } finally { + this._ignoreBrushEvents = oldValue; + } + } + setBrushExtents (doTransition) { - // Set boundaries of the brush, must set it before applying to self._gBrush - this._brush.extent([[0, 0], [this.effectiveWidth(), this.effectiveHeight()]]); + this._withoutBrushEvents(() => { + // Set boundaries of the brush, must set it before applying to self._gBrush + this._brush.extent([[0, 0], [this.effectiveWidth(), this.effectiveHeight()]]); + }); this._gBrush .call(this._brush); @@ -1024,8 +1029,10 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { } if (!brushSelection) { - this._gBrush - .call(this._brush.move, null); + this._withoutBrushEvents(() => { + this._gBrush + .call(this._brush.move, null); + }) this._gBrush.selectAll(`path.${CUSTOM_BRUSH_HANDLE_CLASS}`) .attr('display', 'none'); @@ -1035,8 +1042,10 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { const gBrush = optionalTransition(doTransition, this.transitionDuration(), this.transitionDelay())(this._gBrush); - gBrush - .call(this._brush.move, scaledSelection); + this._withoutBrushEvents(() => { + gBrush + .call(this._brush.move, scaledSelection); + }); gBrush.selectAll(`path.${CUSTOM_BRUSH_HANDLE_CLASS}`) .attr('display', null) @@ -1235,22 +1244,26 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { // If we changing zoom status (for example by calling focus), tell D3 zoom about it _updateD3zoomTransform () { if (this._zoom) { - this._zoom.transform(this.root(), this._domainToZoomTransform(this.x().domain(), this._xOriginalDomain, this._origX)); + this._withoutZoomEvents(() => { + this._zoom.transform(this.root(), this._domainToZoomTransform(this.x().domain(), this._xOriginalDomain, this._origX)); + }); } } - _onZoom () { - // Avoids infinite recursion (mutual recursion between range and focus operations) - // Source Event will be null when zoom is called programmatically (see below as well). - if (!event.sourceEvent) { - return; + _withoutZoomEvents (closure) { + const oldValue = this._ignoreZoomEvents; + this._ignoreZoomEvents = true; + + try { + closure(); + } finally { + this._ignoreZoomEvents = oldValue; } + } - // Ignore event if recursive event - i.e. not directly generated by user action (like mouse/touch etc.) - // In this case we are more worried about this handler causing zoom programmatically which will - // cause this handler to be invoked again with a new d3.event (and current event set as sourceEvent) - // This check avoids recursive calls - if (event.sourceEvent.type && ['start', 'zoom', 'end'].indexOf(event.sourceEvent.type) !== -1) { + _onZoom () { + // ignore zoom events if it was caused by a programmatic change + if (this._ignoreZoomEvents) { return; } diff --git a/src/charts/scatter-plot.js b/src/charts/scatter-plot.js index cfc5d4cac..65129e691 100644 --- a/src/charts/scatter-plot.js +++ b/src/charts/scatter-plot.js @@ -585,17 +585,7 @@ export class ScatterPlot extends CoordinateGridMixin { } _brushing () { - // Avoids infinite recursion (mutual recursion between range and focus operations) - // Source Event will be null when brush.move is called programmatically (see below as well). - if (!event.sourceEvent) { - return; - } - - // Ignore event if recursive event - i.e. not directly generated by user action (like mouse/touch etc.) - // In this case we are more worried about this handler causing brush move programmatically which will - // cause this handler to be invoked again with a new d3.event (and current event set as sourceEvent) - // This check avoids recursive calls - if (event.sourceEvent.type && ['start', 'brush', 'end'].indexOf(event.sourceEvent.type) !== -1) { + if (this._ignoreBrushEvents) { return; } @@ -628,7 +618,6 @@ export class ScatterPlot extends CoordinateGridMixin { redrawBrush (brushSelection, doTransition) { // override default x axis brush from parent chart - this._brush = this.brush(); this._gBrush = this.gBrush(); if (this.brushOn() && this._gBrush) { @@ -637,9 +626,10 @@ export class ScatterPlot extends CoordinateGridMixin { } if (!brushSelection) { - this._gBrush - .call(this._brush.move, brushSelection); - + this._withoutBrushEvents(() => { + this._gBrush + .call(this.brush().move, brushSelection); + }); } else { brushSelection = brushSelection.map(point => point.map((coord, i) => { const scale = i === 0 ? this.x() : this.y(); @@ -649,18 +639,15 @@ export class ScatterPlot extends CoordinateGridMixin { const gBrush = optionalTransition(doTransition, this.transitionDuration(), this.transitionDelay())(this._gBrush); - gBrush - .call(this._brush.move, brushSelection); - + this._withoutBrushEvents(() => { + gBrush + .call(this.brush().move, brushSelection); + }); } } this.fadeDeselectedArea(brushSelection); } - - setBrushY (gBrush) { - gBrush.call(this.brush().y(this.y())); - } } export const scatterPlot = (parent, chartGroup) => new ScatterPlot(parent, chartGroup); From 81d38cd338da1621c49583b27e567d62899468a4 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Thu, 27 Aug 2020 17:04:25 +0530 Subject: [PATCH 02/17] d3@v6 compatible brush/zoom event handlers --- src/base/coordinate-grid-mixin.js | 22 ++++++++++++++++------ src/charts/scatter-plot.js | 9 +++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/base/coordinate-grid-mixin.js b/src/base/coordinate-grid-mixin.js index 5db27cb51..5550091d8 100644 --- a/src/base/coordinate-grid-mixin.js +++ b/src/base/coordinate-grid-mixin.js @@ -78,7 +78,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { this._zoomScale = [1, Infinity]; this._zoomOutRestrict = true; - this._zoom = zoom().on('zoom', () => this._onZoom()); + this._zoom = zoom().on('zoom', evt => this._onZoom(evt)); this._nullZoom = zoom().on('zoom', null); this._hasBeenMouseZoomable = false; this._ignoreZoomEvents = false; // ignore when carrying out programmatic zoom operations @@ -934,7 +934,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { renderBrush (g, doTransition) { if (this._brushOn) { - this._brush.on('start brush end', () => this._brushing()); + this._brush.on('start brush end', evt => this._brushing(evt)); // To retrieve selection we need self._gBrush this._gBrush = g.append('g') @@ -974,12 +974,17 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { return !brushSelection || brushSelection[1] <= brushSelection[0]; } - _brushing () { + _brushing (evt) { if (this._ignoreBrushEvents) { return; } - let brushSelection = event.selection; + // d3@v5 compatibility + if (event) { + evt = event; + } + + let brushSelection = evt.selection; if (brushSelection) { brushSelection = brushSelection.map(this.x().invert); } @@ -1261,13 +1266,18 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { } } - _onZoom () { + _onZoom (evt) { // ignore zoom events if it was caused by a programmatic change if (this._ignoreZoomEvents) { return; } - const newDomain = event.transform.rescaleX(this._origX).domain(); + // d3@v5 compatibility + if (event) { + evt = event; + } + + const newDomain = evt.transform.rescaleX(this._origX).domain(); this.focus(newDomain, false); } diff --git a/src/charts/scatter-plot.js b/src/charts/scatter-plot.js index 65129e691..ca0f38c77 100644 --- a/src/charts/scatter-plot.js +++ b/src/charts/scatter-plot.js @@ -584,12 +584,17 @@ export class ScatterPlot extends CoordinateGridMixin { return !brushSelection || brushSelection[0][0] >= brushSelection[1][0] || brushSelection[0][1] >= brushSelection[1][1]; } - _brushing () { + _brushing (evt) { if (this._ignoreBrushEvents) { return; } - let brushSelection = event.selection; + // d3@v5 compatibility + if (event) { + evt = event; + } + + let brushSelection = evt.selection; // Testing with pixels is more reliable let brushIsEmpty = this.brushIsEmpty(brushSelection); From a92f2cc09b4f31529a8bc48a3562d3e4f9355ca8 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Thu, 27 Aug 2020 21:22:03 +0530 Subject: [PATCH 03/17] Make event handlers compatible with both d3@v5 and d3@v6 - mechanical conversion --- src/base/bubble-mixin.js | 3 ++- src/charts/bar-chart.js | 6 +++--- src/charts/box-plot.js | 6 +++--- src/charts/bubble-chart.js | 3 ++- src/charts/bubble-overlay.js | 4 ++-- src/charts/geo-choropleth-chart.js | 4 ++-- src/charts/heatmap.js | 7 ++++--- src/charts/html-legend.js | 8 ++++---- src/charts/legend.js | 14 +++++++------- src/charts/row-chart.js | 11 ++++++----- src/charts/sunburst-chart.js | 8 ++++---- src/core/utils.js | 12 ++++++++++++ 12 files changed, 51 insertions(+), 35 deletions(-) diff --git a/src/base/bubble-mixin.js b/src/base/bubble-mixin.js index 7576b694b..9f43437c6 100644 --- a/src/base/bubble-mixin.js +++ b/src/base/bubble-mixin.js @@ -4,6 +4,7 @@ import { scaleLinear } from 'd3-scale'; import {ColorMixin} from './color-mixin'; import {transition} from '../core/core'; import {events} from '../core/events'; +import {cpt} from '../core/utils'; /** * This Mixin provides reusable functionalities for any chart that needs to visualize data using bubbles. @@ -149,7 +150,7 @@ export const BubbleMixin = Base => class extends ColorMixin(Base) { label = bubbleGEnter.append('text') .attr('text-anchor', 'middle') .attr('dy', '.3em') - .on('click', d => this.onClick(d)); + .on('click', cpt(d => this.onClick(d))); } label diff --git a/src/charts/bar-chart.js b/src/charts/bar-chart.js index 5ce8f3678..3fe478600 100644 --- a/src/charts/bar-chart.js +++ b/src/charts/bar-chart.js @@ -4,7 +4,7 @@ import {StackMixin} from '../base/stack-mixin'; import {transition} from '../core/core'; import {constants} from '../core/constants'; import {logger} from '../core/logger'; -import {pluck, utils} from '../core/utils'; +import {cpt, pluck, utils} from '../core/utils'; const MIN_BAR_WIDTH = 1; const DEFAULT_GAP_BETWEEN_BARS = 2; @@ -144,7 +144,7 @@ export class BarChart extends StackMixin { .merge(labels); if (this.isOrdinal()) { - labelsEnterUpdate.on('click', d => this.onClick(d)); + labelsEnterUpdate.on('click', cpt(d => this.onClick(d))); labelsEnterUpdate.attr('cursor', 'pointer'); } @@ -188,7 +188,7 @@ export class BarChart extends StackMixin { } if (this.isOrdinal()) { - barsEnterUpdate.on('click', d => this.onClick(d)); + barsEnterUpdate.on('click', cpt(d => this.onClick(d))); } transition(barsEnterUpdate, this.transitionDuration(), this.transitionDelay()) diff --git a/src/charts/box-plot.js b/src/charts/box-plot.js index 0cf4775f3..f57eebbee 100644 --- a/src/charts/box-plot.js +++ b/src/charts/box-plot.js @@ -6,7 +6,7 @@ import {d3Box} from '../base/d3.box' import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; import {units} from '../core/units'; -import {utils} from '../core/utils'; +import {cpt, utils} from '../core/utils'; // Returns a function to compute the interquartile range. function defaultWhiskersIQR (k) { @@ -196,10 +196,10 @@ export class BoxPlot extends CoordinateGridMixin { .attr('class', 'box') .attr('transform', (d, i) => this._boxTransform(d, i)) .call(this._box) - .on('click', d => { + .on('click', cpt(d => { this.filter(this.keyAccessor()(d)); this.redrawGroup(); - }); + })); return boxesGEnter.merge(boxesG); } diff --git a/src/charts/bubble-chart.js b/src/charts/bubble-chart.js index 71c6f30db..57c40016e 100644 --- a/src/charts/bubble-chart.js +++ b/src/charts/bubble-chart.js @@ -1,6 +1,7 @@ import {BubbleMixin} from '../base/bubble-mixin'; import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; +import {cpt} from '../core/utils'; /** * A concrete implementation of a general purpose bubble chart that allows data visualization using the @@ -73,7 +74,7 @@ export class BubbleChart extends BubbleMixin(CoordinateGridMixin) { .attr('class', this.BUBBLE_NODE_CLASS) .attr('transform', d => this._bubbleLocator(d)) .append('circle').attr('class', (d, i) => `${this.BUBBLE_CLASS} _${i}`) - .on('click', d => this.onClick(d)) + .on('click', cpt(d => this.onClick(d))) .attr('fill', this.getColor) .attr('r', 0); diff --git a/src/charts/bubble-overlay.js b/src/charts/bubble-overlay.js index 1c938c13c..fb805b052 100644 --- a/src/charts/bubble-overlay.js +++ b/src/charts/bubble-overlay.js @@ -4,7 +4,7 @@ import {BaseMixin} from '../base/base-mixin'; import {BubbleMixin} from '../base/bubble-mixin'; import {transition} from '../core/core'; import {constants} from '../core/constants'; -import {utils} from '../core/utils'; +import {cpt, utils} from '../core/utils'; const BUBBLE_OVERLAY_CLASS = 'bubble-overlay'; const BUBBLE_NODE_CLASS = 'node'; @@ -114,7 +114,7 @@ export class BubbleOverlay extends BubbleMixin(BaseMixin) { .attr('class', BUBBLE_CLASS) .attr('r', 0) .attr('fill', this.getColor) - .on('click', d => this.onClick(d)); + .on('click', cpt(d => this.onClick(d))); } transition(circle, this.transitionDuration(), this.transitionDelay()) diff --git a/src/charts/geo-choropleth-chart.js b/src/charts/geo-choropleth-chart.js index f362b32b6..df2aa9b7c 100644 --- a/src/charts/geo-choropleth-chart.js +++ b/src/charts/geo-choropleth-chart.js @@ -6,7 +6,7 @@ import {ColorMixin} from '../base/color-mixin'; import {transition} from '../core/core'; import {logger} from '../core/logger'; import {events} from '../core/events'; -import {utils} from '../core/utils'; +import {cpt, utils} from '../core/utils'; /** * The geo choropleth chart is designed as an easy way to create a crossfilter driven choropleth map @@ -147,7 +147,7 @@ export class GeoChoroplethChart extends ColorMixin(BaseMixin) { } return 'none'; }) - .on('click', d => this.onClick(d, layerIndex)); + .on('click', cpt(d => this.onClick(d, layerIndex))); transition(paths, this.transitionDuration(), this.transitionDelay()).attr('fill', (d, i) => this.getColor(data[this._geoJson(layerIndex).keyAccessor(d)], i)); diff --git a/src/charts/heatmap.js b/src/charts/heatmap.js index 6a61e5684..16c9c9024 100644 --- a/src/charts/heatmap.js +++ b/src/charts/heatmap.js @@ -7,6 +7,7 @@ import {filters} from '../core/filters'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {MarginMixin} from '../base/margin-mixin'; +import {cpt} from '../core/utils'; const DEFAULT_BORDER_RADIUS = 6.75; @@ -231,7 +232,7 @@ export class HeatMap extends ColorMixin(MarginMixin) { .attr('fill', 'white') .attr('x', (d, i) => cols(this.keyAccessor()(d, i))) .attr('y', (d, i) => rows(this.valueAccessor()(d, i))) - .on('click', this.boxOnClick()); + .on('click', cpt(this.boxOnClick())); boxes = gEnter.merge(boxes); @@ -264,7 +265,7 @@ export class HeatMap extends ColorMixin(MarginMixin) { .style('text-anchor', 'middle') .attr('y', this.effectiveHeight()) .attr('dy', 12) - .on('click', this.xAxisOnClick()) + .on('click', cpt(this.xAxisOnClick())) .text(this.colsLabel()) .merge(gColsText); @@ -290,7 +291,7 @@ export class HeatMap extends ColorMixin(MarginMixin) { .attr('dx', -2) .attr('y', d => rows(d) + boxHeight / 2) .attr('dy', 6) - .on('click', this.yAxisOnClick()) + .on('click', cpt(this.yAxisOnClick())) .text(this.rowsLabel()) .merge(gRowsText); diff --git a/src/charts/html-legend.js b/src/charts/html-legend.js index b11695607..bacf36e78 100644 --- a/src/charts/html-legend.js +++ b/src/charts/html-legend.js @@ -1,6 +1,6 @@ import {select} from 'd3-selection'; -import {pluck, utils} from '../core/utils'; +import {cpt, pluck, utils} from '../core/utils'; import {constants} from '../core/constants'; /** @@ -52,9 +52,9 @@ export class HtmlLegend { .data(legendables).enter() .append('div') .classed(legendItemClassName, true) - .on('mouseover', d => this._parent.legendHighlight(d)) - .on('mouseout', d => this._parent.legendReset(d)) - .on('click', d => this._parent.legendToggle(d)); + .on('mouseover', cpt(d => this._parent.legendHighlight(d))) + .on('mouseout', cpt(d => this._parent.legendReset(d))) + .on('click', cpt(d => this._parent.legendToggle(d))); if (this._highlightSelected) { itemEnter.classed(constants.SELECTED_CLASS, d => filters.indexOf(d.name) !== -1); diff --git a/src/charts/legend.js b/src/charts/legend.js index 7de1ed806..fabcb1367 100644 --- a/src/charts/legend.js +++ b/src/charts/legend.js @@ -1,4 +1,4 @@ -import {pluck, utils} from '../core/utils'; +import {cpt, pluck, utils} from '../core/utils'; import {constants} from '../core/constants'; const LABEL_GAP = 2; @@ -219,15 +219,15 @@ export class Legend { .enter() .append('g') .attr('class', 'dc-legend-item') - .on('mouseover', d => { + .on('mouseover', cpt(d => { this._parent.legendHighlight(d); - }) - .on('mouseout', d => { + })) + .on('mouseout', cpt(d => { this._parent.legendReset(d); - }) - .on('click', d => { + })) + .on('click', cpt(d => { d.chart.legendToggle(d); - }); + })); if (this._highlightSelected) { itemEnter.classed(constants.SELECTED_CLASS, diff --git a/src/charts/row-chart.js b/src/charts/row-chart.js index b470286f1..57b49d6c9 100644 --- a/src/charts/row-chart.js +++ b/src/charts/row-chart.js @@ -6,6 +6,7 @@ import {CapMixin} from '../base/cap-mixin'; import {MarginMixin} from '../base/margin-mixin'; import {ColorMixin} from '../base/color-mixin'; import {transition} from '../core/core'; +import {cpt} from '../core/utils'; /** * Concrete row chart implementation. @@ -190,7 +191,7 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { const rect = rows.attr('transform', (d, i) => `translate(0,${(i + 1) * this._gap + i * height})`).select('rect') .attr('height', height) .attr('fill', this.getColor) - .on('click', d => this._onClick(d)) + .on('click', cpt(d => this._onClick(d))) .classed('deselected', d => (this.hasFilter()) ? !this._isSelectedRow(d) : false) .classed('selected', d => (this.hasFilter()) ? this._isSelectedRow(d) : false); @@ -212,12 +213,12 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { _createLabels (rowEnter) { if (this.renderLabel()) { rowEnter.append('text') - .on('click', d => this._onClick(d)); + .on('click', cpt(d => this._onClick(d))); } if (this.renderTitleLabel()) { rowEnter.append('text') .attr('class', this._titleRowCssClass) - .on('click', d => this._onClick(d)); + .on('click', cpt(d => this._onClick(d))); } } @@ -227,7 +228,7 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { .attr('x', this._labelOffsetX) .attr('y', this._labelOffsetY) .attr('dy', this._dyOffset) - .on('click', d => this._onClick(d)) + .on('click', cpt(d => this._onClick(d))) .attr('class', (d, i) => `${this._rowCssClass} _${i}`) .text(d => this.label()(d)); transition(lab, this.transitionDuration(), this.transitionDelay()) @@ -239,7 +240,7 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { .attr('y', this._labelOffsetY) .attr('dy', this._dyOffset) .attr('text-anchor', 'end') - .on('click', d => this._onClick(d)) + .on('click', cpt(d => this._onClick(d))) .attr('class', (d, i) => `${this._titleRowCssClass} _${i}`) .text(d => this.title()(d)); transition(titlelab, this.transitionDuration(), this.transitionDelay()) diff --git a/src/charts/sunburst-chart.js b/src/charts/sunburst-chart.js index 1f3553898..ba06176ed 100644 --- a/src/charts/sunburst-chart.js +++ b/src/charts/sunburst-chart.js @@ -6,7 +6,7 @@ import {interpolate} from 'd3-interpolate'; import {transition} from '../core/core'; import {filters} from '../core/filters'; -import {utils, pluck} from '../core/utils'; +import {utils, pluck, cpt} from '../core/utils'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; @@ -171,7 +171,7 @@ export class SunburstChart extends ColorMixin(BaseMixin) { _createSlicePath (slicesEnter, arcs) { const slicePath = slicesEnter.append('path') .attr('fill', (d, i) => this._fill(d, i)) - .on('click', (d, i) => this.onClick(d, i)) + .on('click', cpt(d => this.onClick(d))) .attr('d', d => this._safeArc(arcs, d)); const tranNodes = transition(slicePath, this.transitionDuration()); @@ -219,7 +219,7 @@ export class SunburstChart extends ColorMixin(BaseMixin) { } return classes; }) - .on('click', (d, i) => this.onClick(d, i)); + .on('click', cpt(d => this.onClick(d))); this._positionLabels(labelsEnter, arcs); } } @@ -598,7 +598,7 @@ export class SunburstChart extends ColorMixin(BaseMixin) { return this.getColor(d.data, i); } - onClick (d, i) { + onClick (d) { if (this._g.attr('class') === this._emptyCssClass) { return; } diff --git a/src/core/utils.js b/src/core/utils.js index 42cd9d2c3..7f9f04f8e 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -4,6 +4,18 @@ import {format} from 'd3-format'; import {constants} from './constants'; import {config} from './config'; +export function cpt (handler) { + return function (a, b) { + if (a.currentTarget) { + // d3@v6 - b is __data__, a is the event + handler.call(this, b, a); + } else { + // older d3 - a is __data__ + handler.call(this, a); + } + } +} + /** * Returns a function that given a string property name, can be used to pluck the property off an object. A function * can be passed as the second argument to also alter the data being returned. From ee5cb93cc5ffbf24abfc714ff035c9d21fe3abd8 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Thu, 27 Aug 2020 21:22:49 +0530 Subject: [PATCH 04/17] Make event handlers compatible with both d3@v5 and d3@v6 - these used `event` as well --- src/charts/cbox-menu.js | 24 +++++++++++++++--------- src/charts/select-menu.js | 16 ++++++++++++---- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/charts/cbox-menu.js b/src/charts/cbox-menu.js index fb5885fee..fbef70ad1 100644 --- a/src/charts/cbox-menu.js +++ b/src/charts/cbox-menu.js @@ -2,7 +2,7 @@ import {event, select} from 'd3-selection'; import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; -import {utils} from '../core/utils' +import {cpt, utils} from '../core/utils' const GROUP_CSS_CLASS = 'dc-cbox-group'; const ITEM_CSS_CLASS = 'dc-cbox-item'; @@ -120,9 +120,9 @@ export class CboxMenu extends BaseMixin { .append('input') .attr('type', 'reset') .text(this._promptText) - .on('click', function (d, i) { - return chart._onChange(d, i, this); - }); + .on('click', cpt(function (d, evt) { + return chart._onChange(d, evt, this); + })); } else { const li = this._cbox.append('li'); li.append('input') @@ -140,15 +140,21 @@ export class CboxMenu extends BaseMixin { .selectAll(`li.${ITEM_CSS_CLASS}`) .sort(this._order); - this._cbox.on('change', function (d, i) { - return chart._onChange(d, i, this); - }); + this._cbox.on('change', cpt(function (d, evt) { + return chart._onChange(d, evt, this); + })); return options; } - _onChange (d, i, element) { + _onChange (d, evt, element) { let values; - const target = select(event.target); + + // d3@v5 compatibility + if (event) { + evt = event; + } + + const target = select(evt.target); let options; if (!target.datum()) { diff --git a/src/charts/select-menu.js b/src/charts/select-menu.js index 6af3b5149..4abcb2f97 100644 --- a/src/charts/select-menu.js +++ b/src/charts/select-menu.js @@ -3,6 +3,7 @@ import {event} from 'd3-selection'; import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; import {logger} from '../core/logger'; +import {cpt} from '../core/utils'; const SELECT_CSS_CLASS = 'dc-select-menu'; const OPTION_CSS_CLASS = 'dc-select-option'; @@ -97,18 +98,25 @@ export class SelectMenu extends BaseMixin { this._select.selectAll(`option.${OPTION_CSS_CLASS}`).sort(this._order); - this._select.on('change', (d, i) => this._onChange(d, i)); + this._select.on('change', cpt((d, evt) => this._onChange(d, evt))); } - _onChange (_d, i) { + _onChange (_d, evt) { let values; - const target = event.target; + + // d3@v5 compatibility + if (event) { + evt = event; + } + + const target = evt.target; + if (target.selectedOptions) { const selectedOptions = Array.prototype.slice.call(target.selectedOptions); values = selectedOptions.map(d => d.value); } else { // IE and other browsers do not support selectedOptions // adapted from this polyfill: https://gist.github.com/brettz9/4212217 - const options = [].slice.call(event.target.options); + const options = [].slice.call(evt.target.options); values = options.filter(option => option.selected).map(option => option.value); } // console.log(values); From ba689f8e14d99be988be34c6fb7b5f985031b08a Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Thu, 27 Aug 2020 21:23:57 +0530 Subject: [PATCH 05/17] Make event handlers compatible with both d3@v5 and d3@v6 - these used `i` as well --- src/charts/pie-chart.js | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/charts/pie-chart.js b/src/charts/pie-chart.js index e5cb00c90..f6532755f 100644 --- a/src/charts/pie-chart.js +++ b/src/charts/pie-chart.js @@ -7,6 +7,7 @@ import {CapMixin} from '../base/cap-mixin'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; import {transition} from '../core/core'; +import {cpt} from '../core/utils'; const DEFAULT_MIN_ANGLE_FOR_LABEL = 0.5; @@ -160,7 +161,7 @@ export class PieChart extends CapMixin(ColorMixin(BaseMixin)) { _createSlicePath (slicesEnter, arcs) { const slicePath = slicesEnter.append('path') .attr('fill', (d, i) => this._fill(d, i)) - .on('click', (d, i) => this._onClick(d, i)) + .on('click', cpt(d => this._onClick(d))) .attr('d', (d, i) => this._safeArc(d, i, arcs)); const tranNodes = transition(slicePath, this.transitionDuration(), this.transitionDelay()); @@ -213,13 +214,13 @@ export class PieChart extends CapMixin(ColorMixin(BaseMixin)) { } return classes; }) - .on('click', (d, i) => this._onClick(d, i)) - .on('mouseover', (d, i) => { - this._highlightSlice(i, true); - }) - .on('mouseout', (d, i) => { - this._highlightSlice(i, false); - }); + .on('click', cpt(d => this._onClick(d))) + .on('mouseover', cpt(d => { + this._highlightSlice(d.index, true); + })) + .on('mouseout', cpt(d => { + this._highlightSlice(d.index, false); + })); this._positionLabels(labelsEnter, arcs); if (this._externalLabelRadius && this._drawPaths) { this._updateLabelPaths(pieData, arcs); @@ -237,13 +238,13 @@ export class PieChart extends CapMixin(ColorMixin(BaseMixin)) { .enter() .append('polyline') .attr('class', (d, i) => `pie-path _${i} ${this._sliceCssClass}`) - .on('click', (d, i) => this._onClick(d, i)) - .on('mouseover', (d, i) => { - this._highlightSlice(i, true); - }) - .on('mouseout', (d, i) => { - this._highlightSlice(i, false); - }) + .on('click', cpt(d => this._onClick(d))) + .on('mouseover', cpt(d => { + this._highlightSlice(d.index, true); + })) + .on('mouseout', cpt(d => { + this._highlightSlice(d.index, false); + })) .merge(polyline); const arc2 = arc() @@ -451,9 +452,9 @@ export class PieChart extends CapMixin(ColorMixin(BaseMixin)) { return this.getColor(d.data, i); } - _onClick (d, i) { + _onClick (d) { if (this._g.attr('class') !== this._emptyCssClass) { - this.onClick(d.data, i); + this.onClick(d.data); } } From 3301ef4dc7b9948130cff48a80e01032fecbe825 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Fri, 28 Aug 2020 08:45:41 +0530 Subject: [PATCH 06/17] Use d3@v6's event semantics --- spec/helpers/spec-helper.js | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/spec/helpers/spec-helper.js b/spec/helpers/spec-helper.js index 27339373d..755168417 100644 --- a/spec/helpers/spec-helper.js +++ b/spec/helpers/spec-helper.js @@ -50,16 +50,10 @@ const simulateChartBrushing = function (chart, domainSelection) { // D3v4 needs scaled coordinates for the event const scaledSelection = domainSelection.map(coord => chart.x()(coord)); - d3.event = { - sourceEvent: true, + // an event with fields that dc cares about + chart._brushing({ selection: scaledSelection - }; - - try { - chart._brushing(); - } finally { - d3.event = null; - } + }); }; // Simulate a dummy event - just enough for the handler to get fooled @@ -70,14 +64,8 @@ const simulateChart2DBrushing = function (chart, domainSelection) { return scale(coord); })); - d3.event = { - sourceEvent: true, + // an event with fields that dc cares about + chart._brushing({ selection: scaledSelection - }; - - try { - chart._brushing(); - } finally { - d3.event = null; - } + }); }; From d899c5cf80b55c5d924c5ce4ae34ae65f49c7568 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Fri, 28 Aug 2020 22:25:21 +0530 Subject: [PATCH 07/17] Refactor to simplify getting current event in d3@v5 --- src/base/coordinate-grid-mixin.js | 17 +++-------------- src/charts/cbox-menu.js | 7 +------ src/charts/scatter-plot.js | 7 +------ src/charts/select-menu.js | 7 ------- src/core/utils.js | 7 ++++--- 5 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/base/coordinate-grid-mixin.js b/src/base/coordinate-grid-mixin.js index 5550091d8..5b669bb31 100644 --- a/src/base/coordinate-grid-mixin.js +++ b/src/base/coordinate-grid-mixin.js @@ -5,14 +5,13 @@ import {scaleBand, scaleLinear, scaleOrdinal} from 'd3-scale'; import {axisBottom, axisLeft, axisRight} from 'd3-axis'; import {zoom, zoomIdentity} from 'd3-zoom'; import {brushX} from 'd3-brush'; -import {event} from 'd3-selection'; import {ColorMixin} from './color-mixin'; import {MarginMixin} from './margin-mixin'; import {optionalTransition, transition} from '../core/core'; import {units} from '../core/units'; import {constants} from '../core/constants'; -import {utils} from '../core/utils'; +import {cpt, utils} from '../core/utils'; import {logger} from '../core/logger'; import {filters} from '../core/filters'; import {events} from '../core/events'; @@ -78,7 +77,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { this._zoomScale = [1, Infinity]; this._zoomOutRestrict = true; - this._zoom = zoom().on('zoom', evt => this._onZoom(evt)); + this._zoom = zoom().on('zoom', cpt((d, evt) => this._onZoom(evt))); this._nullZoom = zoom().on('zoom', null); this._hasBeenMouseZoomable = false; this._ignoreZoomEvents = false; // ignore when carrying out programmatic zoom operations @@ -934,7 +933,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { renderBrush (g, doTransition) { if (this._brushOn) { - this._brush.on('start brush end', evt => this._brushing(evt)); + this._brush.on('start brush end', cpt((d, evt) => this._brushing(evt))); // To retrieve selection we need self._gBrush this._gBrush = g.append('g') @@ -979,11 +978,6 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { return; } - // d3@v5 compatibility - if (event) { - evt = event; - } - let brushSelection = evt.selection; if (brushSelection) { brushSelection = brushSelection.map(this.x().invert); @@ -1272,11 +1266,6 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { return; } - // d3@v5 compatibility - if (event) { - evt = event; - } - const newDomain = evt.transform.rescaleX(this._origX).domain(); this.focus(newDomain, false); } diff --git a/src/charts/cbox-menu.js b/src/charts/cbox-menu.js index fbef70ad1..f5d5af9d1 100644 --- a/src/charts/cbox-menu.js +++ b/src/charts/cbox-menu.js @@ -1,4 +1,4 @@ -import {event, select} from 'd3-selection'; +import {select} from 'd3-selection'; import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; @@ -149,11 +149,6 @@ export class CboxMenu extends BaseMixin { _onChange (d, evt, element) { let values; - // d3@v5 compatibility - if (event) { - evt = event; - } - const target = select(evt.target); let options; diff --git a/src/charts/scatter-plot.js b/src/charts/scatter-plot.js index ca0f38c77..760bca20e 100644 --- a/src/charts/scatter-plot.js +++ b/src/charts/scatter-plot.js @@ -1,5 +1,5 @@ import {symbol} from 'd3-shape'; -import {event, select} from 'd3-selection'; +import {select} from 'd3-selection'; import {brush} from 'd3-brush'; import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; @@ -589,11 +589,6 @@ export class ScatterPlot extends CoordinateGridMixin { return; } - // d3@v5 compatibility - if (event) { - evt = event; - } - let brushSelection = evt.selection; // Testing with pixels is more reliable diff --git a/src/charts/select-menu.js b/src/charts/select-menu.js index 4abcb2f97..9e22840a1 100644 --- a/src/charts/select-menu.js +++ b/src/charts/select-menu.js @@ -1,5 +1,3 @@ -import {event} from 'd3-selection'; - import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; import {logger} from '../core/logger'; @@ -104,11 +102,6 @@ export class SelectMenu extends BaseMixin { _onChange (_d, evt) { let values; - // d3@v5 compatibility - if (event) { - evt = event; - } - const target = evt.target; if (target.selectedOptions) { diff --git a/src/core/utils.js b/src/core/utils.js index 7f9f04f8e..4456c1246 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -3,15 +3,16 @@ import {format} from 'd3-format'; import {constants} from './constants'; import {config} from './config'; +import {event} from 'd3-selection'; export function cpt (handler) { return function (a, b) { - if (a.currentTarget) { + if (a && a.currentTarget) { // d3@v6 - b is __data__, a is the event handler.call(this, b, a); } else { - // older d3 - a is __data__ - handler.call(this, a); + // older d3 - a is __data__, event from global d3.event + handler.call(this, a, event); } } } From e8f80fa152a32166b7a98b31a81c772547eb0365 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Fri, 28 Aug 2020 22:55:05 +0530 Subject: [PATCH 08/17] Check for a.target instead of a.currentTarget to detect if a is an event --- src/core/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/utils.js b/src/core/utils.js index 4456c1246..a131fcbe5 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -7,7 +7,7 @@ import {event} from 'd3-selection'; export function cpt (handler) { return function (a, b) { - if (a && a.currentTarget) { + if (a && a.target) { // d3@v6 - b is __data__, a is the event handler.call(this, b, a); } else { From e0a483c55a933facf219b0026979a796059cf167 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Sat, 29 Aug 2020 09:34:38 +0530 Subject: [PATCH 09/17] Move `cpt` to `d3compat` module --- src/base/bubble-mixin.js | 2 +- src/base/coordinate-grid-mixin.js | 3 ++- src/charts/bar-chart.js | 3 ++- src/charts/box-plot.js | 3 ++- src/charts/bubble-chart.js | 2 +- src/charts/bubble-overlay.js | 3 ++- src/charts/cbox-menu.js | 3 ++- src/charts/geo-choropleth-chart.js | 3 ++- src/charts/heatmap.js | 2 +- src/charts/html-legend.js | 3 ++- src/charts/legend.js | 3 ++- src/charts/pie-chart.js | 2 +- src/charts/row-chart.js | 2 +- src/charts/select-menu.js | 2 +- src/charts/sunburst-chart.js | 3 ++- src/core/d3comapt.js | 18 ++++++++++++++++++ src/core/utils.js | 13 ------------- 17 files changed, 42 insertions(+), 28 deletions(-) create mode 100644 src/core/d3comapt.js diff --git a/src/base/bubble-mixin.js b/src/base/bubble-mixin.js index 9f43437c6..f32146c47 100644 --- a/src/base/bubble-mixin.js +++ b/src/base/bubble-mixin.js @@ -4,7 +4,7 @@ import { scaleLinear } from 'd3-scale'; import {ColorMixin} from './color-mixin'; import {transition} from '../core/core'; import {events} from '../core/events'; -import {cpt} from '../core/utils'; +import {cpt} from '../core/d3comapt'; /** * This Mixin provides reusable functionalities for any chart that needs to visualize data using bubbles. diff --git a/src/base/coordinate-grid-mixin.js b/src/base/coordinate-grid-mixin.js index 5b669bb31..4c0198274 100644 --- a/src/base/coordinate-grid-mixin.js +++ b/src/base/coordinate-grid-mixin.js @@ -11,7 +11,8 @@ import {MarginMixin} from './margin-mixin'; import {optionalTransition, transition} from '../core/core'; import {units} from '../core/units'; import {constants} from '../core/constants'; -import {cpt, utils} from '../core/utils'; +import {utils} from '../core/utils'; +import {cpt} from '../core/d3comapt'; import {logger} from '../core/logger'; import {filters} from '../core/filters'; import {events} from '../core/events'; diff --git a/src/charts/bar-chart.js b/src/charts/bar-chart.js index 3fe478600..4f251d635 100644 --- a/src/charts/bar-chart.js +++ b/src/charts/bar-chart.js @@ -4,7 +4,8 @@ import {StackMixin} from '../base/stack-mixin'; import {transition} from '../core/core'; import {constants} from '../core/constants'; import {logger} from '../core/logger'; -import {cpt, pluck, utils} from '../core/utils'; +import {pluck, utils} from '../core/utils'; +import {cpt} from '../core/d3comapt'; const MIN_BAR_WIDTH = 1; const DEFAULT_GAP_BETWEEN_BARS = 2; diff --git a/src/charts/box-plot.js b/src/charts/box-plot.js index f57eebbee..a6e069c7b 100644 --- a/src/charts/box-plot.js +++ b/src/charts/box-plot.js @@ -6,7 +6,8 @@ import {d3Box} from '../base/d3.box' import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; import {units} from '../core/units'; -import {cpt, utils} from '../core/utils'; +import {utils} from '../core/utils'; +import {cpt} from '../core/d3comapt'; // Returns a function to compute the interquartile range. function defaultWhiskersIQR (k) { diff --git a/src/charts/bubble-chart.js b/src/charts/bubble-chart.js index 57c40016e..13c6fbbff 100644 --- a/src/charts/bubble-chart.js +++ b/src/charts/bubble-chart.js @@ -1,7 +1,7 @@ import {BubbleMixin} from '../base/bubble-mixin'; import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/utils'; +import {cpt} from '../core/d3comapt'; /** * A concrete implementation of a general purpose bubble chart that allows data visualization using the diff --git a/src/charts/bubble-overlay.js b/src/charts/bubble-overlay.js index fb805b052..6162d4bbe 100644 --- a/src/charts/bubble-overlay.js +++ b/src/charts/bubble-overlay.js @@ -4,7 +4,8 @@ import {BaseMixin} from '../base/base-mixin'; import {BubbleMixin} from '../base/bubble-mixin'; import {transition} from '../core/core'; import {constants} from '../core/constants'; -import {cpt, utils} from '../core/utils'; +import {utils} from '../core/utils'; +import {cpt} from '../core/d3comapt'; const BUBBLE_OVERLAY_CLASS = 'bubble-overlay'; const BUBBLE_NODE_CLASS = 'node'; diff --git a/src/charts/cbox-menu.js b/src/charts/cbox-menu.js index f5d5af9d1..7d89e0c26 100644 --- a/src/charts/cbox-menu.js +++ b/src/charts/cbox-menu.js @@ -2,7 +2,8 @@ import {select} from 'd3-selection'; import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; -import {cpt, utils} from '../core/utils' +import {utils} from '../core/utils' +import {cpt} from '../core/d3comapt'; const GROUP_CSS_CLASS = 'dc-cbox-group'; const ITEM_CSS_CLASS = 'dc-cbox-item'; diff --git a/src/charts/geo-choropleth-chart.js b/src/charts/geo-choropleth-chart.js index df2aa9b7c..167780819 100644 --- a/src/charts/geo-choropleth-chart.js +++ b/src/charts/geo-choropleth-chart.js @@ -6,7 +6,8 @@ import {ColorMixin} from '../base/color-mixin'; import {transition} from '../core/core'; import {logger} from '../core/logger'; import {events} from '../core/events'; -import {cpt, utils} from '../core/utils'; +import {utils} from '../core/utils'; +import {cpt} from '../core/d3comapt'; /** * The geo choropleth chart is designed as an easy way to create a crossfilter driven choropleth map diff --git a/src/charts/heatmap.js b/src/charts/heatmap.js index 16c9c9024..f4163a243 100644 --- a/src/charts/heatmap.js +++ b/src/charts/heatmap.js @@ -7,7 +7,7 @@ import {filters} from '../core/filters'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {MarginMixin} from '../base/margin-mixin'; -import {cpt} from '../core/utils'; +import {cpt} from '../core/d3comapt'; const DEFAULT_BORDER_RADIUS = 6.75; diff --git a/src/charts/html-legend.js b/src/charts/html-legend.js index bacf36e78..4d8491192 100644 --- a/src/charts/html-legend.js +++ b/src/charts/html-legend.js @@ -1,6 +1,7 @@ import {select} from 'd3-selection'; -import {cpt, pluck, utils} from '../core/utils'; +import {pluck, utils} from '../core/utils'; +import {cpt} from '../core/d3comapt'; import {constants} from '../core/constants'; /** diff --git a/src/charts/legend.js b/src/charts/legend.js index fabcb1367..bfed4476e 100644 --- a/src/charts/legend.js +++ b/src/charts/legend.js @@ -1,4 +1,5 @@ -import {cpt, pluck, utils} from '../core/utils'; +import {pluck, utils} from '../core/utils'; +import {cpt} from '../core/d3comapt'; import {constants} from '../core/constants'; const LABEL_GAP = 2; diff --git a/src/charts/pie-chart.js b/src/charts/pie-chart.js index f6532755f..4b07dae22 100644 --- a/src/charts/pie-chart.js +++ b/src/charts/pie-chart.js @@ -7,7 +7,7 @@ import {CapMixin} from '../base/cap-mixin'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/utils'; +import {cpt} from '../core/d3comapt'; const DEFAULT_MIN_ANGLE_FOR_LABEL = 0.5; diff --git a/src/charts/row-chart.js b/src/charts/row-chart.js index 57b49d6c9..9304bca82 100644 --- a/src/charts/row-chart.js +++ b/src/charts/row-chart.js @@ -6,7 +6,7 @@ import {CapMixin} from '../base/cap-mixin'; import {MarginMixin} from '../base/margin-mixin'; import {ColorMixin} from '../base/color-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/utils'; +import {cpt} from '../core/d3comapt'; /** * Concrete row chart implementation. diff --git a/src/charts/select-menu.js b/src/charts/select-menu.js index 9e22840a1..690ec0ea7 100644 --- a/src/charts/select-menu.js +++ b/src/charts/select-menu.js @@ -1,7 +1,7 @@ import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; import {logger} from '../core/logger'; -import {cpt} from '../core/utils'; +import {cpt} from '../core/d3comapt'; const SELECT_CSS_CLASS = 'dc-select-menu'; const OPTION_CSS_CLASS = 'dc-select-option'; diff --git a/src/charts/sunburst-chart.js b/src/charts/sunburst-chart.js index ba06176ed..d79f6de18 100644 --- a/src/charts/sunburst-chart.js +++ b/src/charts/sunburst-chart.js @@ -6,7 +6,8 @@ import {interpolate} from 'd3-interpolate'; import {transition} from '../core/core'; import {filters} from '../core/filters'; -import {utils, pluck, cpt} from '../core/utils'; +import {utils, pluck} from '../core/utils'; +import {cpt} from '../core/d3comapt'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; diff --git a/src/core/d3comapt.js b/src/core/d3comapt.js new file mode 100644 index 000000000..f67926873 --- /dev/null +++ b/src/core/d3comapt.js @@ -0,0 +1,18 @@ +import {event} from 'd3-selection'; + +// d3v6 has changed the arguments for event handlers. +// We are creating a wrapper which detects if the first argument is an event, which indicated d3@v6 +// Otherwise we assume lower versions of d3. +// The underlying handler will always receive bound datum as the first argument and the event as the second argument. +// It is possible that any of these can actually be undefined (or null). +export function cpt (handler) { + return function (a, b) { + if (a && a.target) { + // d3@v6 - b is __data__, a is the event + handler.call(this, b, a); + } else { + // older d3 - a is __data__, event from global d3.event + handler.call(this, a, event); + } + } +} diff --git a/src/core/utils.js b/src/core/utils.js index a131fcbe5..42cd9d2c3 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -3,19 +3,6 @@ import {format} from 'd3-format'; import {constants} from './constants'; import {config} from './config'; -import {event} from 'd3-selection'; - -export function cpt (handler) { - return function (a, b) { - if (a && a.target) { - // d3@v6 - b is __data__, a is the event - handler.call(this, b, a); - } else { - // older d3 - a is __data__, event from global d3.event - handler.call(this, a, event); - } - } -} /** * Returns a function that given a string property name, can be used to pluck the property off an object. A function From 012ae33ef1dc079994fc7cf44c568e08443f6878 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Sat, 29 Aug 2020 10:05:02 +0530 Subject: [PATCH 10/17] d3@v6 compat for `d3.nest` --- src/charts/data-grid.js | 23 +++++++++++----------- src/charts/data-table.js | 13 ++++++++----- src/charts/series-chart.js | 18 +++++++++--------- src/core/d3comapt.js | 39 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/src/charts/data-grid.js b/src/charts/data-grid.js index 30acc4ef9..10ad170f1 100644 --- a/src/charts/data-grid.js +++ b/src/charts/data-grid.js @@ -1,8 +1,8 @@ import {ascending} from 'd3-array'; -import {nest} from 'd3-collection'; import {logger} from '../core/logger'; import {BaseMixin} from '../base/base-mixin'; +import {compatNestHelper} from '../core/d3comapt'; const LABEL_CSS_CLASS = 'dc-grid-label'; const ITEM_CSS_CLASS = 'dc-grid-item'; @@ -80,16 +80,17 @@ export class DataGrid extends BaseMixin { } _nestEntries () { - const entries = this.dimension().top(this._size); - - return nest() - .key(this.section()) - .sortKeys(this._order) - .entries( - entries - .sort((a, b) => this._order(this._sortBy(a), this._sortBy(b))) - .slice(this._beginSlice, this._endSlice) - ); + let entries = this.dimension().top(this._size); + + entries = entries + .sort((a, b) => this._order(this._sortBy(a), this._sortBy(b))) + .slice(this._beginSlice, this._endSlice) + + return compatNestHelper({ + key: this.section(), + sortKeys: this._order, + entries + }); } _renderItems (sections) { diff --git a/src/charts/data-table.js b/src/charts/data-table.js index 57309ce2e..1144666a6 100644 --- a/src/charts/data-table.js +++ b/src/charts/data-table.js @@ -1,8 +1,8 @@ import {ascending} from 'd3-array'; -import {nest} from 'd3-collection'; import {logger} from '../core/logger'; import {BaseMixin} from '../base/base-mixin'; +import {compatNestHelper} from '../core/d3comapt'; const LABEL_CSS_CLASS = 'dc-table-label'; const ROW_CSS_CLASS = 'dc-table-row'; @@ -174,10 +174,13 @@ export class DataTable extends BaseMixin { entries = this.dimension().top(this._size); } - return nest() - .key(this.section()) - .sortKeys(this._order) - .entries(entries.sort((a, b) => this._order(this._sortBy(a), this._sortBy(b))).slice(this._beginSlice, this._endSlice)); + entries = entries.sort((a, b) => this._order(this._sortBy(a), this._sortBy(b))).slice(this._beginSlice, this._endSlice) + + return compatNestHelper({ + key: this.section(), + sortKeys: this._order, + entries + }); } _renderRows (sections) { diff --git a/src/charts/series-chart.js b/src/charts/series-chart.js index 3383fbbc0..93c05febc 100644 --- a/src/charts/series-chart.js +++ b/src/charts/series-chart.js @@ -1,9 +1,9 @@ import {ascending} from 'd3-array'; -import {nest} from 'd3-collection'; import {CompositeChart} from './composite-chart'; import {lineChart} from './line-chart'; import {utils} from '../core/utils'; +import {compatNestHelper} from '../core/d3comapt'; /** * A series chart is a chart that shows multiple series of data overlaid on one chart, where the @@ -55,14 +55,14 @@ export class SeriesChart extends CompositeChart { _preprocessData () { const keep = []; let childrenChanged; - const nester = nest().key(this._seriesAccessor); - if (this._seriesSort) { - nester.sortKeys(this._seriesSort); - } - if (this._valueSort) { - nester.sortValues(this._valueSort); - } - const nesting = nester.entries(this.data()); + + const nesting = compatNestHelper({ + key: this._seriesAccessor, + sortKeys: this._seriesSort, + sortValues: this._valueSort, + entries: this.data() + }); + const children = nesting.map((sub, i) => { const subChart = this._charts[sub.key] || this._chartFunction(this, this._chartGroup , sub.key, i); diff --git a/src/core/d3comapt.js b/src/core/d3comapt.js index f67926873..00e2909bd 100644 --- a/src/core/d3comapt.js +++ b/src/core/d3comapt.js @@ -1,4 +1,6 @@ import {event} from 'd3-selection'; +import {nest} from 'd3-collection'; +import {groups} from 'd3-array'; // d3v6 has changed the arguments for event handlers. // We are creating a wrapper which detects if the first argument is an event, which indicated d3@v6 @@ -16,3 +18,40 @@ export function cpt (handler) { } } } + +function _d3v5Nester ({key, sortKeys, sortValues, entries}) { + const nester = nest().key(key); + if (sortKeys) { + nester.sortKeys(sortKeys); + } + if (sortValues) { + nester.sortValues(sortValues); + } + return nester.entries(entries); +} + +function _d3v6Nester ({key, sortKeys, sortValues, entries}) { + if (sortValues) { + entries = [...entries].sort(sortValues); + } + let out = groups(entries, key); + if (sortKeys) { + out = out.sort(sortKeys); + } + + // remap to d3@v5 structure + return out.map(e => ({ + key: `${e[0]}`, // d3@v5 always returns key as string + values: e[1] + })); +} + +export function compatNestHelper ({key, sortKeys, sortValues, entries}) { + if (groups) { + // d3@v6 + return _d3v6Nester({key, sortKeys, sortValues, entries}); + } else { + // older d3 + return _d3v5Nester({key, sortKeys, sortValues, entries}); + } +} From ef44b487cc2bc7b23fef12134551f506b47b8343 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Sat, 29 Aug 2020 14:25:34 +0530 Subject: [PATCH 11/17] Replace `d3.set` with ES6 `Set` --- spec/heatmap-spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/heatmap-spec.js b/spec/heatmap-spec.js index 72159232a..1b8c2f424 100644 --- a/spec/heatmap-spec.js +++ b/spec/heatmap-spec.js @@ -228,7 +228,7 @@ describe('dc.heatmap', () => { p.cols.add(d.colData); p.rows.add(d.rowData); return p; - }, {cols: d3.set(), rows: d3.set()}); + }, {cols: new Set(), rows: new Set()}); }; beforeEach(() => { @@ -245,21 +245,21 @@ describe('dc.heatmap', () => { it('should have the correct number of columns', () => { chart.selectAll('.box-group').each(d => { - expect(originalDomain.cols.has(d.key[0])).toBeTruthy(); + expect(originalDomain.cols.has(`${d.key[0]}`)).toBeTruthy(); }); chart.selectAll('.cols.axis text').each(d => { - expect(originalDomain.cols.has(d)).toBeTruthy(); + expect(originalDomain.cols.has(`${d}`)).toBeTruthy(); }); }); it('should have the correct number of rows', () => { chart.selectAll('.box-group').each(d => { - expect(originalDomain.rows.has(d.key[1])).toBeTruthy(); + expect(originalDomain.rows.has(`${d.key[1]}`)).toBeTruthy(); }); chart.selectAll('.rows.axis text').each(d => { - expect(originalDomain.rows.has(d)).toBeTruthy(); + expect(originalDomain.rows.has(`${d}`)).toBeTruthy(); }); }); }); From 585ac2030658965c2ff518a60eee4eebf7eefa0b Mon Sep 17 00:00:00 2001 From: Gordon Woodhull Date: Sat, 29 Aug 2020 11:08:03 -0400 Subject: [PATCH 12/17] simplify spec it was confused whether it wanted strings or numbers --- spec/heatmap-spec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/heatmap-spec.js b/spec/heatmap-spec.js index 1b8c2f424..a5e0b8815 100644 --- a/spec/heatmap-spec.js +++ b/spec/heatmap-spec.js @@ -225,8 +225,8 @@ describe('dc.heatmap', () => { const reduceDimensionValues = function (dmsn) { return dmsn.top(Infinity).reduce((p, d) => { - p.cols.add(d.colData); - p.rows.add(d.rowData); + p.cols.add(+d.colData); + p.rows.add(+d.rowData); return p; }, {cols: new Set(), rows: new Set()}); }; @@ -245,21 +245,21 @@ describe('dc.heatmap', () => { it('should have the correct number of columns', () => { chart.selectAll('.box-group').each(d => { - expect(originalDomain.cols.has(`${d.key[0]}`)).toBeTruthy(); + expect(originalDomain.cols.has(d.key[0])).toBeTruthy(); }); chart.selectAll('.cols.axis text').each(d => { - expect(originalDomain.cols.has(`${d}`)).toBeTruthy(); + expect(originalDomain.cols.has(d)).toBeTruthy(); }); }); it('should have the correct number of rows', () => { chart.selectAll('.box-group').each(d => { - expect(originalDomain.rows.has(`${d.key[1]}`)).toBeTruthy(); + expect(originalDomain.rows.has(d.key[1])).toBeTruthy(); }); chart.selectAll('.rows.axis text').each(d => { - expect(originalDomain.rows.has(`${d}`)).toBeTruthy(); + expect(originalDomain.rows.has(d)).toBeTruthy(); }); }); }); From 5948133b856003161dbcca2fced264a1b56d1512 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Sat, 29 Aug 2020 20:53:08 +0530 Subject: [PATCH 13/17] Correct typo - d3camapt -> d3compat --- src/base/bubble-mixin.js | 2 +- src/base/coordinate-grid-mixin.js | 2 +- src/charts/bar-chart.js | 2 +- src/charts/box-plot.js | 2 +- src/charts/bubble-chart.js | 2 +- src/charts/bubble-overlay.js | 2 +- src/charts/cbox-menu.js | 2 +- src/charts/data-grid.js | 2 +- src/charts/data-table.js | 2 +- src/charts/geo-choropleth-chart.js | 2 +- src/charts/heatmap.js | 2 +- src/charts/html-legend.js | 2 +- src/charts/legend.js | 2 +- src/charts/pie-chart.js | 2 +- src/charts/row-chart.js | 2 +- src/charts/select-menu.js | 2 +- src/charts/series-chart.js | 2 +- src/charts/sunburst-chart.js | 2 +- src/core/{d3comapt.js => d3compat.js} | 0 19 files changed, 18 insertions(+), 18 deletions(-) rename src/core/{d3comapt.js => d3compat.js} (100%) diff --git a/src/base/bubble-mixin.js b/src/base/bubble-mixin.js index f32146c47..08da438b3 100644 --- a/src/base/bubble-mixin.js +++ b/src/base/bubble-mixin.js @@ -4,7 +4,7 @@ import { scaleLinear } from 'd3-scale'; import {ColorMixin} from './color-mixin'; import {transition} from '../core/core'; import {events} from '../core/events'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; /** * This Mixin provides reusable functionalities for any chart that needs to visualize data using bubbles. diff --git a/src/base/coordinate-grid-mixin.js b/src/base/coordinate-grid-mixin.js index 4c0198274..92cd24ea3 100644 --- a/src/base/coordinate-grid-mixin.js +++ b/src/base/coordinate-grid-mixin.js @@ -12,7 +12,7 @@ import {optionalTransition, transition} from '../core/core'; import {units} from '../core/units'; import {constants} from '../core/constants'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; import {logger} from '../core/logger'; import {filters} from '../core/filters'; import {events} from '../core/events'; diff --git a/src/charts/bar-chart.js b/src/charts/bar-chart.js index 4f251d635..1700108b2 100644 --- a/src/charts/bar-chart.js +++ b/src/charts/bar-chart.js @@ -5,7 +5,7 @@ import {transition} from '../core/core'; import {constants} from '../core/constants'; import {logger} from '../core/logger'; import {pluck, utils} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; const MIN_BAR_WIDTH = 1; const DEFAULT_GAP_BETWEEN_BARS = 2; diff --git a/src/charts/box-plot.js b/src/charts/box-plot.js index a6e069c7b..4db116386 100644 --- a/src/charts/box-plot.js +++ b/src/charts/box-plot.js @@ -7,7 +7,7 @@ import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; import {units} from '../core/units'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; // Returns a function to compute the interquartile range. function defaultWhiskersIQR (k) { diff --git a/src/charts/bubble-chart.js b/src/charts/bubble-chart.js index 13c6fbbff..bd40c4127 100644 --- a/src/charts/bubble-chart.js +++ b/src/charts/bubble-chart.js @@ -1,7 +1,7 @@ import {BubbleMixin} from '../base/bubble-mixin'; import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; /** * A concrete implementation of a general purpose bubble chart that allows data visualization using the diff --git a/src/charts/bubble-overlay.js b/src/charts/bubble-overlay.js index 6162d4bbe..1aa0d03ea 100644 --- a/src/charts/bubble-overlay.js +++ b/src/charts/bubble-overlay.js @@ -5,7 +5,7 @@ import {BubbleMixin} from '../base/bubble-mixin'; import {transition} from '../core/core'; import {constants} from '../core/constants'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; const BUBBLE_OVERLAY_CLASS = 'bubble-overlay'; const BUBBLE_NODE_CLASS = 'node'; diff --git a/src/charts/cbox-menu.js b/src/charts/cbox-menu.js index 7d89e0c26..5119ec1f0 100644 --- a/src/charts/cbox-menu.js +++ b/src/charts/cbox-menu.js @@ -3,7 +3,7 @@ import {select} from 'd3-selection'; import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; import {utils} from '../core/utils' -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; const GROUP_CSS_CLASS = 'dc-cbox-group'; const ITEM_CSS_CLASS = 'dc-cbox-item'; diff --git a/src/charts/data-grid.js b/src/charts/data-grid.js index 10ad170f1..ced2ac83f 100644 --- a/src/charts/data-grid.js +++ b/src/charts/data-grid.js @@ -2,7 +2,7 @@ import {ascending} from 'd3-array'; import {logger} from '../core/logger'; import {BaseMixin} from '../base/base-mixin'; -import {compatNestHelper} from '../core/d3comapt'; +import {compatNestHelper} from '../core/d3compat'; const LABEL_CSS_CLASS = 'dc-grid-label'; const ITEM_CSS_CLASS = 'dc-grid-item'; diff --git a/src/charts/data-table.js b/src/charts/data-table.js index 1144666a6..a2688c701 100644 --- a/src/charts/data-table.js +++ b/src/charts/data-table.js @@ -2,7 +2,7 @@ import {ascending} from 'd3-array'; import {logger} from '../core/logger'; import {BaseMixin} from '../base/base-mixin'; -import {compatNestHelper} from '../core/d3comapt'; +import {compatNestHelper} from '../core/d3compat'; const LABEL_CSS_CLASS = 'dc-table-label'; const ROW_CSS_CLASS = 'dc-table-row'; diff --git a/src/charts/geo-choropleth-chart.js b/src/charts/geo-choropleth-chart.js index 167780819..1adfd9ee2 100644 --- a/src/charts/geo-choropleth-chart.js +++ b/src/charts/geo-choropleth-chart.js @@ -7,7 +7,7 @@ import {transition} from '../core/core'; import {logger} from '../core/logger'; import {events} from '../core/events'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; /** * The geo choropleth chart is designed as an easy way to create a crossfilter driven choropleth map diff --git a/src/charts/heatmap.js b/src/charts/heatmap.js index f4163a243..74f341921 100644 --- a/src/charts/heatmap.js +++ b/src/charts/heatmap.js @@ -7,7 +7,7 @@ import {filters} from '../core/filters'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {MarginMixin} from '../base/margin-mixin'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; const DEFAULT_BORDER_RADIUS = 6.75; diff --git a/src/charts/html-legend.js b/src/charts/html-legend.js index 4d8491192..0395b3104 100644 --- a/src/charts/html-legend.js +++ b/src/charts/html-legend.js @@ -1,7 +1,7 @@ import {select} from 'd3-selection'; import {pluck, utils} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; import {constants} from '../core/constants'; /** diff --git a/src/charts/legend.js b/src/charts/legend.js index bfed4476e..bac041d95 100644 --- a/src/charts/legend.js +++ b/src/charts/legend.js @@ -1,5 +1,5 @@ import {pluck, utils} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; import {constants} from '../core/constants'; const LABEL_GAP = 2; diff --git a/src/charts/pie-chart.js b/src/charts/pie-chart.js index 4b07dae22..ccb95d4d8 100644 --- a/src/charts/pie-chart.js +++ b/src/charts/pie-chart.js @@ -7,7 +7,7 @@ import {CapMixin} from '../base/cap-mixin'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; const DEFAULT_MIN_ANGLE_FOR_LABEL = 0.5; diff --git a/src/charts/row-chart.js b/src/charts/row-chart.js index 9304bca82..d86ccc332 100644 --- a/src/charts/row-chart.js +++ b/src/charts/row-chart.js @@ -6,7 +6,7 @@ import {CapMixin} from '../base/cap-mixin'; import {MarginMixin} from '../base/margin-mixin'; import {ColorMixin} from '../base/color-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; /** * Concrete row chart implementation. diff --git a/src/charts/select-menu.js b/src/charts/select-menu.js index 690ec0ea7..97d489b21 100644 --- a/src/charts/select-menu.js +++ b/src/charts/select-menu.js @@ -1,7 +1,7 @@ import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; import {logger} from '../core/logger'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; const SELECT_CSS_CLASS = 'dc-select-menu'; const OPTION_CSS_CLASS = 'dc-select-option'; diff --git a/src/charts/series-chart.js b/src/charts/series-chart.js index 93c05febc..716c2d4f2 100644 --- a/src/charts/series-chart.js +++ b/src/charts/series-chart.js @@ -3,7 +3,7 @@ import {ascending} from 'd3-array'; import {CompositeChart} from './composite-chart'; import {lineChart} from './line-chart'; import {utils} from '../core/utils'; -import {compatNestHelper} from '../core/d3comapt'; +import {compatNestHelper} from '../core/d3compat'; /** * A series chart is a chart that shows multiple series of data overlaid on one chart, where the diff --git a/src/charts/sunburst-chart.js b/src/charts/sunburst-chart.js index d79f6de18..f6577a32e 100644 --- a/src/charts/sunburst-chart.js +++ b/src/charts/sunburst-chart.js @@ -7,7 +7,7 @@ import {interpolate} from 'd3-interpolate'; import {transition} from '../core/core'; import {filters} from '../core/filters'; import {utils, pluck} from '../core/utils'; -import {cpt} from '../core/d3comapt'; +import {cpt} from '../core/d3compat'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; diff --git a/src/core/d3comapt.js b/src/core/d3compat.js similarity index 100% rename from src/core/d3comapt.js rename to src/core/d3compat.js From 68b5cf37cf485ba3517147c19eb3adb0901a050d Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Sat, 29 Aug 2020 20:57:12 +0530 Subject: [PATCH 14/17] Rename `cpt` -> `adaptHandler` --- src/base/bubble-mixin.js | 4 ++-- src/base/coordinate-grid-mixin.js | 6 +++--- src/charts/bar-chart.js | 6 +++--- src/charts/box-plot.js | 4 ++-- src/charts/bubble-chart.js | 4 ++-- src/charts/bubble-overlay.js | 4 ++-- src/charts/cbox-menu.js | 6 +++--- src/charts/geo-choropleth-chart.js | 4 ++-- src/charts/heatmap.js | 8 ++++---- src/charts/html-legend.js | 8 ++++---- src/charts/legend.js | 8 ++++---- src/charts/pie-chart.js | 16 ++++++++-------- src/charts/row-chart.js | 12 ++++++------ src/charts/select-menu.js | 4 ++-- src/charts/sunburst-chart.js | 6 +++--- src/core/d3compat.js | 2 +- 16 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/base/bubble-mixin.js b/src/base/bubble-mixin.js index 08da438b3..a57317c97 100644 --- a/src/base/bubble-mixin.js +++ b/src/base/bubble-mixin.js @@ -4,7 +4,7 @@ import { scaleLinear } from 'd3-scale'; import {ColorMixin} from './color-mixin'; import {transition} from '../core/core'; import {events} from '../core/events'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; /** * This Mixin provides reusable functionalities for any chart that needs to visualize data using bubbles. @@ -150,7 +150,7 @@ export const BubbleMixin = Base => class extends ColorMixin(Base) { label = bubbleGEnter.append('text') .attr('text-anchor', 'middle') .attr('dy', '.3em') - .on('click', cpt(d => this.onClick(d))); + .on('click', adaptHandler(d => this.onClick(d))); } label diff --git a/src/base/coordinate-grid-mixin.js b/src/base/coordinate-grid-mixin.js index 92cd24ea3..873ede43f 100644 --- a/src/base/coordinate-grid-mixin.js +++ b/src/base/coordinate-grid-mixin.js @@ -12,7 +12,7 @@ import {optionalTransition, transition} from '../core/core'; import {units} from '../core/units'; import {constants} from '../core/constants'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; import {logger} from '../core/logger'; import {filters} from '../core/filters'; import {events} from '../core/events'; @@ -78,7 +78,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { this._zoomScale = [1, Infinity]; this._zoomOutRestrict = true; - this._zoom = zoom().on('zoom', cpt((d, evt) => this._onZoom(evt))); + this._zoom = zoom().on('zoom', adaptHandler((d, evt) => this._onZoom(evt))); this._nullZoom = zoom().on('zoom', null); this._hasBeenMouseZoomable = false; this._ignoreZoomEvents = false; // ignore when carrying out programmatic zoom operations @@ -934,7 +934,7 @@ export class CoordinateGridMixin extends ColorMixin(MarginMixin) { renderBrush (g, doTransition) { if (this._brushOn) { - this._brush.on('start brush end', cpt((d, evt) => this._brushing(evt))); + this._brush.on('start brush end', adaptHandler((d, evt) => this._brushing(evt))); // To retrieve selection we need self._gBrush this._gBrush = g.append('g') diff --git a/src/charts/bar-chart.js b/src/charts/bar-chart.js index 1700108b2..756f5147b 100644 --- a/src/charts/bar-chart.js +++ b/src/charts/bar-chart.js @@ -5,7 +5,7 @@ import {transition} from '../core/core'; import {constants} from '../core/constants'; import {logger} from '../core/logger'; import {pluck, utils} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; const MIN_BAR_WIDTH = 1; const DEFAULT_GAP_BETWEEN_BARS = 2; @@ -145,7 +145,7 @@ export class BarChart extends StackMixin { .merge(labels); if (this.isOrdinal()) { - labelsEnterUpdate.on('click', cpt(d => this.onClick(d))); + labelsEnterUpdate.on('click', adaptHandler(d => this.onClick(d))); labelsEnterUpdate.attr('cursor', 'pointer'); } @@ -189,7 +189,7 @@ export class BarChart extends StackMixin { } if (this.isOrdinal()) { - barsEnterUpdate.on('click', cpt(d => this.onClick(d))); + barsEnterUpdate.on('click', adaptHandler(d => this.onClick(d))); } transition(barsEnterUpdate, this.transitionDuration(), this.transitionDelay()) diff --git a/src/charts/box-plot.js b/src/charts/box-plot.js index 4db116386..f08d36367 100644 --- a/src/charts/box-plot.js +++ b/src/charts/box-plot.js @@ -7,7 +7,7 @@ import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; import {units} from '../core/units'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; // Returns a function to compute the interquartile range. function defaultWhiskersIQR (k) { @@ -197,7 +197,7 @@ export class BoxPlot extends CoordinateGridMixin { .attr('class', 'box') .attr('transform', (d, i) => this._boxTransform(d, i)) .call(this._box) - .on('click', cpt(d => { + .on('click', adaptHandler(d => { this.filter(this.keyAccessor()(d)); this.redrawGroup(); })); diff --git a/src/charts/bubble-chart.js b/src/charts/bubble-chart.js index bd40c4127..c46b27c92 100644 --- a/src/charts/bubble-chart.js +++ b/src/charts/bubble-chart.js @@ -1,7 +1,7 @@ import {BubbleMixin} from '../base/bubble-mixin'; import {CoordinateGridMixin} from '../base/coordinate-grid-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; /** * A concrete implementation of a general purpose bubble chart that allows data visualization using the @@ -74,7 +74,7 @@ export class BubbleChart extends BubbleMixin(CoordinateGridMixin) { .attr('class', this.BUBBLE_NODE_CLASS) .attr('transform', d => this._bubbleLocator(d)) .append('circle').attr('class', (d, i) => `${this.BUBBLE_CLASS} _${i}`) - .on('click', cpt(d => this.onClick(d))) + .on('click', adaptHandler(d => this.onClick(d))) .attr('fill', this.getColor) .attr('r', 0); diff --git a/src/charts/bubble-overlay.js b/src/charts/bubble-overlay.js index 1aa0d03ea..a16767975 100644 --- a/src/charts/bubble-overlay.js +++ b/src/charts/bubble-overlay.js @@ -5,7 +5,7 @@ import {BubbleMixin} from '../base/bubble-mixin'; import {transition} from '../core/core'; import {constants} from '../core/constants'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; const BUBBLE_OVERLAY_CLASS = 'bubble-overlay'; const BUBBLE_NODE_CLASS = 'node'; @@ -115,7 +115,7 @@ export class BubbleOverlay extends BubbleMixin(BaseMixin) { .attr('class', BUBBLE_CLASS) .attr('r', 0) .attr('fill', this.getColor) - .on('click', cpt(d => this.onClick(d))); + .on('click', adaptHandler(d => this.onClick(d))); } transition(circle, this.transitionDuration(), this.transitionDelay()) diff --git a/src/charts/cbox-menu.js b/src/charts/cbox-menu.js index 5119ec1f0..6ccec3c5b 100644 --- a/src/charts/cbox-menu.js +++ b/src/charts/cbox-menu.js @@ -3,7 +3,7 @@ import {select} from 'd3-selection'; import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; import {utils} from '../core/utils' -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; const GROUP_CSS_CLASS = 'dc-cbox-group'; const ITEM_CSS_CLASS = 'dc-cbox-item'; @@ -121,7 +121,7 @@ export class CboxMenu extends BaseMixin { .append('input') .attr('type', 'reset') .text(this._promptText) - .on('click', cpt(function (d, evt) { + .on('click', adaptHandler(function (d, evt) { return chart._onChange(d, evt, this); })); } else { @@ -141,7 +141,7 @@ export class CboxMenu extends BaseMixin { .selectAll(`li.${ITEM_CSS_CLASS}`) .sort(this._order); - this._cbox.on('change', cpt(function (d, evt) { + this._cbox.on('change', adaptHandler(function (d, evt) { return chart._onChange(d, evt, this); })); return options; diff --git a/src/charts/geo-choropleth-chart.js b/src/charts/geo-choropleth-chart.js index 1adfd9ee2..214d87ce0 100644 --- a/src/charts/geo-choropleth-chart.js +++ b/src/charts/geo-choropleth-chart.js @@ -7,7 +7,7 @@ import {transition} from '../core/core'; import {logger} from '../core/logger'; import {events} from '../core/events'; import {utils} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; /** * The geo choropleth chart is designed as an easy way to create a crossfilter driven choropleth map @@ -148,7 +148,7 @@ export class GeoChoroplethChart extends ColorMixin(BaseMixin) { } return 'none'; }) - .on('click', cpt(d => this.onClick(d, layerIndex))); + .on('click', adaptHandler(d => this.onClick(d, layerIndex))); transition(paths, this.transitionDuration(), this.transitionDelay()).attr('fill', (d, i) => this.getColor(data[this._geoJson(layerIndex).keyAccessor(d)], i)); diff --git a/src/charts/heatmap.js b/src/charts/heatmap.js index 74f341921..b7eca16d4 100644 --- a/src/charts/heatmap.js +++ b/src/charts/heatmap.js @@ -7,7 +7,7 @@ import {filters} from '../core/filters'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {MarginMixin} from '../base/margin-mixin'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; const DEFAULT_BORDER_RADIUS = 6.75; @@ -232,7 +232,7 @@ export class HeatMap extends ColorMixin(MarginMixin) { .attr('fill', 'white') .attr('x', (d, i) => cols(this.keyAccessor()(d, i))) .attr('y', (d, i) => rows(this.valueAccessor()(d, i))) - .on('click', cpt(this.boxOnClick())); + .on('click', adaptHandler(this.boxOnClick())); boxes = gEnter.merge(boxes); @@ -265,7 +265,7 @@ export class HeatMap extends ColorMixin(MarginMixin) { .style('text-anchor', 'middle') .attr('y', this.effectiveHeight()) .attr('dy', 12) - .on('click', cpt(this.xAxisOnClick())) + .on('click', adaptHandler(this.xAxisOnClick())) .text(this.colsLabel()) .merge(gColsText); @@ -291,7 +291,7 @@ export class HeatMap extends ColorMixin(MarginMixin) { .attr('dx', -2) .attr('y', d => rows(d) + boxHeight / 2) .attr('dy', 6) - .on('click', cpt(this.yAxisOnClick())) + .on('click', adaptHandler(this.yAxisOnClick())) .text(this.rowsLabel()) .merge(gRowsText); diff --git a/src/charts/html-legend.js b/src/charts/html-legend.js index 0395b3104..a97f2e3fa 100644 --- a/src/charts/html-legend.js +++ b/src/charts/html-legend.js @@ -1,7 +1,7 @@ import {select} from 'd3-selection'; import {pluck, utils} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; import {constants} from '../core/constants'; /** @@ -53,9 +53,9 @@ export class HtmlLegend { .data(legendables).enter() .append('div') .classed(legendItemClassName, true) - .on('mouseover', cpt(d => this._parent.legendHighlight(d))) - .on('mouseout', cpt(d => this._parent.legendReset(d))) - .on('click', cpt(d => this._parent.legendToggle(d))); + .on('mouseover', adaptHandler(d => this._parent.legendHighlight(d))) + .on('mouseout', adaptHandler(d => this._parent.legendReset(d))) + .on('click', adaptHandler(d => this._parent.legendToggle(d))); if (this._highlightSelected) { itemEnter.classed(constants.SELECTED_CLASS, d => filters.indexOf(d.name) !== -1); diff --git a/src/charts/legend.js b/src/charts/legend.js index bac041d95..d8b990825 100644 --- a/src/charts/legend.js +++ b/src/charts/legend.js @@ -1,5 +1,5 @@ import {pluck, utils} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; import {constants} from '../core/constants'; const LABEL_GAP = 2; @@ -220,13 +220,13 @@ export class Legend { .enter() .append('g') .attr('class', 'dc-legend-item') - .on('mouseover', cpt(d => { + .on('mouseover', adaptHandler(d => { this._parent.legendHighlight(d); })) - .on('mouseout', cpt(d => { + .on('mouseout', adaptHandler(d => { this._parent.legendReset(d); })) - .on('click', cpt(d => { + .on('click', adaptHandler(d => { d.chart.legendToggle(d); })); diff --git a/src/charts/pie-chart.js b/src/charts/pie-chart.js index ccb95d4d8..285da0b74 100644 --- a/src/charts/pie-chart.js +++ b/src/charts/pie-chart.js @@ -7,7 +7,7 @@ import {CapMixin} from '../base/cap-mixin'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; const DEFAULT_MIN_ANGLE_FOR_LABEL = 0.5; @@ -161,7 +161,7 @@ export class PieChart extends CapMixin(ColorMixin(BaseMixin)) { _createSlicePath (slicesEnter, arcs) { const slicePath = slicesEnter.append('path') .attr('fill', (d, i) => this._fill(d, i)) - .on('click', cpt(d => this._onClick(d))) + .on('click', adaptHandler(d => this._onClick(d))) .attr('d', (d, i) => this._safeArc(d, i, arcs)); const tranNodes = transition(slicePath, this.transitionDuration(), this.transitionDelay()); @@ -214,11 +214,11 @@ export class PieChart extends CapMixin(ColorMixin(BaseMixin)) { } return classes; }) - .on('click', cpt(d => this._onClick(d))) - .on('mouseover', cpt(d => { + .on('click', adaptHandler(d => this._onClick(d))) + .on('mouseover', adaptHandler(d => { this._highlightSlice(d.index, true); })) - .on('mouseout', cpt(d => { + .on('mouseout', adaptHandler(d => { this._highlightSlice(d.index, false); })); this._positionLabels(labelsEnter, arcs); @@ -238,11 +238,11 @@ export class PieChart extends CapMixin(ColorMixin(BaseMixin)) { .enter() .append('polyline') .attr('class', (d, i) => `pie-path _${i} ${this._sliceCssClass}`) - .on('click', cpt(d => this._onClick(d))) - .on('mouseover', cpt(d => { + .on('click', adaptHandler(d => this._onClick(d))) + .on('mouseover', adaptHandler(d => { this._highlightSlice(d.index, true); })) - .on('mouseout', cpt(d => { + .on('mouseout', adaptHandler(d => { this._highlightSlice(d.index, false); })) .merge(polyline); diff --git a/src/charts/row-chart.js b/src/charts/row-chart.js index d86ccc332..efe8f85e8 100644 --- a/src/charts/row-chart.js +++ b/src/charts/row-chart.js @@ -6,7 +6,7 @@ import {CapMixin} from '../base/cap-mixin'; import {MarginMixin} from '../base/margin-mixin'; import {ColorMixin} from '../base/color-mixin'; import {transition} from '../core/core'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; /** * Concrete row chart implementation. @@ -191,7 +191,7 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { const rect = rows.attr('transform', (d, i) => `translate(0,${(i + 1) * this._gap + i * height})`).select('rect') .attr('height', height) .attr('fill', this.getColor) - .on('click', cpt(d => this._onClick(d))) + .on('click', adaptHandler(d => this._onClick(d))) .classed('deselected', d => (this.hasFilter()) ? !this._isSelectedRow(d) : false) .classed('selected', d => (this.hasFilter()) ? this._isSelectedRow(d) : false); @@ -213,12 +213,12 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { _createLabels (rowEnter) { if (this.renderLabel()) { rowEnter.append('text') - .on('click', cpt(d => this._onClick(d))); + .on('click', adaptHandler(d => this._onClick(d))); } if (this.renderTitleLabel()) { rowEnter.append('text') .attr('class', this._titleRowCssClass) - .on('click', cpt(d => this._onClick(d))); + .on('click', adaptHandler(d => this._onClick(d))); } } @@ -228,7 +228,7 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { .attr('x', this._labelOffsetX) .attr('y', this._labelOffsetY) .attr('dy', this._dyOffset) - .on('click', cpt(d => this._onClick(d))) + .on('click', adaptHandler(d => this._onClick(d))) .attr('class', (d, i) => `${this._rowCssClass} _${i}`) .text(d => this.label()(d)); transition(lab, this.transitionDuration(), this.transitionDelay()) @@ -240,7 +240,7 @@ export class RowChart extends CapMixin(ColorMixin(MarginMixin)) { .attr('y', this._labelOffsetY) .attr('dy', this._dyOffset) .attr('text-anchor', 'end') - .on('click', cpt(d => this._onClick(d))) + .on('click', adaptHandler(d => this._onClick(d))) .attr('class', (d, i) => `${this._titleRowCssClass} _${i}`) .text(d => this.title()(d)); transition(titlelab, this.transitionDuration(), this.transitionDelay()) diff --git a/src/charts/select-menu.js b/src/charts/select-menu.js index 97d489b21..d3cf05074 100644 --- a/src/charts/select-menu.js +++ b/src/charts/select-menu.js @@ -1,7 +1,7 @@ import {events} from '../core/events'; import {BaseMixin} from '../base/base-mixin'; import {logger} from '../core/logger'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; const SELECT_CSS_CLASS = 'dc-select-menu'; const OPTION_CSS_CLASS = 'dc-select-option'; @@ -96,7 +96,7 @@ export class SelectMenu extends BaseMixin { this._select.selectAll(`option.${OPTION_CSS_CLASS}`).sort(this._order); - this._select.on('change', cpt((d, evt) => this._onChange(d, evt))); + this._select.on('change', adaptHandler((d, evt) => this._onChange(d, evt))); } _onChange (_d, evt) { diff --git a/src/charts/sunburst-chart.js b/src/charts/sunburst-chart.js index f6577a32e..32a6a2d94 100644 --- a/src/charts/sunburst-chart.js +++ b/src/charts/sunburst-chart.js @@ -7,7 +7,7 @@ import {interpolate} from 'd3-interpolate'; import {transition} from '../core/core'; import {filters} from '../core/filters'; import {utils, pluck} from '../core/utils'; -import {cpt} from '../core/d3compat'; +import {adaptHandler} from '../core/d3compat'; import {events} from '../core/events'; import {ColorMixin} from '../base/color-mixin'; import {BaseMixin} from '../base/base-mixin'; @@ -172,7 +172,7 @@ export class SunburstChart extends ColorMixin(BaseMixin) { _createSlicePath (slicesEnter, arcs) { const slicePath = slicesEnter.append('path') .attr('fill', (d, i) => this._fill(d, i)) - .on('click', cpt(d => this.onClick(d))) + .on('click', adaptHandler(d => this.onClick(d))) .attr('d', d => this._safeArc(arcs, d)); const tranNodes = transition(slicePath, this.transitionDuration()); @@ -220,7 +220,7 @@ export class SunburstChart extends ColorMixin(BaseMixin) { } return classes; }) - .on('click', cpt(d => this.onClick(d))); + .on('click', adaptHandler(d => this.onClick(d))); this._positionLabels(labelsEnter, arcs); } } diff --git a/src/core/d3compat.js b/src/core/d3compat.js index 00e2909bd..28059516d 100644 --- a/src/core/d3compat.js +++ b/src/core/d3compat.js @@ -7,7 +7,7 @@ import {groups} from 'd3-array'; // Otherwise we assume lower versions of d3. // The underlying handler will always receive bound datum as the first argument and the event as the second argument. // It is possible that any of these can actually be undefined (or null). -export function cpt (handler) { +export function adaptHandler (handler) { return function (a, b) { if (a && a.target) { // d3@v6 - b is __data__, a is the event From a598386f9cdf58a9dcaffbe20b06d5bbd3e0c4c5 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Wed, 26 Aug 2020 19:59:49 +0530 Subject: [PATCH 15/17] Update package.json to d3@6, remove hard-coded versions of d3 components, add d3-collection as dev-dependency. --- package-lock.json | 419 ++++++++++++++++++++++++---------------------- package.json | 19 +-- 2 files changed, 218 insertions(+), 220 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1b8d8421f..df7720141 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "dc", - "version": "4.0.4", + "version": "4.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1625,59 +1625,181 @@ } }, "d3": { - "version": "5.15.1", - "resolved": "https://registry.npmjs.org/d3/-/d3-5.15.1.tgz", - "integrity": "sha512-Xu9gT6Lm0jH3wWJJSRomFwqnGGi3YAfWIfxNFl4++YVgYOjo3F8V2idAG3nJBgpZOkD0/RHPZX6F4k6tzgOvYw==", - "requires": { - "d3-array": "1", - "d3-axis": "1", - "d3-brush": "1", - "d3-chord": "1", - "d3-collection": "1", - "d3-color": "1", - "d3-contour": "1", - "d3-dispatch": "1", - "d3-drag": "1", - "d3-dsv": "1", - "d3-ease": "1", - "d3-fetch": "1", - "d3-force": "1", - "d3-format": "1", - "d3-geo": "1", - "d3-hierarchy": "1", - "d3-interpolate": "1", - "d3-path": "1", - "d3-polygon": "1", - "d3-quadtree": "1", - "d3-random": "1", - "d3-scale": "2", - "d3-scale-chromatic": "1", - "d3-selection": "1", - "d3-shape": "1", - "d3-time": "1", - "d3-time-format": "2", - "d3-timer": "1", - "d3-transition": "1", - "d3-voronoi": "1", - "d3-zoom": "1" + "version": "6.0.0-rc.4", + "resolved": "https://registry.npmjs.org/d3/-/d3-6.0.0-rc.4.tgz", + "integrity": "sha512-Wpu0Ibnx2O316I+eoeZtYoAITKALlQhrXsZdxH2TWDkPGkEHqwpwjwsIFtLEkTlKkBzPhMkvVYPROuB2HPpB7w==", + "requires": { + "d3-array": "^2.5", + "d3-axis": "2", + "d3-brush": "2", + "d3-chord": "2", + "d3-color": "2", + "d3-contour": "2", + "d3-delaunay": "5", + "d3-dispatch": "2", + "d3-drag": "2", + "d3-dsv": "2", + "d3-ease": "2", + "d3-fetch": "2", + "d3-force": "2", + "d3-format": "2", + "d3-geo": "2", + "d3-hierarchy": "2", + "d3-interpolate": "2", + "d3-path": "2", + "d3-polygon": "2", + "d3-quadtree": "2", + "d3-random": "2", + "d3-scale": "3", + "d3-scale-chromatic": "2", + "d3-selection": "2", + "d3-shape": "2", + "d3-time": "2", + "d3-time-format": "3", + "d3-timer": "2", + "d3-transition": "2", + "d3-zoom": "2" }, "dependencies": { "d3-array": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz", - "integrity": "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw==" + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.6.0.tgz", + "integrity": "sha512-1TgzIGb6hrHKSCGccdL209Ibk41HCeyv5znFEvJfBsBGhD3qpoHt/2W2ECpyLxpG1k7aNJz0BYrmLpVs9hIGNQ==" }, - "d3-scale": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-2.2.2.tgz", - "integrity": "sha512-LbeEvGgIb8UMcAa0EATLNX0lelKWGYDQiPdHj+gLblGVhGLyNbaCn3EvrJf0A3Y/uOOU5aD6MTh5ZFCdEwGiCw==", + "d3-axis": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-2.0.0.tgz", + "integrity": "sha512-9nzB0uePtb+u9+dWir+HTuEAKJOEUYJoEwbJPsZ1B4K3iZUgzJcSENQ05Nj7S4CIfbZZ8/jQGoUzGKFznBhiiQ==" + }, + "d3-brush": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-2.0.0.tgz", + "integrity": "sha512-6j6WlvjsCC4whOctLfda8qRcrARwVfPlWmYXhrpazHK19GOjpN6CyWw9rP6bL3iXSj/aj3weLLKaGFQwd65KXg==", + "requires": { + "d3-dispatch": "1 - 2", + "d3-drag": "2", + "d3-interpolate": "1 - 2", + "d3-selection": "2", + "d3-transition": "2" + } + }, + "d3-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-2.0.0.tgz", + "integrity": "sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==" + }, + "d3-dispatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-2.0.0.tgz", + "integrity": "sha512-S/m2VsXI7gAti2pBoLClFFTMOO1HTtT0j99AuXLoGFKO6deHDdnv6ZGTxSTTUTgO1zVcv82fCOtDjYK4EECmWA==" + }, + "d3-drag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-2.0.0.tgz", + "integrity": "sha512-g9y9WbMnF5uqB9qKqwIIa/921RYWzlUDv9Jl1/yONQwxbOfszAWTCm8u7HOTgJgRDXiRZN56cHT9pd24dmXs8w==", + "requires": { + "d3-dispatch": "1 - 2", + "d3-selection": "2" + } + }, + "d3-ease": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-2.0.0.tgz", + "integrity": "sha512-68/n9JWarxXkOWMshcT5IcjbB+agblQUaIsbnXmrzejn2O82n3p2A9R2zEB9HIEFWKFwPAEDDN8gR0VdSAyyAQ==" + }, + "d3-format": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-2.0.0.tgz", + "integrity": "sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==" + }, + "d3-geo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.0.tgz", + "integrity": "sha512-28x4nHfMpTDOXlOXv2gb3WS6L4mtaWdz5ctC6ow+lGiFOpmc+8OtnDjAupCPBjQ+bMWUvP3F89akr94o//cXLQ==", + "requires": { + "d3-array": "^2.5" + } + }, + "d3-hierarchy": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-2.0.0.tgz", + "integrity": "sha512-SwIdqM3HxQX2214EG9GTjgmCc/mbSx4mQBn+DuEETubhOw6/U3fmnji4uCVrmzOydMHSO1nZle5gh6HB/wdOzw==" + }, + "d3-interpolate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-2.0.1.tgz", + "integrity": "sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==", + "requires": { + "d3-color": "1 - 2" + } + }, + "d3-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-2.0.0.tgz", + "integrity": "sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA==" + }, + "d3-scale-chromatic": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-2.0.0.tgz", + "integrity": "sha512-LLqy7dJSL8yDy7NRmf6xSlsFZ6zYvJ4BcWFE4zBrOPnQERv9zj24ohnXKRbyi9YHnYV+HN1oEO3iFK971/gkzA==", + "requires": { + "d3-color": "1 - 2", + "d3-interpolate": "1 - 2" + } + }, + "d3-selection": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-2.0.0.tgz", + "integrity": "sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA==" + }, + "d3-shape": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-2.0.0.tgz", + "integrity": "sha512-djpGlA779ua+rImicYyyjnOjeubyhql1Jyn1HK0bTyawuH76UQRWXd+pftr67H6Fa8hSwetkgb/0id3agKWykw==", + "requires": { + "d3-path": "1 - 2" + } + }, + "d3-time": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.0.0.tgz", + "integrity": "sha512-2mvhstTFcMvwStWd9Tj3e6CEqtOivtD8AUiHT8ido/xmzrI9ijrUUihZ6nHuf/vsScRBonagOdj0Vv+SEL5G3Q==" + }, + "d3-time-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz", + "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==", + "requires": { + "d3-time": "1 - 2" + } + }, + "d3-timer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-2.0.0.tgz", + "integrity": "sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA==" + }, + "d3-transition": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-2.0.0.tgz", + "integrity": "sha512-42ltAGgJesfQE3u9LuuBHNbGrI/AJjNL2OAUdclE70UE6Vy239GCBEYD38uBPoLeNsOhFStGpPI0BAOV+HMxog==", + "requires": { + "d3-color": "1 - 2", + "d3-dispatch": "1 - 2", + "d3-ease": "1 - 2", + "d3-interpolate": "1 - 2", + "d3-timer": "1 - 2" + } + }, + "d3-zoom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-2.0.0.tgz", + "integrity": "sha512-fFg7aoaEm9/jf+qfstak0IYpnesZLiMX6GZvXtUSdv8RH2o4E2qeelgdU09eKS6wGuiGMfcnMI0nTIqWzRHGpw==", "requires": { - "d3-array": "^1.2.0", - "d3-collection": "1", - "d3-format": "1", - "d3-interpolate": "1", - "d3-time": "1", - "d3-time-format": "2" + "d3-dispatch": "1 - 2", + "d3-drag": "2", + "d3-interpolate": "1 - 2", + "d3-selection": "2", + "d3-transition": "2" } } } @@ -1685,46 +1807,21 @@ "d3-array": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", - "dev": true - }, - "d3-axis": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-1.0.12.tgz", - "integrity": "sha512-ejINPfPSNdGFKEOAtnBtdkpr24c4d4jsei6Lg98mxf424ivoDP2956/5HDpIAtmHo85lqT4pruy+zEgvRUBqaQ==" - }, - "d3-brush": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-1.1.5.tgz", - "integrity": "sha512-rEaJ5gHlgLxXugWjIkolTA0OyMvw8UWU1imYXy1v642XyyswmI1ybKOv05Ft+ewq+TFmdliD3VuK0pRp1VT/5A==", - "requires": { - "d3-dispatch": "1", - "d3-drag": "1", - "d3-interpolate": "1", - "d3-selection": "1", - "d3-transition": "1" - } + "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==" }, "d3-chord": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-1.0.6.tgz", - "integrity": "sha512-JXA2Dro1Fxw9rJe33Uv+Ckr5IrAa74TlfDEhE/jfLOaXegMQFQTAgAw9WnZL8+HxVBRXaRGCkrNU7pJeylRIuA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-2.0.0.tgz", + "integrity": "sha512-D5PZb7EDsRNdGU4SsjQyKhja8Zgu+SHZfUSO5Ls8Wsn+jsAKUUGkcshLxMg9HDFxG3KqavGWaWkJ8EpU8ojuig==", "requires": { - "d3-array": "1", - "d3-path": "1" - }, - "dependencies": { - "d3-array": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz", - "integrity": "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw==" - } + "d3-path": "1 - 2" } }, "d3-collection": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.7.tgz", - "integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==" + "integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==", + "dev": true }, "d3-color": { "version": "1.4.0", @@ -1732,18 +1829,19 @@ "integrity": "sha512-TzNPeJy2+iEepfiL92LAAB7fvnp/dV2YwANPVHdDWmYMm23qIJBYww3qT8I8C1wXrmrg4UWs7BKc2tKIgyjzHg==" }, "d3-contour": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-1.3.2.tgz", - "integrity": "sha512-hoPp4K/rJCu0ladiH6zmJUEz6+u3lgR+GSm/QdM2BBvDraU39Vr7YdDCicJcxP1z8i9B/2dJLgDC1NcvlF8WCg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-2.0.0.tgz", + "integrity": "sha512-9unAtvIaNk06UwqBmvsdHX7CZ+NPDZnn8TtNH1myW93pWJkhsV25JcgnYAu0Ck5Veb1DHiCv++Ic5uvJ+h50JA==", "requires": { - "d3-array": "^1.1.1" - }, - "dependencies": { - "d3-array": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz", - "integrity": "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw==" - } + "d3-array": "2" + } + }, + "d3-delaunay": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-5.3.0.tgz", + "integrity": "sha512-amALSrOllWVLaHTnDLHwMIiz0d1bBu9gZXd1FiLfXf8sHcX9jrcj81TVZOqD4UX7MgBZZ07c8GxzEgBpJqc74w==", + "requires": { + "delaunator": "4" } }, "d3-dispatch": { @@ -1751,47 +1849,32 @@ "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-1.0.6.tgz", "integrity": "sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA==" }, - "d3-drag": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-1.2.5.tgz", - "integrity": "sha512-rD1ohlkKQwMZYkQlYVCrSFxsWPzI97+W+PaEIBNTMxRuxz9RF0Hi5nJWHGVJ3Om9d2fRTe1yOBINJyy/ahV95w==", - "requires": { - "d3-dispatch": "1", - "d3-selection": "1" - } - }, "d3-dsv": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-1.2.0.tgz", - "integrity": "sha512-9yVlqvZcSOMhCYzniHE7EVUws7Fa1zgw+/EAV2BxJoG3ME19V6BQFBwI855XQDsxyOuG7NibqRMTtiF/Qup46g==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-2.0.0.tgz", + "integrity": "sha512-E+Pn8UJYx9mViuIUkoc93gJGGYut6mSDKy2+XaPwccwkRGlR+LO97L2VCCRjQivTwLHkSnAJG7yo00BWY6QM+w==", "requires": { "commander": "2", "iconv-lite": "0.4", "rw": "1" } }, - "d3-ease": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.6.tgz", - "integrity": "sha512-SZ/lVU7LRXafqp7XtIcBdxnWl8yyLpgOmzAk0mWBI9gXNzLDx5ybZgnRbH9dN/yY5tzVBqCQ9avltSnqVwessQ==" - }, "d3-fetch": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-1.1.2.tgz", - "integrity": "sha512-S2loaQCV/ZeyTyIF2oP8D1K9Z4QizUzW7cWeAOAS4U88qOt3Ucf6GsmgthuYSdyB2HyEm4CeGvkQxWsmInsIVA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-2.0.0.tgz", + "integrity": "sha512-TkYv/hjXgCryBeNKiclrwqZH7Nb+GaOwo3Neg24ZVWA3MKB+Rd+BY84Nh6tmNEMcjUik1CSUWjXYndmeO6F7sw==", "requires": { - "d3-dsv": "1" + "d3-dsv": "1 - 2" } }, "d3-force": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-1.2.1.tgz", - "integrity": "sha512-HHvehyaiUlVo5CxBJ0yF/xny4xoaxFxDnBXNvNcfW9adORGZfyNF1dj6DGLKyk4Yh3brP/1h3rnDzdIAwL08zg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-2.1.1.tgz", + "integrity": "sha512-nAuHEzBqMvpFVMf9OX75d00OxvOXdxY+xECIXjW6Gv8BRrXu6gAWbv/9XKrvfJ5i5DCokDW7RYE50LRoK092ew==", "requires": { - "d3-collection": "1", - "d3-dispatch": "1", - "d3-quadtree": "1", - "d3-timer": "1" + "d3-dispatch": "1 - 2", + "d3-quadtree": "1 - 2", + "d3-timer": "1 - 2" } }, "d3-format": { @@ -1799,26 +1882,6 @@ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.4.tgz", "integrity": "sha512-TWks25e7t8/cqctxCmxpUuzZN11QxIA7YrMbram94zMQ0PXjE4LVIMe/f6a4+xxL8HQ3OsAFULOINQi1pE62Aw==" }, - "d3-geo": { - "version": "1.11.9", - "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-1.11.9.tgz", - "integrity": "sha512-9edcH6J3s/Aa3KJITWqFJbyB/8q3mMlA9Fi7z6yy+FAYMnRaxmC7jBhUnsINxVWD14GmqX3DK8uk7nV6/Ekt4A==", - "requires": { - "d3-array": "1" - }, - "dependencies": { - "d3-array": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.4.tgz", - "integrity": "sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw==" - } - } - }, - "d3-hierarchy": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-1.1.9.tgz", - "integrity": "sha512-j8tPxlqh1srJHAtxfvOUwKNYJkQuBFdM1+JAUfq6xqH5eAqf93L7oG1NVqDa4CpFZNvnNKtCYEUC8KY9yEn9lQ==" - }, "d3-interpolate": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.4.0.tgz", @@ -1833,25 +1896,24 @@ "integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==" }, "d3-polygon": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-1.0.6.tgz", - "integrity": "sha512-k+RF7WvI08PC8reEoXa/w2nSg5AUMTi+peBD9cmFc+0ixHfbs4QmxxkarVal1IkVkgxVuk9JSHhJURHiyHKAuQ==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-2.0.0.tgz", + "integrity": "sha512-MsexrCK38cTGermELs0cO1d79DcTsQRN7IWMJKczD/2kBjzNXxLUWP33qRF6VDpiLV/4EI4r6Gs0DAWQkE8pSQ==" }, "d3-quadtree": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-1.0.7.tgz", - "integrity": "sha512-RKPAeXnkC59IDGD0Wu5mANy0Q2V28L+fNe65pOCXVdVuTJS3WPKaJlFHer32Rbh9gIo9qMuJXio8ra4+YmIymA==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-2.0.0.tgz", + "integrity": "sha512-b0Ed2t1UUalJpc3qXzKi+cPGxeXRr4KU9YSlocN74aTzp6R/Ud43t79yLLqxHRWZfsvWXmbDWPpoENK1K539xw==" }, "d3-random": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-1.1.2.tgz", - "integrity": "sha512-6AK5BNpIFqP+cx/sreKzNjWbwZQCSUatxq+pPRmFIQaWuoD+NrbVWw7YWpHiXpCQ/NanKdtGDuB+VQcZDaEmYQ==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-2.2.0.tgz", + "integrity": "sha512-CPLYfjoR3IebCGAUH+Y+RX/XH7z8AQVgFobSklswVvNSHUdiiSN9vn6ymTVkvTc1lDbcjf+zay5fMxC0o7Y7/g==" }, "d3-scale": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.1.tgz", "integrity": "sha512-huz5byJO/6MPpz6Q8d4lg7GgSpTjIZW/l+1MQkzKfu2u8P6hjaXaStOpmyrD6ymKoW87d2QVFCKvSjLwjzx/rA==", - "dev": true, "requires": { "d3-array": "1.2.0 - 2", "d3-format": "1", @@ -1860,28 +1922,6 @@ "d3-time-format": "2" } }, - "d3-scale-chromatic": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-1.5.0.tgz", - "integrity": "sha512-ACcL46DYImpRFMBcpk9HhtIyC7bTBR4fNOPxwVSl0LfulDAwyiHyPOTqcDG1+t5d4P9W7t/2NAuWu59aKko/cg==", - "requires": { - "d3-color": "1", - "d3-interpolate": "1" - } - }, - "d3-selection": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-1.4.1.tgz", - "integrity": "sha512-BTIbRjv/m5rcVTfBs4AMBLKs4x8XaaLkwm28KWu9S2vKNqXkXt2AH2Qf0sdPZHjFxcWg/YL53zcqAz+3g4/7PA==" - }, - "d3-shape": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz", - "integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==", - "requires": { - "d3-path": "1" - } - }, "d3-time": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz", @@ -1900,36 +1940,6 @@ "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.10.tgz", "integrity": "sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw==" }, - "d3-transition": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-1.3.2.tgz", - "integrity": "sha512-sc0gRU4PFqZ47lPVHloMn9tlPcv8jxgOQg+0zjhfZXMQuvppjG6YuwdMBE0TuqCZjeJkLecku/l9R0JPcRhaDA==", - "requires": { - "d3-color": "1", - "d3-dispatch": "1", - "d3-ease": "1", - "d3-interpolate": "1", - "d3-selection": "^1.1.0", - "d3-timer": "1" - } - }, - "d3-voronoi": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/d3-voronoi/-/d3-voronoi-1.1.4.tgz", - "integrity": "sha512-dArJ32hchFsrQ8uMiTBLq256MpnZjeuBtdHpaDlYuQyjU0CVzCJl/BVW+SkszaAeH95D/8gxqAhgx0ouAWAfRg==" - }, - "d3-zoom": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-1.8.3.tgz", - "integrity": "sha512-VoLXTK4wvy1a0JpH2Il+F2CiOhVu7VRXWF5M/LroMIh3/zBAC3WAt7QoIvPibOavVo20hN6/37vwAsdBejLyKQ==", - "requires": { - "d3-dispatch": "1", - "d3-drag": "1", - "d3-interpolate": "1", - "d3-selection": "1", - "d3-transition": "1" - } - }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -2047,6 +2057,11 @@ } } }, + "delaunator": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-4.0.1.tgz", + "integrity": "sha512-WNPWi1IRKZfCt/qIDMfERkDp93+iZEmOxN2yy4Jg+Xhv8SLk2UTqqbe1sfiipn0and9QrE914/ihdx82Y/Giag==" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", diff --git a/package.json b/package.json index aaf0b25c3..b0e44b884 100644 --- a/package.json +++ b/package.json @@ -25,29 +25,12 @@ "url": "https://github.com/dc-js/dc.js.git" }, "dependencies": { - "d3": "^5.15.1" + "d3": "^6.0.0-rc.4" }, "devDependencies": { "compare-versions": "^3.6.0", "crossfilter2": "^1.5.2", - "d3-array": "^2.4.0", - "d3-axis": "^1.0.12", - "d3-brush": "^1.1.5", "d3-collection": "^1.0.7", - "d3-dispatch": "^1.0.6", - "d3-ease": "^1.0.6", - "d3-format": "^1.4.4", - "d3-geo": "^1.11.9", - "d3-hierarchy": "^1.1.9", - "d3-interpolate": "^1.4.0", - "d3-scale": "^3.2.1", - "d3-scale-chromatic": "^1.5.0", - "d3-selection": "^1.4.1", - "d3-shape": "^1.3.7", - "d3-time": "^1.1.0", - "d3-time-format": "^2.2.3", - "d3-timer": "^1.0.10", - "d3-zoom": "^1.8.3", "eslint": "^6.8.0", "eslint-plugin-import": "^2.20.2", "eslint-plugin-node": "^10.0.0", From b31300a61fff9e5e5afb6ee91ab87c8ba3903f01 Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Thu, 27 Aug 2020 17:23:58 +0530 Subject: [PATCH 16/17] d3@v6 compatible, change `hyphen-minus (U+002D)` to `unicode minus (U+2212)` --- spec/bar-chart-spec.js | 12 ++++++------ spec/line-chart-spec.js | 8 ++++---- spec/row-chart-spec.js | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spec/bar-chart-spec.js b/spec/bar-chart-spec.js index 099408e90..a744fb022 100644 --- a/spec/bar-chart-spec.js +++ b/spec/bar-chart-spec.js @@ -160,8 +160,8 @@ describe('dc.BarChart', () => { }); it('should generate the y-axis domain dynamically', () => { - expect(nthYAxisText(0).text()).toMatch(/-10/); - expect(nthYAxisText(1).text()).toMatch(/-5/); + expect(nthYAxisText(0).text()).toMatch(/−10/); + expect(nthYAxisText(1).text()).toMatch(/−5/); expect(nthYAxisText(2).text()).toBe('0'); }); @@ -583,7 +583,7 @@ describe('dc.BarChart', () => { return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]); }; - expect(nthText(0).text()).toBe('-20'); + expect(nthText(0).text()).toBe('−20'); expect(nthText(1).text()).toBe('0'); expect(nthText(2).text()).toBe('20'); }); @@ -609,9 +609,9 @@ describe('dc.BarChart', () => { return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]); }; - expect(nthText(0).text()).toBe('-30'); - expect(nthText(1).text()).toBe('-20'); - expect(nthText(2).text()).toBe('-10'); + expect(nthText(0).text()).toBe('−30'); + expect(nthText(1).text()).toBe('−20'); + expect(nthText(2).text()).toBe('−10'); expect(nthText(3).text()).toBe('0'); }); }); diff --git a/spec/line-chart-spec.js b/spec/line-chart-spec.js index 5dcf1f471..5fa38722f 100644 --- a/spec/line-chart-spec.js +++ b/spec/line-chart-spec.js @@ -562,7 +562,7 @@ describe('dc.lineChart', () => { return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]); }; - expect(nthText(0).text()).toBe('-20'); + expect(nthText(0).text()).toBe('−20'); expect(nthText(1).text()).toBe('0'); expect(nthText(2).text()).toBe('20'); }); @@ -598,9 +598,9 @@ describe('dc.lineChart', () => { return d3.select(chart.selectAll('g.axis.y .tick text').nodes()[n]); }; - expect(nthText(0).text()).toBe('-30'); - expect(nthText(1).text()).toBe('-20'); - expect(nthText(2).text()).toBe('-10'); + expect(nthText(0).text()).toBe('−30'); + expect(nthText(1).text()).toBe('−20'); + expect(nthText(2).text()).toBe('−10'); expect(nthText(3).text()).toBe('0'); }); }); diff --git a/spec/row-chart-spec.js b/spec/row-chart-spec.js index 2f05bbf37..36baa1167 100644 --- a/spec/row-chart-spec.js +++ b/spec/row-chart-spec.js @@ -460,7 +460,7 @@ describe('dc.rowChart', () => { } itShouldBehaveLikeARowChartWithGroup(positiveGroupHolder, 5, ['0', '5', '10']); - itShouldBehaveLikeARowChartWithGroup(negativeGroupHolder, 5, ['-10', '-5', '0']); - itShouldBehaveLikeARowChartWithGroup(mixedGroupHolder, 5, ['-5', '0', '5']); + itShouldBehaveLikeARowChartWithGroup(negativeGroupHolder, 5, ['−10', '−5', '0']); + itShouldBehaveLikeARowChartWithGroup(mixedGroupHolder, 5, ['−5', '0', '5']); itShouldBehaveLikeARowChartWithGroup(largerGroupHolder, 7); }); From 0536ed3271881b36e67c99e77c879a164877c52f Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Sat, 29 Aug 2020 14:34:11 +0530 Subject: [PATCH 17/17] Update d3@v6 to 6.0.0 (general release) --- package-lock.json | 319 +++++++++++++++++++--------------------------- package.json | 2 +- 2 files changed, 134 insertions(+), 187 deletions(-) diff --git a/package-lock.json b/package-lock.json index df7720141..b790a96a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1625,11 +1625,11 @@ } }, "d3": { - "version": "6.0.0-rc.4", - "resolved": "https://registry.npmjs.org/d3/-/d3-6.0.0-rc.4.tgz", - "integrity": "sha512-Wpu0Ibnx2O316I+eoeZtYoAITKALlQhrXsZdxH2TWDkPGkEHqwpwjwsIFtLEkTlKkBzPhMkvVYPROuB2HPpB7w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/d3/-/d3-6.0.0.tgz", + "integrity": "sha512-FbGsXEeDSgkSm40OfQusP+1paVCdek9NETX+YicfStMvw+bj5KqqaKXNWFTiAgS1RcZRsdqesG9zVn+RdBbBQg==", "requires": { - "d3-array": "^2.5", + "d3-array": "2", "d3-axis": "2", "d3-brush": "2", "d3-chord": "2", @@ -1659,155 +1659,29 @@ "d3-timer": "2", "d3-transition": "2", "d3-zoom": "2" - }, - "dependencies": { - "d3-array": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.6.0.tgz", - "integrity": "sha512-1TgzIGb6hrHKSCGccdL209Ibk41HCeyv5znFEvJfBsBGhD3qpoHt/2W2ECpyLxpG1k7aNJz0BYrmLpVs9hIGNQ==" - }, - "d3-axis": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-2.0.0.tgz", - "integrity": "sha512-9nzB0uePtb+u9+dWir+HTuEAKJOEUYJoEwbJPsZ1B4K3iZUgzJcSENQ05Nj7S4CIfbZZ8/jQGoUzGKFznBhiiQ==" - }, - "d3-brush": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-2.0.0.tgz", - "integrity": "sha512-6j6WlvjsCC4whOctLfda8qRcrARwVfPlWmYXhrpazHK19GOjpN6CyWw9rP6bL3iXSj/aj3weLLKaGFQwd65KXg==", - "requires": { - "d3-dispatch": "1 - 2", - "d3-drag": "2", - "d3-interpolate": "1 - 2", - "d3-selection": "2", - "d3-transition": "2" - } - }, - "d3-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-2.0.0.tgz", - "integrity": "sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==" - }, - "d3-dispatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-2.0.0.tgz", - "integrity": "sha512-S/m2VsXI7gAti2pBoLClFFTMOO1HTtT0j99AuXLoGFKO6deHDdnv6ZGTxSTTUTgO1zVcv82fCOtDjYK4EECmWA==" - }, - "d3-drag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-2.0.0.tgz", - "integrity": "sha512-g9y9WbMnF5uqB9qKqwIIa/921RYWzlUDv9Jl1/yONQwxbOfszAWTCm8u7HOTgJgRDXiRZN56cHT9pd24dmXs8w==", - "requires": { - "d3-dispatch": "1 - 2", - "d3-selection": "2" - } - }, - "d3-ease": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-2.0.0.tgz", - "integrity": "sha512-68/n9JWarxXkOWMshcT5IcjbB+agblQUaIsbnXmrzejn2O82n3p2A9R2zEB9HIEFWKFwPAEDDN8gR0VdSAyyAQ==" - }, - "d3-format": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-2.0.0.tgz", - "integrity": "sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==" - }, - "d3-geo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.0.tgz", - "integrity": "sha512-28x4nHfMpTDOXlOXv2gb3WS6L4mtaWdz5ctC6ow+lGiFOpmc+8OtnDjAupCPBjQ+bMWUvP3F89akr94o//cXLQ==", - "requires": { - "d3-array": "^2.5" - } - }, - "d3-hierarchy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-2.0.0.tgz", - "integrity": "sha512-SwIdqM3HxQX2214EG9GTjgmCc/mbSx4mQBn+DuEETubhOw6/U3fmnji4uCVrmzOydMHSO1nZle5gh6HB/wdOzw==" - }, - "d3-interpolate": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-2.0.1.tgz", - "integrity": "sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==", - "requires": { - "d3-color": "1 - 2" - } - }, - "d3-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-2.0.0.tgz", - "integrity": "sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA==" - }, - "d3-scale-chromatic": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-2.0.0.tgz", - "integrity": "sha512-LLqy7dJSL8yDy7NRmf6xSlsFZ6zYvJ4BcWFE4zBrOPnQERv9zj24ohnXKRbyi9YHnYV+HN1oEO3iFK971/gkzA==", - "requires": { - "d3-color": "1 - 2", - "d3-interpolate": "1 - 2" - } - }, - "d3-selection": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-2.0.0.tgz", - "integrity": "sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA==" - }, - "d3-shape": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-2.0.0.tgz", - "integrity": "sha512-djpGlA779ua+rImicYyyjnOjeubyhql1Jyn1HK0bTyawuH76UQRWXd+pftr67H6Fa8hSwetkgb/0id3agKWykw==", - "requires": { - "d3-path": "1 - 2" - } - }, - "d3-time": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.0.0.tgz", - "integrity": "sha512-2mvhstTFcMvwStWd9Tj3e6CEqtOivtD8AUiHT8ido/xmzrI9ijrUUihZ6nHuf/vsScRBonagOdj0Vv+SEL5G3Q==" - }, - "d3-time-format": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz", - "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==", - "requires": { - "d3-time": "1 - 2" - } - }, - "d3-timer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-2.0.0.tgz", - "integrity": "sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA==" - }, - "d3-transition": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-2.0.0.tgz", - "integrity": "sha512-42ltAGgJesfQE3u9LuuBHNbGrI/AJjNL2OAUdclE70UE6Vy239GCBEYD38uBPoLeNsOhFStGpPI0BAOV+HMxog==", - "requires": { - "d3-color": "1 - 2", - "d3-dispatch": "1 - 2", - "d3-ease": "1 - 2", - "d3-interpolate": "1 - 2", - "d3-timer": "1 - 2" - } - }, - "d3-zoom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-2.0.0.tgz", - "integrity": "sha512-fFg7aoaEm9/jf+qfstak0IYpnesZLiMX6GZvXtUSdv8RH2o4E2qeelgdU09eKS6wGuiGMfcnMI0nTIqWzRHGpw==", - "requires": { - "d3-dispatch": "1 - 2", - "d3-drag": "2", - "d3-interpolate": "1 - 2", - "d3-selection": "2", - "d3-transition": "2" - } - } } }, "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==" + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.6.0.tgz", + "integrity": "sha512-1TgzIGb6hrHKSCGccdL209Ibk41HCeyv5znFEvJfBsBGhD3qpoHt/2W2ECpyLxpG1k7aNJz0BYrmLpVs9hIGNQ==" + }, + "d3-axis": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-2.0.0.tgz", + "integrity": "sha512-9nzB0uePtb+u9+dWir+HTuEAKJOEUYJoEwbJPsZ1B4K3iZUgzJcSENQ05Nj7S4CIfbZZ8/jQGoUzGKFznBhiiQ==" + }, + "d3-brush": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-2.1.0.tgz", + "integrity": "sha512-cHLLAFatBATyIKqZOkk/mDHUbzne2B3ZwxkzMHvFTCZCmLaXDpZRihQSn8UNXTkGD/3lb/W2sQz0etAftmHMJQ==", + "requires": { + "d3-dispatch": "1 - 2", + "d3-drag": "2", + "d3-interpolate": "1 - 2", + "d3-selection": "2", + "d3-transition": "2" + } }, "d3-chord": { "version": "2.0.0", @@ -1824,9 +1698,9 @@ "dev": true }, "d3-color": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-1.4.0.tgz", - "integrity": "sha512-TzNPeJy2+iEepfiL92LAAB7fvnp/dV2YwANPVHdDWmYMm23qIJBYww3qT8I8C1wXrmrg4UWs7BKc2tKIgyjzHg==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-2.0.0.tgz", + "integrity": "sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==" }, "d3-contour": { "version": "2.0.0", @@ -1845,9 +1719,18 @@ } }, "d3-dispatch": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-1.0.6.tgz", - "integrity": "sha512-fVjoElzjhCEy+Hbn8KygnmMS7Or0a9sI2UzGwoB7cCtvI1XpVN9GpoYlnb3xt2YV66oXYb1fLJ8GMvP4hdU1RA==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-2.0.0.tgz", + "integrity": "sha512-S/m2VsXI7gAti2pBoLClFFTMOO1HTtT0j99AuXLoGFKO6deHDdnv6ZGTxSTTUTgO1zVcv82fCOtDjYK4EECmWA==" + }, + "d3-drag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-2.0.0.tgz", + "integrity": "sha512-g9y9WbMnF5uqB9qKqwIIa/921RYWzlUDv9Jl1/yONQwxbOfszAWTCm8u7HOTgJgRDXiRZN56cHT9pd24dmXs8w==", + "requires": { + "d3-dispatch": "1 - 2", + "d3-selection": "2" + } }, "d3-dsv": { "version": "2.0.0", @@ -1859,6 +1742,11 @@ "rw": "1" } }, + "d3-ease": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-2.0.0.tgz", + "integrity": "sha512-68/n9JWarxXkOWMshcT5IcjbB+agblQUaIsbnXmrzejn2O82n3p2A9R2zEB9HIEFWKFwPAEDDN8gR0VdSAyyAQ==" + }, "d3-fetch": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-2.0.0.tgz", @@ -1878,22 +1766,35 @@ } }, "d3-format": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.4.4.tgz", - "integrity": "sha512-TWks25e7t8/cqctxCmxpUuzZN11QxIA7YrMbram94zMQ0PXjE4LVIMe/f6a4+xxL8HQ3OsAFULOINQi1pE62Aw==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-2.0.0.tgz", + "integrity": "sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==" + }, + "d3-geo": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.1.tgz", + "integrity": "sha512-M6yzGbFRfxzNrVhxDJXzJqSLQ90q1cCyb3EWFZ1LF4eWOBYxFypw7I/NFVBNXKNqxv1bqLathhYvdJ6DC+th3A==", + "requires": { + "d3-array": ">=2.5" + } + }, + "d3-hierarchy": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-2.0.0.tgz", + "integrity": "sha512-SwIdqM3HxQX2214EG9GTjgmCc/mbSx4mQBn+DuEETubhOw6/U3fmnji4uCVrmzOydMHSO1nZle5gh6HB/wdOzw==" }, "d3-interpolate": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.4.0.tgz", - "integrity": "sha512-V9znK0zc3jOPV4VD2zZn0sDhZU3WAE2bmlxdIwwQPPzPjvyLkd8B3JUVdS1IDUFDkWZ72c9qnv1GK2ZagTZ8EA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-2.0.1.tgz", + "integrity": "sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==", "requires": { - "d3-color": "1" + "d3-color": "1 - 2" } }, "d3-path": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz", - "integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-2.0.0.tgz", + "integrity": "sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA==" }, "d3-polygon": { "version": "2.0.0", @@ -1906,39 +1807,85 @@ "integrity": "sha512-b0Ed2t1UUalJpc3qXzKi+cPGxeXRr4KU9YSlocN74aTzp6R/Ud43t79yLLqxHRWZfsvWXmbDWPpoENK1K539xw==" }, "d3-random": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-2.2.0.tgz", - "integrity": "sha512-CPLYfjoR3IebCGAUH+Y+RX/XH7z8AQVgFobSklswVvNSHUdiiSN9vn6ymTVkvTc1lDbcjf+zay5fMxC0o7Y7/g==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-2.2.1.tgz", + "integrity": "sha512-gKeWnzV7IzvTQEOdjBnQYCO0wwU42N2Y69nYlrJoW7ewGS8YEJxCeui1PfuGpnFZv2ogbSsQtna3FLOh0BmKOQ==" }, "d3-scale": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.1.tgz", - "integrity": "sha512-huz5byJO/6MPpz6Q8d4lg7GgSpTjIZW/l+1MQkzKfu2u8P6hjaXaStOpmyrD6ymKoW87d2QVFCKvSjLwjzx/rA==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.2.tgz", + "integrity": "sha512-3Mvi5HfqPFq0nlyeFlkskGjeqrR/790pINMHc4RXKJ2E6FraTd3juaRIRZZHyMAbi3LjAMW0EH4FB1WgoGyeXg==", "requires": { "d3-array": "1.2.0 - 2", - "d3-format": "1", - "d3-interpolate": "^1.2.0", - "d3-time": "1", - "d3-time-format": "2" + "d3-format": "1 - 2", + "d3-interpolate": "1.2.0 - 2", + "d3-time": "1 - 2", + "d3-time-format": "2 - 3" + } + }, + "d3-scale-chromatic": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-2.0.0.tgz", + "integrity": "sha512-LLqy7dJSL8yDy7NRmf6xSlsFZ6zYvJ4BcWFE4zBrOPnQERv9zj24ohnXKRbyi9YHnYV+HN1oEO3iFK971/gkzA==", + "requires": { + "d3-color": "1 - 2", + "d3-interpolate": "1 - 2" + } + }, + "d3-selection": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-2.0.0.tgz", + "integrity": "sha512-XoGGqhLUN/W14NmaqcO/bb1nqjDAw5WtSYb2X8wiuQWvSZUsUVYsOSkOybUrNvcBjaywBdYPy03eXHMXjk9nZA==" + }, + "d3-shape": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-2.0.0.tgz", + "integrity": "sha512-djpGlA779ua+rImicYyyjnOjeubyhql1Jyn1HK0bTyawuH76UQRWXd+pftr67H6Fa8hSwetkgb/0id3agKWykw==", + "requires": { + "d3-path": "1 - 2" } }, "d3-time": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.1.0.tgz", - "integrity": "sha512-Xh0isrZ5rPYYdqhAVk8VLnMEidhz5aP7htAADH6MfzgmmicPkTo8LhkLxci61/lCB7n7UmE3bN0leRt+qvkLxA==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.0.0.tgz", + "integrity": "sha512-2mvhstTFcMvwStWd9Tj3e6CEqtOivtD8AUiHT8ido/xmzrI9ijrUUihZ6nHuf/vsScRBonagOdj0Vv+SEL5G3Q==" }, "d3-time-format": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.2.3.tgz", - "integrity": "sha512-RAHNnD8+XvC4Zc4d2A56Uw0yJoM7bsvOlJR33bclxq399Rak/b9bhvu/InjxdWhPtkgU53JJcleJTGkNRnN6IA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz", + "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==", "requires": { - "d3-time": "1" + "d3-time": "1 - 2" } }, "d3-timer": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.10.tgz", - "integrity": "sha512-B1JDm0XDaQC+uvo4DT79H0XmBskgS3l6Ve+1SBCfxgmtIb1AVrPIoqd+nPSv+loMX8szQ0sVUhGngL7D5QPiXw==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-2.0.0.tgz", + "integrity": "sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA==" + }, + "d3-transition": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-2.0.0.tgz", + "integrity": "sha512-42ltAGgJesfQE3u9LuuBHNbGrI/AJjNL2OAUdclE70UE6Vy239GCBEYD38uBPoLeNsOhFStGpPI0BAOV+HMxog==", + "requires": { + "d3-color": "1 - 2", + "d3-dispatch": "1 - 2", + "d3-ease": "1 - 2", + "d3-interpolate": "1 - 2", + "d3-timer": "1 - 2" + } + }, + "d3-zoom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-2.0.0.tgz", + "integrity": "sha512-fFg7aoaEm9/jf+qfstak0IYpnesZLiMX6GZvXtUSdv8RH2o4E2qeelgdU09eKS6wGuiGMfcnMI0nTIqWzRHGpw==", + "requires": { + "d3-dispatch": "1 - 2", + "d3-drag": "2", + "d3-interpolate": "1 - 2", + "d3-selection": "2", + "d3-transition": "2" + } }, "dashdash": { "version": "1.14.1", diff --git a/package.json b/package.json index b0e44b884..456c81c79 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "url": "https://github.com/dc-js/dc.js.git" }, "dependencies": { - "d3": "^6.0.0-rc.4" + "d3": "^6.0.0" }, "devDependencies": { "compare-versions": "^3.6.0",