profile.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. jQuery(function ($){
  2. 'use strict'
  3. var item = $('#chart')
  4. $.getJSON(item.data('url'), function(data){
  5. item.highcharts({
  6. chart: {
  7. polar: true,
  8. type: 'area',
  9. backgroundColor: 'transparent',
  10. spacing: [ 10, 90, 10, 90 ]
  11. },
  12. title: {
  13. text: null
  14. },
  15. subtitle: {
  16. text: null
  17. },
  18. xAxis: {
  19. categories: data.categories,
  20. tickmarkPlacement: 'on',
  21. lineWidth: 0
  22. },
  23. credits: {
  24. enabled: false
  25. },
  26. yAxis: {
  27. min: 0,
  28. max: 10,
  29. title: ' ',
  30. gridLineInterpolation: 'polygon',
  31. minorTickInterval: 1,
  32. labels: {
  33. enabled: false
  34. }
  35. },
  36. tooltip: false,
  37. plotOptions: {
  38. column: {
  39. pointPadding: 0.2,
  40. borderWidth: 0
  41. }
  42. },
  43. legend: {
  44. enabled: false
  45. },
  46. series: [{
  47. pointPlacement: 'on',
  48. data: data.values.politician
  49. },{
  50. pointPlacement: 'on',
  51. data: data.values.citizen,
  52. visible: $('#show_citizen').prop('checked'),
  53. }]
  54. });
  55. })
  56. $('#show_citizen').on('change', function(){
  57. if ($(this).prop('checked')) {
  58. item.highcharts().series[1].show()
  59. }
  60. else {
  61. item.highcharts().series[1].hide()
  62. }
  63. })
  64. });