Skip to content

Instantly share code, notes, and snippets.

@grapho
Last active August 29, 2015 14:05
Show Gist options
  • Save grapho/6bf0bd6c9185445e01de to your computer and use it in GitHub Desktop.
Save grapho/6bf0bd6c9185445e01de to your computer and use it in GitHub Desktop.
How to create an Ember component using Highcharts.js
{{pie-chart data=pieData}}
var PieChartComponent = Ember.Component.extend({
tagName: 'div',
classNames: ['chart'],
dataChanged: function() {
return this.rerender();
}.observes('data'),
renderChart: function() {
return this.$().highcharts({
chart: {
height: 275
},
title: null,
plotOptions: {
pie: {
dataLabels: {
enabled: false
}
}
},
series: [{
type: 'pie',
data: this.get('data')
}],
colors: ['#777777', '#888888', '#999999', '#aaaaaa'],
credits: {
enabled: true
}
});
}.on('didInsertElement'),
willDestroyElement: function() {
this.$().highcharts().destroy();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment