highcharts-custom.script.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248
  1. $(function () {
  2. "use strict";
  3. // chart 1
  4. Highcharts.chart('chart1', {
  5. chart: {
  6. plotBackgroundColor: null,
  7. plotBorderWidth: null,
  8. plotShadow: false,
  9. type: 'pie',
  10. styledMode: true
  11. },
  12. credits: {
  13. enabled: false
  14. },
  15. title: {
  16. text: 'Browser market shares in January, 2018'
  17. },
  18. tooltip: {
  19. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  20. },
  21. accessibility: {
  22. point: {
  23. valueSuffix: '%'
  24. }
  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. }
  34. }
  35. },
  36. series: [{
  37. name: 'Brands',
  38. colorByPoint: true,
  39. data: [{
  40. name: 'Chrome',
  41. y: 61.41,
  42. sliced: true,
  43. selected: true
  44. }, {
  45. name: 'Internet Explorer',
  46. y: 11.84
  47. }, {
  48. name: 'Firefox',
  49. y: 10.85
  50. }, {
  51. name: 'Edge',
  52. y: 4.67
  53. }, {
  54. name: 'Safari',
  55. y: 4.18
  56. }, {
  57. name: 'Sogou Explorer',
  58. y: 1.64
  59. }, {
  60. name: 'Opera',
  61. y: 1.6
  62. }, {
  63. name: 'QQ',
  64. y: 1.2
  65. }, {
  66. name: 'Other',
  67. y: 2.61
  68. }]
  69. }]
  70. });
  71. // chart 2
  72. // Build the chart
  73. Highcharts.chart('chart2', {
  74. chart: {
  75. plotBackgroundColor: null,
  76. plotBorderWidth: null,
  77. plotShadow: false,
  78. type: 'pie',
  79. styledMode: true
  80. },
  81. credits: {
  82. enabled: false
  83. },
  84. title: {
  85. text: 'Browser market shares in January, 2018'
  86. },
  87. tooltip: {
  88. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  89. },
  90. accessibility: {
  91. point: {
  92. valueSuffix: '%'
  93. }
  94. },
  95. plotOptions: {
  96. pie: {
  97. allowPointSelect: true,
  98. cursor: 'pointer',
  99. dataLabels: {
  100. enabled: false
  101. },
  102. showInLegend: true
  103. }
  104. },
  105. series: [{
  106. name: 'Brands',
  107. colorByPoint: true,
  108. data: [{
  109. name: 'Chrome',
  110. y: 61.41,
  111. sliced: true,
  112. selected: true
  113. }, {
  114. name: 'Internet Explorer',
  115. y: 11.84
  116. }, {
  117. name: 'Firefox',
  118. y: 10.85
  119. }, {
  120. name: 'Edge',
  121. y: 4.67
  122. }, {
  123. name: 'Safari',
  124. y: 4.18
  125. }, {
  126. name: 'Other',
  127. y: 7.05
  128. }]
  129. }]
  130. });
  131. // chart 3
  132. Highcharts.chart('chart3', {
  133. chart: {
  134. type: 'variablepie',
  135. styledMode: true
  136. },
  137. credits: {
  138. enabled: false
  139. },
  140. title: {
  141. text: 'Countries compared by population density and total area.'
  142. },
  143. tooltip: {
  144. headerFormat: '',
  145. pointFormat: '<span style="color:{point.color}">\u25CF</span> <b> {point.name}</b><br/>' + 'Area (square km): <b>{point.y}</b><br/>' + 'Population density (people per square km): <b>{point.z}</b><br/>'
  146. },
  147. series: [{
  148. minPointSize: 10,
  149. innerSize: '20%',
  150. zMin: 0,
  151. name: 'countries',
  152. data: [{
  153. name: 'Spain',
  154. y: 505370,
  155. z: 92.9
  156. }, {
  157. name: 'France',
  158. y: 551500,
  159. z: 118.7
  160. }, {
  161. name: 'Poland',
  162. y: 312685,
  163. z: 124.6
  164. }, {
  165. name: 'Czech Republic',
  166. y: 78867,
  167. z: 137.5
  168. }, {
  169. name: 'Italy',
  170. y: 301340,
  171. z: 201.8
  172. }, {
  173. name: 'Switzerland',
  174. y: 41277,
  175. z: 214.5
  176. }, {
  177. name: 'Germany',
  178. y: 357022,
  179. z: 235.6
  180. }]
  181. }]
  182. });
  183. // chart4
  184. // Make monochrome colors
  185. var pieColors = (function () {
  186. var colors = [],
  187. base = Highcharts.getOptions().colors[0],
  188. i;
  189. for (i = 0; i < 10; i += 1) {
  190. // Start out with a darkened base color (negative brighten), and end
  191. // up with a much brighter color
  192. colors.push(Highcharts.color(base).brighten((i - 3) / 7).get());
  193. }
  194. return colors;
  195. }());
  196. // Build the chart
  197. Highcharts.chart('chart4', {
  198. chart: {
  199. plotBackgroundColor: null,
  200. plotBorderWidth: null,
  201. plotShadow: false,
  202. styledMode: true,
  203. type: 'pie'
  204. },
  205. credits: {
  206. enabled: false
  207. },
  208. title: {
  209. text: 'Browser market shares at a specific website, 2014'
  210. },
  211. tooltip: {
  212. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  213. },
  214. accessibility: {
  215. point: {
  216. valueSuffix: '%'
  217. }
  218. },
  219. plotOptions: {
  220. pie: {
  221. allowPointSelect: true,
  222. cursor: 'pointer',
  223. colors: pieColors,
  224. dataLabels: {
  225. enabled: true,
  226. format: '<b>{point.name}</b><br>{point.percentage:.1f} %',
  227. distance: -50,
  228. filter: {
  229. property: 'percentage',
  230. operator: '>',
  231. value: 4
  232. }
  233. }
  234. }
  235. },
  236. series: [{
  237. name: 'Share',
  238. data: [{
  239. name: 'Chrome',
  240. y: 61.41
  241. }, {
  242. name: 'Internet Explorer',
  243. y: 11.84
  244. }, {
  245. name: 'Firefox',
  246. y: 10.85
  247. }, {
  248. name: 'Edge',
  249. y: 4.67
  250. }, {
  251. name: 'Safari',
  252. y: 4.18
  253. }, {
  254. name: 'Other',
  255. y: 7.05
  256. }]
  257. }]
  258. });
  259. // chart 5
  260. var colors = Highcharts.getOptions().colors,
  261. categories = ['Chrome', 'Firefox', 'Internet Explorer', 'Safari', 'Edge', 'Opera', 'Other'],
  262. data = [{
  263. y: 62.74,
  264. color: colors[2],
  265. drilldown: {
  266. name: 'Chrome',
  267. categories: ['Chrome v65.0', 'Chrome v64.0', 'Chrome v63.0', 'Chrome v62.0', 'Chrome v61.0', 'Chrome v60.0', 'Chrome v59.0', 'Chrome v58.0', 'Chrome v57.0', 'Chrome v56.0', 'Chrome v55.0', 'Chrome v54.0', 'Chrome v51.0', 'Chrome v49.0', 'Chrome v48.0', 'Chrome v47.0', 'Chrome v43.0', 'Chrome v29.0'],
  268. data: [
  269. 0.1,
  270. 1.3,
  271. 53.02,
  272. 1.4,
  273. 0.88,
  274. 0.56,
  275. 0.45,
  276. 0.49,
  277. 0.32,
  278. 0.29,
  279. 0.79,
  280. 0.18,
  281. 0.13,
  282. 2.16,
  283. 0.13,
  284. 0.11,
  285. 0.17,
  286. 0.26
  287. ]
  288. }
  289. }, {
  290. y: 10.57,
  291. color: colors[1],
  292. drilldown: {
  293. name: 'Firefox',
  294. categories: ['Firefox v58.0', 'Firefox v57.0', 'Firefox v56.0', 'Firefox v55.0', 'Firefox v54.0', 'Firefox v52.0', 'Firefox v51.0', 'Firefox v50.0', 'Firefox v48.0', 'Firefox v47.0'],
  295. data: [
  296. 1.02,
  297. 7.36,
  298. 0.35,
  299. 0.11,
  300. 0.1,
  301. 0.95,
  302. 0.15,
  303. 0.1,
  304. 0.31,
  305. 0.12
  306. ]
  307. }
  308. }, {
  309. y: 7.23,
  310. color: colors[0],
  311. drilldown: {
  312. name: 'Internet Explorer',
  313. categories: ['Internet Explorer v11.0', 'Internet Explorer v10.0', 'Internet Explorer v9.0', 'Internet Explorer v8.0'],
  314. data: [
  315. 6.2,
  316. 0.29,
  317. 0.27,
  318. 0.47
  319. ]
  320. }
  321. }, {
  322. y: 5.58,
  323. color: colors[3],
  324. drilldown: {
  325. name: 'Safari',
  326. categories: ['Safari v11.0', 'Safari v10.1', 'Safari v10.0', 'Safari v9.1', 'Safari v9.0', 'Safari v5.1'],
  327. data: [
  328. 3.39,
  329. 0.96,
  330. 0.36,
  331. 0.54,
  332. 0.13,
  333. 0.2
  334. ]
  335. }
  336. }, {
  337. y: 4.02,
  338. color: colors[5],
  339. drilldown: {
  340. name: 'Edge',
  341. categories: ['Edge v16', 'Edge v15', 'Edge v14', 'Edge v13'],
  342. data: [
  343. 2.6,
  344. 0.92,
  345. 0.4,
  346. 0.1
  347. ]
  348. }
  349. }, {
  350. y: 1.92,
  351. color: colors[4],
  352. drilldown: {
  353. name: 'Opera',
  354. categories: ['Opera v50.0', 'Opera v49.0', 'Opera v12.1'],
  355. data: [
  356. 0.96,
  357. 0.82,
  358. 0.14
  359. ]
  360. }
  361. }, {
  362. y: 7.62,
  363. color: colors[6],
  364. drilldown: {
  365. name: 'Other',
  366. categories: ['Other'],
  367. data: [
  368. 7.62
  369. ]
  370. }
  371. }],
  372. browserData = [],
  373. versionsData = [],
  374. i,
  375. j,
  376. dataLen = data.length,
  377. drillDataLen,
  378. brightness;
  379. // Build the data arrays
  380. for (i = 0; i < dataLen; i += 1) {
  381. // add browser data
  382. browserData.push({
  383. name: categories[i],
  384. y: data[i].y,
  385. color: data[i].color
  386. });
  387. // add version data
  388. drillDataLen = data[i].drilldown.data.length;
  389. for (j = 0; j < drillDataLen; j += 1) {
  390. brightness = 0.2 - (j / drillDataLen) / 5;
  391. versionsData.push({
  392. name: data[i].drilldown.categories[j],
  393. y: data[i].drilldown.data[j],
  394. color: Highcharts.color(data[i].color).brighten(brightness).get()
  395. });
  396. }
  397. }
  398. // Create the chart
  399. Highcharts.chart('chart5', {
  400. chart: {
  401. type: 'pie',
  402. styledMode: true
  403. },
  404. credits: {
  405. enabled: false
  406. },
  407. title: {
  408. text: 'Browser market share, January, 2018'
  409. },
  410. subtitle: {
  411. text: 'Source: <a href="http://statcounter.com" target="_blank">statcounter.com</a>'
  412. },
  413. plotOptions: {
  414. pie: {
  415. shadow: false,
  416. center: ['50%', '50%']
  417. }
  418. },
  419. tooltip: {
  420. valueSuffix: '%'
  421. },
  422. series: [{
  423. name: 'Browsers',
  424. data: browserData,
  425. size: '60%',
  426. dataLabels: {
  427. formatter: function () {
  428. return this.y > 5 ? this.point.name : null;
  429. },
  430. color: '#ffffff',
  431. distance: -30
  432. }
  433. }, {
  434. name: 'Versions',
  435. data: versionsData,
  436. size: '80%',
  437. innerSize: '60%',
  438. dataLabels: {
  439. formatter: function () {
  440. // display only if larger than 1
  441. return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
  442. }
  443. },
  444. id: 'versions'
  445. }],
  446. responsive: {
  447. rules: [{
  448. condition: {
  449. maxWidth: 400
  450. },
  451. chartOptions: {
  452. series: [{}, {
  453. id: 'versions',
  454. dataLabels: {
  455. enabled: false
  456. }
  457. }]
  458. }
  459. }]
  460. }
  461. });
  462. // chart 6
  463. Highcharts.chart('chart6', {
  464. chart: {
  465. plotBackgroundColor: null,
  466. plotBorderWidth: 0,
  467. styledMode: true,
  468. plotShadow: false
  469. },
  470. credits: {
  471. enabled: false
  472. },
  473. title: {
  474. text: 'Browser<br>shares<br>2017',
  475. align: 'center',
  476. verticalAlign: 'middle',
  477. y: 60
  478. },
  479. tooltip: {
  480. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  481. },
  482. accessibility: {
  483. point: {
  484. valueSuffix: '%'
  485. }
  486. },
  487. plotOptions: {
  488. pie: {
  489. dataLabels: {
  490. enabled: true,
  491. distance: -50,
  492. style: {
  493. fontWeight: 'bold',
  494. color: 'white'
  495. }
  496. },
  497. startAngle: -90,
  498. endAngle: 90,
  499. center: ['50%', '75%'],
  500. size: '110%'
  501. }
  502. },
  503. series: [{
  504. type: 'pie',
  505. name: 'Browser share',
  506. innerSize: '50%',
  507. data: [
  508. ['Chrome', 58.9],
  509. ['Firefox', 13.29],
  510. ['Internet Explorer', 13],
  511. ['Edge', 3.78],
  512. ['Safari', 3.42], {
  513. name: 'Other',
  514. y: 7.61,
  515. dataLabels: {
  516. enabled: false
  517. }
  518. }
  519. ]
  520. }]
  521. });
  522. // chart7
  523. Highcharts.chart('chart7', {
  524. chart: {
  525. type: 'bar',
  526. styledMode: true
  527. },
  528. credits: {
  529. enabled: false
  530. },
  531. title: {
  532. text: 'Historic World Population by Region'
  533. },
  534. subtitle: {
  535. text: 'Source: <a href="https://en.wikipedia.org/wiki/World_population">Wikipedia.org</a>'
  536. },
  537. xAxis: {
  538. categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
  539. title: {
  540. text: null
  541. }
  542. },
  543. yAxis: {
  544. min: 0,
  545. title: {
  546. text: 'Population (millions)',
  547. align: 'high'
  548. },
  549. labels: {
  550. overflow: 'justify'
  551. }
  552. },
  553. tooltip: {
  554. valueSuffix: ' millions'
  555. },
  556. plotOptions: {
  557. bar: {
  558. dataLabels: {
  559. enabled: true
  560. }
  561. }
  562. },
  563. legend: {
  564. layout: 'vertical',
  565. align: 'right',
  566. verticalAlign: 'top',
  567. x: -40,
  568. y: 80,
  569. floating: true,
  570. borderWidth: 1,
  571. backgroundColor: Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF',
  572. shadow: true
  573. },
  574. credits: {
  575. enabled: false
  576. },
  577. series: [{
  578. name: 'Year 1800',
  579. data: [107, 31, 635, 203, 2]
  580. }, {
  581. name: 'Year 1900',
  582. data: [133, 156, 947, 408, 6]
  583. }, {
  584. name: 'Year 2000',
  585. data: [814, 841, 3714, 727, 31]
  586. }, {
  587. name: 'Year 2016',
  588. data: [1216, 1001, 4436, 738, 40]
  589. }]
  590. });
  591. // chart 8
  592. Highcharts.chart('chart8', {
  593. chart: {
  594. type: 'column',
  595. styledMode: true
  596. },
  597. credits: {
  598. enabled: false
  599. },
  600. title: {
  601. text: 'Monthly Average Rainfall'
  602. },
  603. subtitle: {
  604. text: 'Source: WorldClimate.com'
  605. },
  606. xAxis: {
  607. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  608. crosshair: true
  609. },
  610. yAxis: {
  611. min: 0,
  612. title: {
  613. text: 'Rainfall (mm)'
  614. }
  615. },
  616. tooltip: {
  617. headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
  618. pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
  619. footerFormat: '</table>',
  620. shared: true,
  621. useHTML: true
  622. },
  623. plotOptions: {
  624. column: {
  625. pointPadding: 0.2,
  626. borderWidth: 0
  627. }
  628. },
  629. series: [{
  630. name: 'Tokyo',
  631. data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
  632. }, {
  633. name: 'New York',
  634. data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3]
  635. }, {
  636. name: 'London',
  637. data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2]
  638. }, {
  639. name: 'Berlin',
  640. data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1]
  641. }]
  642. });
  643. // chart 9
  644. Highcharts.chart('chart9', {
  645. chart: {
  646. type: 'bar',
  647. styledMode: true
  648. },
  649. credits: {
  650. enabled: false
  651. },
  652. title: {
  653. text: 'Stacked bar chart'
  654. },
  655. xAxis: {
  656. categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
  657. },
  658. yAxis: {
  659. min: 0,
  660. title: {
  661. text: 'Total fruit consumption'
  662. }
  663. },
  664. legend: {
  665. reversed: true
  666. },
  667. plotOptions: {
  668. series: {
  669. stacking: 'normal'
  670. }
  671. },
  672. series: [{
  673. name: 'John',
  674. data: [5, 3, 4, 7, 2]
  675. }, {
  676. name: 'Jane',
  677. data: [2, 2, 3, 2, 1]
  678. }, {
  679. name: 'Joe',
  680. data: [3, 4, 4, 2, 5]
  681. }]
  682. });
  683. // chart 10
  684. // Create the chart
  685. Highcharts.chart('chart10', {
  686. chart: {
  687. type: 'column',
  688. styledMode: true
  689. },
  690. credits: {
  691. enabled: false
  692. },
  693. title: {
  694. text: 'Browser market shares. January, 2018'
  695. },
  696. subtitle: {
  697. text: 'Click the columns to view versions. Source: <a href="http://statcounter.com" target="_blank">statcounter.com</a>'
  698. },
  699. accessibility: {
  700. announceNewData: {
  701. enabled: true
  702. }
  703. },
  704. xAxis: {
  705. type: 'category'
  706. },
  707. yAxis: {
  708. title: {
  709. text: 'Total percent market share'
  710. }
  711. },
  712. legend: {
  713. enabled: false
  714. },
  715. plotOptions: {
  716. series: {
  717. borderWidth: 0,
  718. dataLabels: {
  719. enabled: true,
  720. format: '{point.y:.1f}%'
  721. }
  722. }
  723. },
  724. tooltip: {
  725. headerFormat: '<span style="font-size:11px">{series.name}</span><br>',
  726. pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>'
  727. },
  728. series: [{
  729. name: "Browsers",
  730. colorByPoint: true,
  731. data: [{
  732. name: "Chrome",
  733. y: 62.74,
  734. drilldown: "Chrome"
  735. }, {
  736. name: "Firefox",
  737. y: 10.57,
  738. drilldown: "Firefox"
  739. }, {
  740. name: "Internet Explorer",
  741. y: 7.23,
  742. drilldown: "Internet Explorer"
  743. }, {
  744. name: "Safari",
  745. y: 5.58,
  746. drilldown: "Safari"
  747. }, {
  748. name: "Edge",
  749. y: 4.02,
  750. drilldown: "Edge"
  751. }, {
  752. name: "Opera",
  753. y: 1.92,
  754. drilldown: "Opera"
  755. }, {
  756. name: "Other",
  757. y: 7.62,
  758. drilldown: null
  759. }]
  760. }],
  761. drilldown: {
  762. series: [{
  763. name: "Chrome",
  764. id: "Chrome",
  765. data: [
  766. ["v65.0",
  767. 0.1
  768. ],
  769. ["v64.0",
  770. 1.3
  771. ],
  772. ["v63.0",
  773. 53.02
  774. ],
  775. ["v62.0",
  776. 1.4
  777. ],
  778. ["v61.0",
  779. 0.88
  780. ],
  781. ["v60.0",
  782. 0.56
  783. ],
  784. ["v59.0",
  785. 0.45
  786. ],
  787. ["v58.0",
  788. 0.49
  789. ],
  790. ["v57.0",
  791. 0.32
  792. ],
  793. ["v56.0",
  794. 0.29
  795. ],
  796. ["v55.0",
  797. 0.79
  798. ],
  799. ["v54.0",
  800. 0.18
  801. ],
  802. ["v51.0",
  803. 0.13
  804. ],
  805. ["v49.0",
  806. 2.16
  807. ],
  808. ["v48.0",
  809. 0.13
  810. ],
  811. ["v47.0",
  812. 0.11
  813. ],
  814. ["v43.0",
  815. 0.17
  816. ],
  817. ["v29.0",
  818. 0.26
  819. ]
  820. ]
  821. }, {
  822. name: "Firefox",
  823. id: "Firefox",
  824. data: [
  825. ["v58.0",
  826. 1.02
  827. ],
  828. ["v57.0",
  829. 7.36
  830. ],
  831. ["v56.0",
  832. 0.35
  833. ],
  834. ["v55.0",
  835. 0.11
  836. ],
  837. ["v54.0",
  838. 0.1
  839. ],
  840. ["v52.0",
  841. 0.95
  842. ],
  843. ["v51.0",
  844. 0.15
  845. ],
  846. ["v50.0",
  847. 0.1
  848. ],
  849. ["v48.0",
  850. 0.31
  851. ],
  852. ["v47.0",
  853. 0.12
  854. ]
  855. ]
  856. }, {
  857. name: "Internet Explorer",
  858. id: "Internet Explorer",
  859. data: [
  860. ["v11.0",
  861. 6.2
  862. ],
  863. ["v10.0",
  864. 0.29
  865. ],
  866. ["v9.0",
  867. 0.27
  868. ],
  869. ["v8.0",
  870. 0.47
  871. ]
  872. ]
  873. }, {
  874. name: "Safari",
  875. id: "Safari",
  876. data: [
  877. ["v11.0",
  878. 3.39
  879. ],
  880. ["v10.1",
  881. 0.96
  882. ],
  883. ["v10.0",
  884. 0.36
  885. ],
  886. ["v9.1",
  887. 0.54
  888. ],
  889. ["v9.0",
  890. 0.13
  891. ],
  892. ["v5.1",
  893. 0.2
  894. ]
  895. ]
  896. }, {
  897. name: "Edge",
  898. id: "Edge",
  899. data: [
  900. ["v16",
  901. 2.6
  902. ],
  903. ["v15",
  904. 0.92
  905. ],
  906. ["v14",
  907. 0.4
  908. ],
  909. ["v13",
  910. 0.1
  911. ]
  912. ]
  913. }, {
  914. name: "Opera",
  915. id: "Opera",
  916. data: [
  917. ["v50.0",
  918. 0.96
  919. ],
  920. ["v49.0",
  921. 0.82
  922. ],
  923. ["v12.1",
  924. 0.14
  925. ]
  926. ]
  927. }]
  928. }
  929. });
  930. // chart 11
  931. Highcharts.chart('chart11', {
  932. chart: {
  933. type: 'area',
  934. styledMode: true
  935. },
  936. credits: {
  937. enabled: false
  938. },
  939. accessibility: {
  940. description: 'Image description: An area chart compares the nuclear stockpiles of the USA and the USSR/Russia between 1945 and 2017. The number of nuclear weapons is plotted on the Y-axis and the years on the X-axis. The chart is interactive, and the year-on-year stockpile levels can be traced for each country. The US has a stockpile of 6 nuclear weapons at the dawn of the nuclear age in 1945. This number has gradually increased to 369 by 1950 when the USSR enters the arms race with 6 weapons. At this point, the US starts to rapidly build its stockpile culminating in 32,040 warheads by 1966 compared to the USSR’s 7,089. From this peak in 1966, the US stockpile gradually decreases as the USSR’s stockpile expands. By 1978 the USSR has closed the nuclear gap at 25,393. The USSR stockpile continues to grow until it reaches a peak of 45,000 in 1986 compared to the US arsenal of 24,401. From 1986, the nuclear stockpiles of both countries start to fall. By 2000, the numbers have fallen to 10,577 and 21,000 for the US and Russia, respectively. The decreases continue until 2017 at which point the US holds 4,018 weapons compared to Russia’s 4,500.'
  941. },
  942. title: {
  943. text: 'US and USSR nuclear stockpiles'
  944. },
  945. subtitle: {
  946. text: 'Sources: <a href="https://thebulletin.org/2006/july/global-nuclear-stockpiles-1945-2006">' + 'thebulletin.org</a> &amp; <a href="https://www.armscontrol.org/factsheets/Nuclearweaponswhohaswhat">' + 'armscontrol.org</a>'
  947. },
  948. xAxis: {
  949. allowDecimals: false,
  950. labels: {
  951. formatter: function () {
  952. return this.value; // clean, unformatted number for year
  953. }
  954. },
  955. accessibility: {
  956. rangeDescription: 'Range: 1940 to 2017.'
  957. }
  958. },
  959. yAxis: {
  960. title: {
  961. text: 'Nuclear weapon states'
  962. },
  963. labels: {
  964. formatter: function () {
  965. return this.value / 1000 + 'k';
  966. }
  967. }
  968. },
  969. tooltip: {
  970. pointFormat: '{series.name} had stockpiled <b>{point.y:,.0f}</b><br/>warheads in {point.x}'
  971. },
  972. plotOptions: {
  973. area: {
  974. pointStart: 1940,
  975. marker: {
  976. enabled: false,
  977. symbol: 'circle',
  978. radius: 2,
  979. states: {
  980. hover: {
  981. enabled: true
  982. }
  983. }
  984. }
  985. }
  986. },
  987. series: [{
  988. name: 'USA',
  989. data: [
  990. null, null, null, null, null, 6, 11, 32, 110, 235,
  991. 369, 640, 1005, 1436, 2063, 3057, 4618, 6444, 9822, 15468,
  992. 20434, 24126, 27387, 29459, 31056, 31982, 32040, 31233, 29224, 27342,
  993. 26662, 26956, 27912, 28999, 28965, 27826, 25579, 25722, 24826, 24605,
  994. 24304, 23464, 23708, 24099, 24357, 24237, 24401, 24344, 23586, 22380,
  995. 21004, 17287, 14747, 13076, 12555, 12144, 11009, 10950, 10871, 10824,
  996. 10577, 10527, 10475, 10421, 10358, 10295, 10104, 9914, 9620, 9326,
  997. 5113, 5113, 4954, 4804, 4761, 4717, 4368, 4018
  998. ]
  999. }, {
  1000. name: 'USSR/Russia',
  1001. data: [null, null, null, null, null, null, null, null, null, null,
  1002. 5, 25, 50, 120, 150, 200, 426, 660, 869, 1060,
  1003. 1605, 2471, 3322, 4238, 5221, 6129, 7089, 8339, 9399, 10538,
  1004. 11643, 13092, 14478, 15915, 17385, 19055, 21205, 23044, 25393, 27935,
  1005. 30062, 32049, 33952, 35804, 37431, 39197, 45000, 43000, 41000, 39000,
  1006. 37000, 35000, 33000, 31000, 29000, 27000, 25000, 24000, 23000, 22000,
  1007. 21000, 20000, 19000, 18000, 18000, 17000, 16000, 15537, 14162, 12787,
  1008. 12600, 11400, 5500, 4512, 4502, 4502, 4500, 4500
  1009. ]
  1010. }]
  1011. });
  1012. // chart 12
  1013. Highcharts.chart('chart12', {
  1014. chart: {
  1015. styledMode: true
  1016. },
  1017. credits: {
  1018. enabled: false
  1019. },
  1020. title: {
  1021. text: 'Combination chart'
  1022. },
  1023. xAxis: {
  1024. categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
  1025. },
  1026. labels: {
  1027. items: [{
  1028. html: 'Total fruit consumption',
  1029. style: {
  1030. left: '50px',
  1031. top: '18px',
  1032. color: ( // theme
  1033. Highcharts.defaultOptions.title.style && Highcharts.defaultOptions.title.style.color) || 'black'
  1034. }
  1035. }]
  1036. },
  1037. series: [{
  1038. type: 'column',
  1039. name: 'Jane',
  1040. data: [3, 2, 1, 3, 4]
  1041. }, {
  1042. type: 'column',
  1043. name: 'John',
  1044. data: [2, 3, 5, 7, 6]
  1045. }, {
  1046. type: 'column',
  1047. name: 'Joe',
  1048. data: [4, 3, 3, 9, 0]
  1049. }, {
  1050. type: 'spline',
  1051. name: 'Average',
  1052. data: [3, 2.67, 3, 6.33, 3.33],
  1053. marker: {
  1054. lineWidth: 2,
  1055. lineColor: Highcharts.getOptions().colors[3],
  1056. fillColor: 'white'
  1057. }
  1058. }, {
  1059. type: 'pie',
  1060. name: 'Total consumption',
  1061. data: [{
  1062. name: 'Jane',
  1063. y: 13,
  1064. color: Highcharts.getOptions().colors[0] // Jane's color
  1065. }, {
  1066. name: 'John',
  1067. y: 23,
  1068. color: Highcharts.getOptions().colors[1] // John's color
  1069. }, {
  1070. name: 'Joe',
  1071. y: 19,
  1072. color: Highcharts.getOptions().colors[2] // Joe's color
  1073. }],
  1074. center: [100, 80],
  1075. size: 100,
  1076. showInLegend: false,
  1077. dataLabels: {
  1078. enabled: false
  1079. }
  1080. }]
  1081. });
  1082. // chart 13
  1083. Highcharts.chart('chart13', {
  1084. chart: {
  1085. zoomType: 'xy',
  1086. styledMode: true
  1087. },
  1088. credits: {
  1089. enabled: false
  1090. },
  1091. title: {
  1092. text: 'Average Monthly Temperature and Rainfall in Tokyo'
  1093. },
  1094. subtitle: {
  1095. text: 'Source: WorldClimate.com'
  1096. },
  1097. xAxis: [{
  1098. categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  1099. crosshair: true
  1100. }],
  1101. yAxis: [{ // Primary yAxis
  1102. labels: {
  1103. format: '{value}°C',
  1104. style: {
  1105. color: Highcharts.getOptions().colors[1]
  1106. }
  1107. },
  1108. title: {
  1109. text: 'Temperature',
  1110. style: {
  1111. color: Highcharts.getOptions().colors[1]
  1112. }
  1113. }
  1114. }, { // Secondary yAxis
  1115. title: {
  1116. text: 'Rainfall',
  1117. style: {
  1118. color: Highcharts.getOptions().colors[0]
  1119. }
  1120. },
  1121. labels: {
  1122. format: '{value} mm',
  1123. style: {
  1124. color: Highcharts.getOptions().colors[0]
  1125. }
  1126. },
  1127. opposite: true
  1128. }],
  1129. tooltip: {
  1130. shared: true
  1131. },
  1132. legend: {
  1133. layout: 'vertical',
  1134. align: 'left',
  1135. x: 120,
  1136. verticalAlign: 'top',
  1137. y: 100,
  1138. floating: true,
  1139. backgroundColor: Highcharts.defaultOptions.legend.backgroundColor || // theme
  1140. 'rgba(255,255,255,0.25)'
  1141. },
  1142. series: [{
  1143. name: 'Rainfall',
  1144. type: 'column',
  1145. yAxis: 1,
  1146. data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
  1147. tooltip: {
  1148. valueSuffix: ' mm'
  1149. }
  1150. }, {
  1151. name: 'Temperature',
  1152. type: 'spline',
  1153. data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
  1154. tooltip: {
  1155. valueSuffix: '°C'
  1156. }
  1157. }]
  1158. });
  1159. // chart 14
  1160. Highcharts.chart('chart14', {
  1161. chart: {
  1162. type: 'column',
  1163. styledMode: true
  1164. },
  1165. title: {
  1166. text: 'Column chart with negative values'
  1167. },
  1168. xAxis: {
  1169. categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
  1170. },
  1171. credits: {
  1172. enabled: false
  1173. },
  1174. series: [{
  1175. name: 'John',
  1176. data: [5, 3, 4, 7, 2]
  1177. }, {
  1178. name: 'Jane',
  1179. data: [2, -2, -3, 2, 1]
  1180. }, {
  1181. name: 'Joe',
  1182. data: [3, 4, 4, -2, 5]
  1183. }]
  1184. });
  1185. // chart 15
  1186. Highcharts.chart('chart15', {
  1187. chart: {
  1188. type: 'column',
  1189. styledMode: true
  1190. },
  1191. credits: {
  1192. enabled: false
  1193. },
  1194. title: {
  1195. text: 'Stacked column chart'
  1196. },
  1197. xAxis: {
  1198. categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
  1199. },
  1200. yAxis: {
  1201. min: 0,
  1202. title: {
  1203. text: 'Total fruit consumption'
  1204. },
  1205. stackLabels: {
  1206. enabled: true,
  1207. style: {
  1208. fontWeight: 'bold',
  1209. color: ( // theme
  1210. Highcharts.defaultOptions.title.style && Highcharts.defaultOptions.title.style.color) || 'gray'
  1211. }
  1212. }
  1213. },
  1214. legend: {
  1215. align: 'right',
  1216. x: -30,
  1217. verticalAlign: 'top',
  1218. y: 25,
  1219. floating: true,
  1220. backgroundColor: Highcharts.defaultOptions.legend.backgroundColor || 'white',
  1221. borderColor: '#CCC',
  1222. borderWidth: 1,
  1223. shadow: false
  1224. },
  1225. tooltip: {
  1226. headerFormat: '<b>{point.x}</b><br/>',
  1227. pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
  1228. },
  1229. plotOptions: {
  1230. column: {
  1231. stacking: 'normal',
  1232. dataLabels: {
  1233. enabled: true
  1234. }
  1235. }
  1236. },
  1237. series: [{
  1238. name: 'John',
  1239. data: [5, 3, 4, 7, 2]
  1240. }, {
  1241. name: 'Jane',
  1242. data: [2, 2, 3, 2, 1]
  1243. }, {
  1244. name: 'Joe',
  1245. data: [3, 4, 4, 2, 5]
  1246. }]
  1247. });
  1248. });