Advertisement
Guest User

Untitled

a guest
Oct 7th, 2015
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>Charts</title>
  6. <link rel="stylesheet" href="style.css" type="text/css">
  7. <script src="amcharts.js" type="text/javascript"></script>
  8. <script type="text/javascript">
  9. var chart;
  10. var chartData = [{
  11. country: "USA",
  12. visits: 400,
  13. color: "#FF0F00"
  14. }, {
  15. country: "China",
  16. visits: 380,
  17. color: "#FF6600"
  18. }, {
  19. country: "Japan",
  20. visits: 360,
  21. color: "#FF9E01"
  22. }, {
  23. country: "Germany",
  24. visits: 340,
  25. color: "#FCD202"
  26. }, {
  27. country: "UK",
  28. visits: 320,
  29. color: "#F8FF01"
  30. }, {
  31. country: "France",
  32. visits: 300,
  33. color: "#B0DE09"
  34. }, {
  35. country: "India",
  36. visits: 240,
  37. color: "#04D215"
  38. }, {
  39. country: "Spain",
  40. visits: 200,
  41. color: "#0D8ECF"
  42. }, {
  43. country: "Netherlands",
  44. visits: 140,
  45. color: "#0D52D1"
  46. }, {
  47. country: "Russia",
  48. visits: 100,
  49. color: "#2A0CD0"
  50. }, {
  51. country: "South Korea",
  52. visits: 80,
  53. color: "#8A0CCF"
  54. }, {
  55. country: "Canada",
  56. visits: 20,
  57. color: "#CD0D74"
  58. }];
  59. AmCharts.ready(function () {
  60. chart = new AmCharts.AmSerialChart();
  61. chart.dataProvider = chartData;
  62. chart.categoryField = "country";
  63. chart.startDuration = 1;
  64. // AXES
  65. // category
  66. var categoryAxis = chart.categoryAxis;
  67. categoryAxis.labelRotation = 45; // this line makes category values to be rotated
  68. categoryAxis.gridAlpha = 0;
  69. categoryAxis.fillAlpha = 1;
  70. categoryAxis.fillColor = "#FAFAFA";
  71. categoryAxis.gridPosition = "start";
  72. // value
  73. var valueAxis = new AmCharts.ValueAxis();
  74. valueAxis.dashLength = 5;
  75. valueAxis.title = "Visitors from country"
  76. valueAxis.axisAlpha = 0;
  77. chart.addValueAxis(valueAxis);
  78. // GRAPH
  79. var graph = new AmCharts.AmGraph();
  80. graph.valueField = "visits";
  81. graph.colorField = "color";
  82. graph.balloonText = "[[category]]: [[value]]";
  83. graph.type = "column";
  84. graph.lineAlpha = 0;
  85. graph.fillAlphas = 1;
  86. chart.addGraph(graph);
  87. // WRITE
  88. chart.write("chartdiv");
  89. });
  90. </script>
  91. </head>
  92.  
  93. <body>
  94. <div id="chartdiv" style="width: 600px; height: 500px;"></div>
  95. </body>
  96.  
  97. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement