Path: blob/master/webroot/rsrc/js/application/fact/ChartCurtainView.js
12242 views
/**1* @provides javelin-chart-curtain-view2*/3JX.install('ChartCurtainView', {45construct: function() {6this._labels = [];7},89members: {10_node: null,11_labels: null,12_labelsNode: null,1314getNode: function() {15if (!this._node) {16var attr = {17className: 'chart-curtain'18};1920this._node = JX.$N('div', attr);21}22return this._node;23},2425reset: function() {26this._labels = [];27},2829addFunctionLabel: function(label) {30this._labels.push(label);31return this;32},3334redraw: function() {35var content = [this._getFunctionLabelsNode()];3637JX.DOM.setContent(this.getNode(), content);38return this;39},4041_getFunctionLabelsNode: function() {42if (!this._labels.length) {43return null;44}4546if (!this._labelsNode) {47var list_attrs = {48className: 'chart-function-label-list'49};5051var labels = JX.$N('ul', list_attrs);5253var items = [];54for (var ii = 0; ii < this._labels.length; ii++) {55items.push(this._newFunctionLabelItem(this._labels[ii]));56}5758JX.DOM.setContent(labels, items);5960this._labelsNode = labels;61}6263return this._labelsNode;64},6566_newFunctionLabelItem: function(label) {67var item_attrs = {68className: 'chart-function-label-list-item'69};7071var icon = new JX.PHUIXIconView()72.setIcon(label.getIcon());7374// Charts may use custom colors, so we can't rely on the CSS classes75// which only provide standard colors like "red" and "blue".76icon.getNode().style.color = label.getColor();7778var content = [79icon.getNode(),80label.getName()81];8283return JX.$N('li', item_attrs, content);84}8586}8788});899091