Created
February 6, 2017 21:35
-
-
Save dranney-sugarcrm/68dff0990fc56fb07cd38ddafc2d414b to your computer and use it in GitHub Desktop.
Dynamically add elements to DOM and display new chart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
... | |
renderChart: function () { | |
if (!this.isChartReady()) { | |
return; | |
} | |
var self = this; | |
var id_val = ""; | |
var selector_str = ""; | |
_.each(this.chartDataArr, function (data, key) { | |
id_val = 'example_chart' + key; | |
selector_str = '#' + id_val + ' svg'; | |
$("#chart-section").append('<div id="' + id_val + '"><svg></svg></div>'); | |
d3.select(self.el).select(selector_str) | |
.datum(data) | |
.transition().duration(500) | |
.call(self.chart); | |
}); | |
this.chart_loaded = _.isFunction(this.chart.update); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment