MCPcopy
hub / github.com/dc-js/dc.js / _preprocessData

Method _preprocessData

src/charts/series-chart.js:55–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53 }
54
55 _preprocessData () {
56 const keep = [];
57 let childrenChanged;
58
59 const nesting = d3compat.nester({
60 key: this._seriesAccessor,
61 sortKeys: this._seriesSort,
62 sortValues: this._valueSort,
63 entries: this.data()
64 });
65
66 const children =
67 nesting.map((sub, i) => {
68 const subChart = this._charts[sub.key] || this._chartFunction(this, this._chartGroup , sub.key, i);
69 if (!this._charts[sub.key]) {
70 childrenChanged = true;
71 }
72 this._charts[sub.key] = subChart;
73 keep.push(sub.key);
74 return subChart
75 .dimension(this.dimension())
76 .group({
77 all: typeof sub.values === 'function' ? sub.values : utils.constant(sub.values)
78 }, sub.key)
79 .keyAccessor(this.keyAccessor())
80 .valueAccessor(this.valueAccessor())
81 .brushOn(false);
82 });
83 // this works around the fact compositeChart doesn't really
84 // have a removal interface
85 Object.keys(this._charts)
86 .filter(c => keep.indexOf(c) === -1)
87 .forEach(c => {
88 this._clearChart(c);
89 childrenChanged = true;
90 });
91 this._compose(children);
92 if (childrenChanged && this.legend()) {
93 this.legend().render();
94 }
95 }
96
97 _clearChart (c) {
98 if (this._charts[c].g()) {

Callers

nothing calls this directly

Calls 11

_clearChartMethod · 0.95
_composeMethod · 0.95
dataMethod · 0.80
brushOnMethod · 0.80
valueAccessorMethod · 0.80
keyAccessorMethod · 0.80
legendMethod · 0.80
groupMethod · 0.45
dimensionMethod · 0.45
filterMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected