There's been a lot of posts about line charts and grid lines. So far
I've not been able to get colors, backgrounds or grid lines to
work...in fact if I change anything as far as options are concerned,
the entire chart fails to appear on my page....
The generic code works fine but I would like to modify some of the
elements mentioned above.
Any help and examples appreciated. My code follows.
-----------------------------start code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<%
Set oConn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
oConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\domains
\
dev.constructionworkzone.com\files\databases
\onlinecomodities.mdb;User ID=;Password=;"
rs.open "Select * From CurrentData Where [series_id] = 'WPU051' Order
by [year], [period];", oConn, 3, 2
if rs.recordcount > 0 then
rs.movefirst %>
<div id="chart_div"></div>
<div style="margin-left: 200px; margin-top: 300px">
<script type="text/javascript" src="
https://www.google.com/
jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Year');
data.addColumn('number', 'Coal');
<%
aCntr = 0 'array index counter
%>
data.addRows(<%= rs.recordcount + 1 %>);
<% do while not rs.eof %>
data.setValue(<%= aCntr %>, 0, '<%= rs("year") & "/" &
mid(rs("period"),2,2) %>');
data.setValue(<%= aCntr %>, 1, <%= rs("value") %>);
<%
aCntr = aCntr + 1
rs.movenext
loop
%>
var options = {cht: 'ls'};
var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, {width: 970, height: 540, title: 'Commodities'});
}
</script>
</div>
<% end if %>
</body>
</html>
-----------------------------end code
I've tried putting configuration options in this line....
chart.draw(data, {width: 970, height: 540, title: 'Commodities'});
...without success.
How can I change the colors of the chart elements both back and fore
ground, how can I change the color of the line in the graph and how
can I make vertical grid lines appear on the chart?
You can see the chart at the following address..
http://dev.constructionworkzone.com/cmod/gchart2.asp
Thanks in advance..
Anthony Jaxon
Los Angeles, CA USA