Created
March 10, 2015 06:12
-
-
Save lmcardle/87c59332ad7481e13e6d to your computer and use it in GitHub Desktop.
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
import Ember from 'ember'; | |
import layout from '../templates/components/pie-chart'; | |
export default Ember.Component.extend({ | |
tagName: 'div', | |
classNames: ['chart'], | |
dataChanged: function() { | |
return this.rerender(); | |
}.observes('data'), | |
renderChart: function() { | |
console.log(this.get('data')); | |
return this.$().highcharts({ | |
chart: { | |
plotBackgroundColor: null, | |
plotBorderWidth: null, | |
plotShadow: false | |
}, | |
title: { | |
text: 'Browser market shares at a specific website, 2014' | |
}, | |
tooltip: { | |
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' | |
}, | |
plotOptions: { | |
pie: { | |
allowPointSelect: true, | |
cursor: 'pointer', | |
dataLabels: { | |
enabled: true, | |
format: '<b>{point.name}</b>: {point.percentage:.1f} %', | |
style: { | |
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' | |
} | |
} | |
} | |
}, | |
series: [{ | |
type: 'pie', | |
name: 'Browser share', | |
data: [ | |
['Firefox', 45.0], | |
['IE', 26.8], | |
{ | |
name: 'Chrome', | |
y: 12.8, | |
sliced: true, | |
selected: true | |
}, | |
['Safari', 8.5], | |
['Opera', 6.2], | |
['Others', 0.7] | |
] | |
}] | |
}); | |
}.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