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

Method constructor

src/base/stack-mixin.js:13–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11 */
12export class StackMixin extends CoordinateGridMixin {
13 constructor () {
14 super();
15
16 this._stackLayout = stack();
17
18 this._stack = [];
19 this._titles = {};
20
21 this._hidableStacks = false;
22 this._evadeDomainFilter = false;
23
24 this.data(() => {
25 const layers = this._stack.filter(this._visibility);
26 if (!layers.length) {
27 return [];
28 }
29 layers.forEach((l, i) => this._prepareValues(l, i));
30 const v4data = layers[0].values.map((v, i) => {
31 const col = {x: v.x};
32 layers.forEach(layer => {
33 col[layer.name] = layer.values[i].y;
34 });
35 return col;
36 });
37 const keys = layers.map(layer => layer.name);
38 const v4result = this.stackLayout().keys(keys)(v4data);
39 v4result.forEach((series, i) => {
40 series.forEach((ys, j) => {
41 layers[i].values[j].y0 = ys[0];
42 layers[i].values[j].y1 = ys[1];
43 });
44 });
45 return layers;
46 });
47
48 this.colorAccessor(function (d) {
49 return this.layer || this.name || d.name || d.layer;
50 });
51 }
52
53 _prepareValues (layer, layerIdx) {
54 const valAccessor = layer.accessor || this.valueAccessor();

Callers

nothing calls this directly

Calls 5

_prepareValuesMethod · 0.95
stackLayoutMethod · 0.95
dataMethod · 0.80
colorAccessorMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected