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

Method constructor

src/charts/number-display.js:37–60  ·  view source on GitHub ↗

* Create a Number Display widget. * * @example * // create a number display under #chart-container1 element using the default global chart group * var display1 = new NumberDisplay('#chart-container1'); * @param {String|node|d3.selection} parent - Any valid * {@link http

(parent, chartGroup)

Source from the content-addressed store, hash-verified

35 * Interaction with a chart will only trigger events and redraws within the chart's group.
36 */
37 constructor (parent, chartGroup) {
38 super();
39
40 this._formatNumber = format('.2s');
41 this._html = {one: '', some: '', none: ''};
42 this._lastValue = undefined;
43 this._ariaLiveRegion = false;
44
45 // dimension not required
46 this._mandatoryAttributes(['group']);
47
48 // default to ordering by value, to emulate old group.top(1) behavior when multiple groups
49 this.ordering(kv => kv.value);
50
51 this.data(group => {
52 const valObj = group.value ? group.value() : this._maxBin(group.all());
53 return this.valueAccessor()(valObj);
54 });
55
56 this.transitionDuration(250); // good default
57 this.transitionDelay(0);
58
59 this.anchor(parent, chartGroup);
60 }
61
62 /**
63 * Gets or sets an optional object specifying HTML templates to use depending on the number

Callers

nothing calls this directly

Calls 9

_maxBinMethod · 0.95
_mandatoryAttributesMethod · 0.80
orderingMethod · 0.80
dataMethod · 0.80
valueMethod · 0.80
valueAccessorMethod · 0.80
transitionDurationMethod · 0.80
transitionDelayMethod · 0.80
anchorMethod · 0.80

Tested by

no test coverage detected