index.htm 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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://cdn.hcharts.cn/jquery/jquery-1.8.3.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="http://cdn.hcharts.cn/highcharts/highcharts.js"></script>
  68. <script src="http://cdn.hcharts.cn/highcharts/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>