Blame view
samples/lineWithReversedValueAxis.html
5.5 KB
aaa287d94 NN |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>amCharts examples</title> <link rel="stylesheet" href="style.css" type="text/css"> <script src="../amcharts/amcharts.js" type="text/javascript"></script> <script src="../amcharts/serial.js" type="text/javascript"></script> <script type="text/javascript"> var chart; var chartData = [ { "year": 1930, "italy": 1, "germany": 5, "uk": 3 }, { "year": 1934, "italy": 1, "germany": 2, "uk": 6 }, { "year": 1938, "italy": 2, "germany": 3, "uk": 1 }, { "year": 1950, "italy": 3, "germany": 4, "uk": 1 }, { "year": 1954, "italy": 5, "germany": 1, "uk": 2 }, { "year": 1958, "italy": 3, "germany": 2, "uk": 1 }, { "year": 1962, "italy": 1, "germany": 2, "uk": 3 }, { "year": 1966, "italy": 2, "germany": 1, "uk": 5 }, { "year": 1970, "italy": 3, "germany": 5, "uk": 2 }, { "year": 1974, "italy": 4, "germany": 3, "uk": 6 }, { "year": 1978, "italy": 1, "germany": 2, "uk": 4 } ]; AmCharts.ready(function () { // SERIAL CHART chart = new AmCharts.AmSerialChart(); chart.dataProvider = chartData; chart.categoryField = "year"; chart.startDuration = 0.5; chart.balloon.color = "#000000"; // AXES // category var categoryAxis = chart.categoryAxis; categoryAxis.fillAlpha = 1; categoryAxis.fillColor = "#FAFAFA"; categoryAxis.gridAlpha = 0; categoryAxis.axisAlpha = 0; categoryAxis.gridPosition = "start"; categoryAxis.position = "top"; // value var valueAxis = new AmCharts.ValueAxis(); valueAxis.title = "Place taken"; valueAxis.dashLength = 5; valueAxis.axisAlpha = 0; valueAxis.minimum = 1; valueAxis.maximum = 6; valueAxis.integersOnly = true; valueAxis.gridCount = 10; valueAxis.reversed = true; // this line makes the value axis reversed chart.addValueAxis(valueAxis); // GRAPHS // Italy graph var graph = new AmCharts.AmGraph(); graph.title = "Italy"; graph.valueField = "italy"; graph.hidden = true; // this line makes the graph initially hidden graph.balloonText = "place taken by Italy in [[category]]: [[value]]"; graph.lineAlpha = 1; graph.bullet = "round"; chart.addGraph(graph); // Germany graph var graph = new AmCharts.AmGraph(); graph.title = "Germany"; graph.valueField = "germany"; graph.balloonText = "place taken by Germany in [[category]]: [[value]]"; graph.bullet = "round"; chart.addGraph(graph); // United Kingdom graph var graph = new AmCharts.AmGraph(); graph.title = "United Kingdom"; graph.valueField = "uk"; graph.balloonText = "place taken by UK in [[category]]: [[value]]"; graph.bullet = "round"; chart.addGraph(graph); // CURSOR var chartCursor = new AmCharts.ChartCursor(); chartCursor.cursorPosition = "mouse"; chartCursor.zoomable = false; chartCursor.cursorAlpha = 0; chart.addChartCursor(chartCursor); // LEGEND var legend = new AmCharts.AmLegend(); legend.useGraphSettings = true; chart.addLegend(legend); // WRITE chart.write("chartdiv"); }); </script> </head> <body> <div id="chartdiv" style="width: 100%; height: 400px;"></div> </body> </html> |