Guest User

Untitled

a guest
Oct 16th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. $(function() {
  2. $(document).ready(function() {
  3. $.getJSON('howrwe.json', function(chartvalues) {
  4. var chart = new Highcharts.Chart({
  5. chart: {
  6. renderTo: 'container',
  7. type: 'bar'
  8. },
  9. tooltip: {
  10. formatter: function() {
  11. var that = this.points;
  12. that = that.reverse(); //reverse the order as per the legend
  13. var s = '<b>' + this.x + '</b>';
  14. var total = 0;
  15. $.each(that, function(i, point) {
  16. s += '<br/>' + point.series.name + ': ' + point.y;
  17. total += point.y;
  18. });
  19. s += '<br/>' + chartvalues.totalText + ': ' + total;
  20. return s;
  21. },
  22. shared: true
  23. },
  24. title: {
  25. text: chartvalues.title,
  26. style: {
  27. fontSize: '16px',
  28. fontFamily: 'arial, sans-serif',
  29. color: chartvalues.chartColor
  30. }
  31. },
  32. subtitle: {
  33. text: chartvalues.subtitle,
  34. style: {
  35. fontSize: '13px',
  36. fontFamily: 'arial, sans-serif',
  37. color: chartvalues.chartColor
  38. }
  39. },
  40. credits: {
  41. enabled: false
  42. },
  43. legend: {
  44. reversed: true,
  45. itemStyle: {
  46. fontSize: '13px',
  47. fontFamily: 'arial, sans-serif',
  48. color: chartvalues.chartColor
  49. },
  50. verticalAlign: 'top',
  51. y: 50
  52. },
  53. xAxis: {
  54. categories: chartvalues.categories,
  55. labels: {
  56. formatter: function() {
  57. var returnDay = new Date(this.value);
  58. var weekDay = returnDay.getUTCDay();
  59. var day = returnDay.getUTCDate();
  60. var mon = returnDay.getUTCMonth() + 1;
  61. return chartvalues.weekdays[weekDay] + ' ' + day + '/' + mon;
  62. },
  63. style: {
  64. fontSize: '12px',
  65. fontFamily: 'arial, sans-serif',
  66. color: chartvalues.chartColor
  67. }
  68. }
  69. },
  70. yAxis: {
  71. title: '',
  72. min: 0,
  73. max: 12,
  74. tickInterval: 1,
  75. labels: {
  76. style: {
  77. fontSize: '12px',
  78. fontFamily: 'arial, sans-serif',
  79. color: chartvalues.chartColor
  80. }
  81. }
  82. },
  83. plotOptions: {
  84. series: {
  85. stacking: 'normal'
  86. }
  87. },
  88. series: chartvalues.series
  89. });
  90. });
  91. });
  92. });
Add Comment
Please, Sign In to add comment