Guest User

Untitled

a guest
Dec 11th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.76 KB | None | 0 0
  1. Highcharts.chart('container', {
  2. chart: {
  3. zoomType: 'xy',
  4. events: {
  5. load: function () {
  6. this.myTooltip = new Highcharts.Tooltip(this, this.options.tooltip);
  7. }
  8. }
  9. },
  10. title: {
  11. text: ''
  12. },
  13. credits: {
  14. enabled: false
  15. },
  16. subtitle: {
  17. text: ''
  18. },
  19. useUTC: false,
  20. xAxis: [{
  21. type: 'datetime',
  22. dateTimeLabelFormats: {
  23. day: '%e %b',
  24. hour: '%I:%M %P'
  25. }
  26.  
  27. }],
  28. yAxis: [{ // Primary yAxis
  29. labels: {
  30. format: '{value:,.0f}',
  31. style: {
  32. color: Highcharts.getOptions().colors[1]
  33. }
  34. },
  35. plotLines: [peakPlotLineOption, averagePlotLineOption],
  36. title: {
  37. text: 'Consumption (kWh)',
  38. style: {
  39. color: Highcharts.getOptions().colors[1]
  40. }
  41. }}
  42.  
  43. , { // Secondary yAxis
  44. title: {
  45. text: '',
  46. style: {
  47. color: Highcharts.getOptions().colors[0]
  48. }
  49. },
  50. labels: {
  51. format: '{value} kWh',
  52. style: {
  53. color: Highcharts.getOptions().colors[0]
  54. }
  55. },
  56. visible: false
  57. }],
  58.  
  59. tooltip: {
  60. crosshairs: true,
  61. shared: true,
  62. valueSuffix: '°C'
  63. },
  64. series: [{
  65. name: 'ABC',
  66. type: 'column',
  67. data:
  68.  
  69. [
  70. { x: Date.UTC(2017, 6, 2, 0), y: 49.9, bId: 1 },
  71. { x: Date.UTC(2017, 6, 2, 1), y: 71.5, bId: 2 },
  72. { x: Date.UTC(2017, 6, 2, 2), y: 106.4, bId: 3 },
  73. { x: Date.UTC(2017, 6, 2, 3), y: 129.2, bId: 4 },
  74. { x: Date.UTC(2017, 6, 2, 4), y: 144.0, bId: 5 },
  75. { x: Date.UTC(2017, 6, 2, 5), y: 176.0, bId: 6 },
  76. { x: Date.UTC(2017, 6, 2, 6), y: 135.6, bId: 7 },
  77. { x: Date.UTC(2017, 6, 2, 7), y: 148.5, bId: 8 },
  78. { x: Date.UTC(2017, 6, 2, 8), y: 216.4, bId: 9 },
  79. { x: Date.UTC(2017, 6, 2, 9), y: 194.1, bId: 10 },
  80. { x: Date.UTC(2017, 6, 2, 10), y: 95.6, bId: 11 },
  81. { x: Date.UTC(2017, 6, 2, 11), y: 54.4, bId: 12 },
  82. { x: Date.UTC(2017, 6, 2, 12), y: 45, bId: 13 },
  83. { x: Date.UTC(2017, 6, 2, 13), y: 62, bId: 14 },
  84. { x: Date.UTC(2017, 6, 2, 14), y: 35, bId: 15 }
  85. ],
  86. tooltip: {
  87. valueSuffix: ' kWh'
  88. },
  89. yAxis: 0,
  90. zones: [{
  91. value: 50,
  92. color: '#90ed7d'
  93. }, {
  94. value: 100,
  95. color: '#FFDE00'
  96. },{
  97. color: '#CE0000'
  98. }]
  99. }
  100. , {
  101. // Series that mimics the plot line
  102. color: '#ee8176',
  103. name: 'contract capacity',
  104. dashStyle: 'Solid',
  105. marker: {
  106. enabled: false
  107. },
  108. events: {
  109. legendItemClick: function (e) {
  110. if (this.visible) {
  111. this.chart.yAxis[0].removePlotLine(averagePlotLine);
  112. }
  113. else {
  114. this.chart.yAxis[0].addPlotLine(averagePlotLineOption);
  115. }
  116. }
  117. },
  118. yAxis: 0
  119. }, {
  120. // Series that mimics the plot line
  121. color: '#9fa7b1',
  122. name: 'max demand',
  123. dashStyle: 'Solid',
  124. marker: {
  125. enabled: false
  126. },
  127. events: {
  128. legendItemClick: function (e) {
  129. if (this.visible) {
  130. this.chart.yAxis[0].removePlotLine(peakPlotLine);
  131. }
  132. else {
  133. this.chart.yAxis[0].addPlotLine(peakPlotLineOption);
  134. }
  135. }
  136. },
  137. yAxis: 0
  138. }
  139. ]
  140. });
Add Comment
Please, Sign In to add comment