You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.3 KiB

9 years ago
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Highcharts Example</title>
  6. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
  7. <style type="text/css">
  8. ${demo.css}
  9. </style>
  10. <script type="text/javascript">
  11. $(function () {
  12. // Make monochrome colors and set them as default for all pies
  13. Highcharts.getOptions().plotOptions.pie.colors = (function () {
  14. var colors = [],
  15. base = Highcharts.getOptions().colors[0],
  16. i;
  17. for (i = 0; i < 10; i += 1) {
  18. // Start out with a darkened base color (negative brighten), and end
  19. // up with a much brighter color
  20. colors.push(Highcharts.Color(base).brighten((i - 3) / 7).get());
  21. }
  22. return colors;
  23. }());
  24. // Build the chart
  25. $('#container').highcharts({
  26. chart: {
  27. plotBackgroundColor: null,
  28. plotBorderWidth: null,
  29. plotShadow: false,
  30. type: 'pie'
  31. },
  32. title: {
  33. text: 'Browser market shares at a specific website, 2014'
  34. },
  35. tooltip: {
  36. pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
  37. },
  38. plotOptions: {
  39. pie: {
  40. allowPointSelect: true,
  41. cursor: 'pointer',
  42. dataLabels: {
  43. enabled: true,
  44. format: '<b>{point.name}</b>: {point.percentage:.1f} %',
  45. style: {
  46. color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
  47. }
  48. }
  49. }
  50. },
  51. series: [{
  52. name: "Brands",
  53. data: [
  54. {name: "Microsoft Internet Explorer", y: 56.33},
  55. {name: "Chrome", y: 24.03},
  56. {name: "Firefox", y: 10.38},
  57. {name: "Safari", y: 4.77},
  58. {name: "Opera", y: 0.91},
  59. {name: "Proprietary or Undetectable", y: 0.2}
  60. ]
  61. }]
  62. });
  63. });
  64. </script>
  65. </head>
  66. <body>
  67. <script src="../../js/highcharts.js"></script>
  68. <script src="../../js/modules/exporting.js"></script>
  69. <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
  70. </body>
  71. </html>