Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<!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>var chart;var chartData = [{"date": "2012-03-01","price": 20},{"date": "2012-03-02","price": 75},{"date": "2012-03-03","price": 15},{"date": "2012-03-04","price": 75},{"date": "2012-03-05","price": 158},{"date": "2012-03-06","price": 57},{"date": "2012-03-07","price": 107},{"date": "2012-03-08","price": 89},{"date": "2012-03-09","price": 75},{"date": "2012-03-10","price": 132},{"date": "2012-03-11","price": 158},{"date": "2012-03-12","price": 56},{"date": "2012-03-13","price": 169},{"date": "2012-03-14","price": 24},{"date": "2012-03-15","price": 147}];var average = 90.4;AmCharts.ready(function () {// SERIAL CHARTchart = new AmCharts.AmSerialChart();chart.dataProvider = chartData;chart.categoryField = "date";chart.dataDateFormat = "YYYY-MM-DD";// AXES// categoryvar categoryAxis = chart.categoryAxis;categoryAxis.parseDates = true; // as our data is date-based, we set parseDates to truecategoryAxis.minPeriod = "DD"; // our data is daily, so we set minPeriod to DDcategoryAxis.dashLength = 1;categoryAxis.gridAlpha = 0.15;categoryAxis.axisColor = "#DADADA";// valuevar valueAxis = new AmCharts.ValueAxis();valueAxis.axisColor = "#DADADA";valueAxis.dashLength = 1;valueAxis.logarithmic = true; // this line makes axis logarithmicchart.addValueAxis(valueAxis);// GUIDE for averagevar guide = new AmCharts.Guide();guide.value = average;guide.lineColor = "#CC0000";guide.dashLength = 4;guide.label = "average";guide.inside = true;guide.lineAlpha = 1;valueAxis.addGuide(guide);// GRAPHvar graph = new AmCharts.AmGraph();graph.type = "smoothedLine";graph.bullet = "round";graph.bulletColor = "#FFFFFF";graph.useLineColorForBulletBorder = true;graph.bulletBorderAlpha = 1;graph.bulletBorderThickness = 2;graph.bulletSize = 7;graph.title = "Price";graph.valueField = "price";graph.lineThickness = 2;graph.lineColor = "#00BBCC";chart.addGraph(graph);// CURSORvar chartCursor = new AmCharts.ChartCursor();chartCursor.cursorPosition = "mouse";chart.addChartCursor(chartCursor);// SCROLLBARvar chartScrollbar = new AmCharts.ChartScrollbar();chartScrollbar.graph = graph;chartScrollbar.scrollbarHeight = 30;chart.addChartScrollbar(chartScrollbar);chart.creditsPosition = "bottom-right";// WRITEchart.write("chartdiv");});</script></head><body><div id="chartdiv" style="width: 100%; height: 400px;"></div></body></html>