Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. import Ember from 'ember';
  2. import layout from '../templates/components/pie-chart';
  3.  
  4. export default Ember.Component.extend({
  5. tagName: 'div',
  6. classNames: ['chart'],
  7.  
  8. dataChanged: function() {
  9. return this.rerender();
  10. }.observes('data'),
  11.  
  12. renderChart: function() {
  13. console.log(this.get('data'));
  14. return this.$().highcharts({
  15. chart: {
  16. plotBackgroundColor: null,
  17. plotBorderWidth: null,
  18. plotShadow: false
  19. },
  20. title: {
  21. text: 'Browser market shares at a specific website, 2014'
  22. },
  23. tooltip: {
  24. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  25. },
  26. plotOptions: {
  27. pie: {
  28. allowPointSelect: true,
  29. cursor: 'pointer',
  30. dataLabels: {
  31. enabled: true,
  32. format: '<b>{point.name}</b>: {point.percentage:.1f} %',
  33. style: {
  34. color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
  35. }
  36. }
  37. }
  38. },
  39. series: [{
  40. type: 'pie',
  41. name: 'Browser share',
  42. data: [
  43. ['Firefox', 45.0],
  44. ['IE', 26.8],
  45. {
  46. name: 'Chrome',
  47. y: 12.8,
  48. sliced: true,
  49. selected: true
  50. },
  51. ['Safari', 8.5],
  52. ['Opera', 6.2],
  53. ['Others', 0.7]
  54. ]
  55. }]
  56. });
  57. }.on('didInsertElement'),
  58.  
  59. willDestroyElement: function() {
  60. this.$().highcharts().destroy();
  61. }
  62. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement