var totalData = [ {date:new Date(1992,0)}, {date:new Date(1993,0),television:83,newspapers:52,radio:17,magazines:5,other:1}, {date:new Date(1993,8),television:83,newspapers:60,radio:17,magazines:9,other:3}, {date:new Date(1994,0),television:83,newspapers:51,radio:15,magazines:10,other:5}, {date:new Date(1995,8),television:82,newspapers:63,radio:20,magazines:10,other:1}, {date:new Date(1996,0),television:88,newspapers:61,radio:25,magazines:8,other:2}, {date:new Date(1999,0),television:82,newspapers:42,radio:18,magazines:4,internet:6,other:2}, {date:new Date(1999,9),television:80,newspapers:48,radio:19,magazines:5,internet:11,other:2}, {date:new Date(2001,1),television:76,newspapers:40,radio:16,magazines:4,internet:10,other:2}, {date:new Date(2001,7),television:74,newspapers:45,radio:18,magazines:6,internet:13,other:1}, {date:new Date(2002,0),television:82,newspapers:42,radio:21,magazines:3,internet:14,other:2}, {date:new Date(2003,0),television:81,newspapers:44,radio:22,magazines:4,internet:17,other:2}, {date:new Date(2003,1),television:83,newspapers:42,radio:19,magazines:4,internet:15,other:3}, {date:new Date(2003,6),television:79,newspapers:45,radio:16,magazines:5,internet:19,other:1}, {date:new Date(2003,7),television:79,newspapers:46,radio:15,magazines:3,internet:18,other:2}, {date:new Date(2003,9),television:80,newspapers:50,radio:18,magazines:4,internet:20,other:2}, {date:new Date(2004,11),television:74,newspapers:46,radio:21,magazines:4,internet:24,other:2}, {date:new Date(2005,5),television:74,newspapers:44,radio:22,magazines:5,internet:24,other:2}, {date:new Date(2005,10),television:73,newspapers:36,radio:16,magazines:2,internet:20,other:2}, {date:new Date(2006,7),television:72,newspapers:36,radio:14,magazines:4,internet:24,other:2}, {date:new Date(2006,8),television:74,newspapers:37,radio:16,magazines:4,internet:21,other:3}, {date:new Date(2007,8),television:74,newspapers:34,radio:13,magazines:2,internet:24,other:2}, {date:new Date(2008,11),television:70,newspapers:35,radio:18,magazines:5,internet:40,other:2}, {date:new Date(2009,6),television:71,newspapers:33,radio:21,magazines:3,internet:42,other:1}, {date:new Date(2009,11),television:70,newspapers:32,radio:17,magazines:3,internet:35,other:1}, {date:new Date(2010,6),television:68,newspapers:24,radio:17,magazines:3,internet:41,other:2}, {date:new Date(2010,11),television:66,newspapers:31,radio:16,magazines:3,internet:41,other:1}, {date:new Date(2011,6),television:66,newspapers:31,radio:19,magazines:3,internet:43,other:4}, {date:new Date(2013,6),television:69,newspapers:28,radio:23,magazines:4,internet:50,other:2}, {date:new Date(2013,9)}]; window.onload = function() { //CHART 1 Total Population var chart1 = new AmCharts.AmSerialChart(); chart1.dataProvider = totalData; chart1.categoryField = 'date'; chart1.marginRight = 20; chart1.marginLeft = 40; chart1.marginBottom = 30; chart1.marginTop = 10; chart1.panEventsEnabled = true; chart1.pathToImages = "http://digitalinfo.org/scripts/amcharts/javascript/images/"; chart1.fontFamily = "'Lucida Grande','Lucida Sans Unicode',helvetica,arial,sans-serif"; var catAxis = chart1.categoryAxis; catAxis.inside = false; catAxis.gridAlpha = 0; catAxis.tickLength = 4; catAxis.autoGridCount = false; catAxis.gridCount = 12; catAxis.fontSize = 12; catAxis.parseDates = true; catAxis.axisAlpha = 1; catAxis.axisColor = "#CCCCCC"; var valueAxis = new AmCharts.ValueAxis(); valueAxis.dashLength = 4; valueAxis.tickLength = 4; valueAxis.axisAlpha = 1; valueAxis.axisColor = "#CCCCCC"; valueAxis.minimum = 0; valueAxis.maximum = 100; valueAxis.fontSize = 10; chart1.addValueAxis(valueAxis); var balloon = chart1.balloon; balloon.adjustBorderColor = true; balloon.color = "#000000"; balloon.borderThickness = 3; balloon.cornerRadius = 0; balloon.fillAlpha = 1; balloon.fillColor = "#FFFFFF"; balloon.pointerWidth = 7; balloon.fontSize = 11; var graph1 = new AmCharts.AmGraph(); graph1.valueField = 'television'; graph1.title = "Television"; graph1.balloonText = "Television: [[value]]%"; graph1.legendValueText = "[[value]]%"; graph1.type = 'line'; graph1.bulletSize = 8; graph1.bullet = "round"; graph1.bulletBorderThickness = 2; graph1.bulletBorderColor = "#FFFFFF"; graph1.bulletBorderAlpha = 1; graph1.lineThickness = 3; graph1.lineColor = "#de5049"; chart1.addGraph(graph1); var graph2 = new AmCharts.AmGraph(); graph2.valueField = 'internet'; graph2.title = "Internet"; graph2.balloonText = "Internet: [[value]]%"; graph2.legendValueText = "[[value]]%"; graph2.type = 'line'; graph2.bulletSize = 8; graph2.bullet = "round"; graph2.bulletBorderThickness = 2; graph2.bulletBorderColor = "#FFFFFF"; graph2.bulletBorderAlpha = 1; graph2.lineThickness = 3; /*graph2.fillAlphas = .15;*/ graph2.lineColor = "#45b2d1"; chart1.addGraph(graph2); var graph3 = new AmCharts.AmGraph(); graph3.valueField = 'newspapers'; graph3.title = "Newspaper"; graph3.balloonText = "Newspaper: [[value]]%"; graph3.legendValueText = "[[value]]%"; graph3.type = 'line'; graph3.bulletSize = 8; graph3.bullet = "round"; graph3.bulletBorderThickness = 2; graph3.bulletBorderColor = "#FFFFFF"; graph3.bulletBorderAlpha = 1; graph3.lineThickness = 3; graph3.lineColor = "#aed3f1"; chart1.addGraph(graph3); var graph4 = new AmCharts.AmGraph(); graph4.valueField = 'radio'; graph4.title = "Radio"; graph4.balloonText = "Radio: [[value]]%"; graph4.legendValueText = "[[value]]%"; graph4.type = 'line'; graph4.bulletSize = 8; graph4.bullet = "round"; graph4.bulletBorderThickness = 2; graph4.bulletBorderColor = "#FFFFFF"; graph4.bulletBorderAlpha = 1; graph4.lineThickness = 3; graph4.lineColor = "#c4bfb1"; chart1.addGraph(graph4); var graph5 = new AmCharts.AmGraph(); graph5.valueField = 'magazines'; graph5.title = "Magazine"; graph5.balloonText = "Magazine: [[value]]%"; graph5.legendValueText = "[[value]]%"; graph5.type = 'line'; graph5.bulletSize = 8; graph5.bullet = "round"; graph5.bulletBorderThickness = 2; graph5.bulletBorderColor = "#FFFFFF"; graph5.bulletBorderAlpha = 1; graph5.lineThickness = 3; graph5.lineColor = "#666666"; chart1.addGraph(graph5); var graph6 = new AmCharts.AmGraph(); graph6.valueField = 'other'; graph6.title = "Other"; graph6.balloonText = "Other: [[value]]%"; graph6.legendValueText = "[[value]]%"; graph6.type = 'line'; graph6.bulletSize = 8; graph6.bullet = "round"; graph6.bulletBorderThickness = 2; graph6.bulletBorderColor = "#FFFFFF"; graph6.bulletBorderAlpha = 1; graph6.lineThickness = 3; graph6.lineColor = "#000000"; // chart1.addGraph(graph6); var chartCursor = new AmCharts.ChartCursor(); chartCursor.categoryBalloonDateFormat = "MM-YYYY"; chartCursor.cursorColor = "#000000"; chartCursor.cursorPosition = "middle"; chart1.addChartCursor(chartCursor); var legend = new AmCharts.AmLegend(); legend.marginLeft = 20; legend.marginTop = 0; legend.marginRight = 0; legend.fontSize = 12; legend.position = "top"; legend.verticalGap = 20; legend.markerSize = 10; legend.markerLabelGap = 10; legend.markerType = "circle"; legend.textClickEnabled = false; legend.rollOverColor = "#000000"; legend.spacing = 0; legend.valueWidth = 40; chart1.addLegend(legend); chart1.write('container1'); }