I am using chart widget to generate charts and graph.It is running fine,But my client wants to be simple.if he clicks on the chart icon the results should be displayed without selecting layer and apply button.Please suggest me how can i do.
Solved! Go to Solution.
There is no option or configuration for that. But you can make these code changes in the Widget.js to make that happen (lines 5 - 36):
onOpen: function(){ if(this.tempResultLayer){ this.tempResultLayer.show(); } //Show the first chart this.showFirstChart(); }, showFirstChart: function() { this._resetCurrentAttrs(); this.currentAttrs.chartTr = {}; this.currentAttrs.config = lang.clone(this.config.charts[0]); this.currentAttrs.layerInfo = this.currentAttrs.chartTr.layerInfo;//may be null var layerUrl = this.currentAttrs.config.url; this.shelter.show(); var callback = lang.hitch(this, function() { this.currentAttrs.layerInfo = this.currentAttrs.chartTr.layerInfo; this._onBtnApplyClicked(); }); esriRequest({ url: layerUrl, content: { f: 'json' }, handleAs: 'json', callbackParamName: 'callback' }).then(lang.hitch(this, function(response){ if (!this.domNode) { return; } this.shelter.hide(); this.currentAttrs.chartTr.layerInfo = response; this.currentAttrs.layerInfo = this.currentAttrs.chartTr.layerInfo; callback(); })); },
There is no option or configuration for that. But you can make these code changes in the Widget.js to make that happen (lines 5 - 36):
onOpen: function(){ if(this.tempResultLayer){ this.tempResultLayer.show(); } //Show the first chart this.showFirstChart(); }, showFirstChart: function() { this._resetCurrentAttrs(); this.currentAttrs.chartTr = {}; this.currentAttrs.config = lang.clone(this.config.charts[0]); this.currentAttrs.layerInfo = this.currentAttrs.chartTr.layerInfo;//may be null var layerUrl = this.currentAttrs.config.url; this.shelter.show(); var callback = lang.hitch(this, function() { this.currentAttrs.layerInfo = this.currentAttrs.chartTr.layerInfo; this._onBtnApplyClicked(); }); esriRequest({ url: layerUrl, content: { f: 'json' }, handleAs: 'json', callbackParamName: 'callback' }).then(lang.hitch(this, function(response){ if (!this.domNode) { return; } this.shelter.hide(); this.currentAttrs.chartTr.layerInfo = response; this.currentAttrs.layerInfo = this.currentAttrs.chartTr.layerInfo; callback(); })); },
Thank you very much Mr.Robert.