Thank you for your help !
I got the line chart working see following URL,
I am now looking for help on how to fix the IE 8/9 not displaying the axis
data.
http://www.marcillo.com/chartdata.do?method=showChartLine5
I use visialization java classes to generate a datatable. I add the
following collumns
ArrayList<ColumnDescription> cd = new ArrayList<ColumnDescription>();
cd.add(new ColumnDescription("date", ValueType.TEXT, "Date"));
cd.add(new ColumnDescription("lower", ValueType.NUMBER, "Lowest"));
cd.add(new ColumnDescription("celcius", ValueType.NUMBER,
"celcius"));
cd.add(new ColumnDescription("upper", ValueType.NUMBER, "Highest"));
cd.add(new ColumnDescription("reading", ValueType.NUMBER,
"Reading"));
newData.addColumns(cd);
Following is javascript used in the html to display the line chart.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1.1", {packages:["corechart"]});
var currentTime = new Date();
var aUrlValue =
"<%=request.getContextPath()%>/chartdata.do?method=getTemperature&type=three";
google.setOnLoadCallback( initChart );
function initChart(){
google.setOnLoadCallback( initChart );
var aszCurrentDatTime = new Date();;
document.getElementById('area1').innerHTML = aszCurrentDatTime;
document.getElementById("chart_div").style.display = 'none';
var aszNewURLData = aUrlValue+'&d='+escape(currentTime)+'&debug=Y';
var opts = {sendMethod: 'xhr'};
var query = new google.visualization.Query( aszNewURLData, opts);
query.setQuery('select C, sum(B) group by C');
query.send( handleQueryResponse );
}
function handleQueryResponse( response ) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}
var data = response.getDataTable();
var chart = new
google.visualization.LineChart(document.getElementById('chart_div'));
var CharOptions = {
'title': 'Temperature Chart',
width: 500,
height: 340,
hAxis: {
title: 'Date Time'
},
series: {
0: {
targetAxisIndex: 0
},
1: {
targetAxisIndex: 1,
visibleInLegend: false,
pointSize: 0,
lineWidth: 0
}
},
vAxes: {
0: {
title: 'Fahrenheit',
viewWindowMode: 'maximized'
},
1: {
title: 'Celsius',
viewWindowMode: 'maximized'
}
}
};
chart.draw( data, CharOptions);
document.getElementById('chart_div').style.display = 'block';
runDetail();
}
</script>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/nGPUUbqSKcQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.