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

Method constructor

src/charts/cbox-menu.js:37–64  ·  view source on GitHub ↗

* Create a Cbox Menu. * * @example * // create a cboxMenu under #cbox-container using the default global chart group * var cbox = new CboxMenu('#cbox-container') * .dimension(states) * .group(stateGroup); * // the option text can be se

(parent, chartGroup)

Source from the content-addressed store, hash-verified

35 * Interaction with the widget will only trigger events and redraws within its group.
36 */
37 constructor (parent, chartGroup) {
38 super();
39
40 this._cbox = undefined;
41 this._promptText = 'Select all';
42 this._multiple = false;
43 this._inputType = 'radio';
44 this._promptValue = null;
45
46 this._uniqueId = utils.uniqueId();
47
48 this.data(group => group.all().filter(this._filterDisplayed));
49
50 // There is an accessor for this attribute, initialized with default value
51 this._filterDisplayed = d => this.valueAccessor()(d) > 0;
52
53 this._order = (a, b) => {
54 if (this.keyAccessor()(a) > this.keyAccessor()(b)) {
55 return 1;
56 }
57 if (this.keyAccessor()(a) < this.keyAccessor()(b)) {
58 return -1;
59 }
60 return 0;
61 };
62
63 this.anchor(parent, chartGroup);
64 }
65
66 _doRender () {
67 return this._doRedraw();

Callers

nothing calls this directly

Calls 5

dataMethod · 0.80
valueAccessorMethod · 0.80
keyAccessorMethod · 0.80
anchorMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected