<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.google.gson.Gson"%>
<%@ page import="com.google.gson.JsonObject"%>
<%
Gson gsonObj = new Gson();
Map<Object,Object> map = null;
List<Map<Object,Object>> list = new ArrayList<Map<Object,Object>>();
map = new HashMap<Object,Object>(); map.put("x", 1483209000000L); map.put("y", new Integer[] {8,18}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1485887400000L); map.put("y", new Integer[] {8,18}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1488306600000L); map.put("y", new Integer[] {9,19}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1490985000000L); map.put("y", new Integer[] {10,21}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1493577000000L); map.put("y", new Integer[] {12,22}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1496255400000L); map.put("y", new Integer[] {13,24}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1498847400000L); map.put("y", new Integer[] {16,27}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1501525800000L); map.put("y", new Integer[] {16,28}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1504204200000L); map.put("y", new Integer[] {14,27}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1506796200000L); map.put("y", new Integer[] {12,24}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1509474600000L); map.put("y", new Integer[] {10,23}); list.add(map);
map = new HashMap<Object,Object>(); map.put("x", 1512066600000L); map.put("y", new Integer[] {8,19}); list.add(map);
String dataPoints = gsonObj.toJson(list);
%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
exportEnabled: true,
title: {
text: "Average High/Low Temperature - Los Angeles, 2017"
},
subtitles: [{
text: "Average High/Low Tempaerature"
}],
axisY: {
title: "Temperature (°C)",
suffix: " °C"
},
axisX: {
valueFormatString: "MMM"
},
data: [{
type: "rangeColumn",
xValueFormatString: "MMMM",
xValueType: "dateTime",
yValueFormatString: "#,##0.## °C",
indexLabel: "{y[#index]}",
toolTipContent: " <span style=\"color:#4F81BC\">{x}</span><br><b>Min:</b> {y[0]}<br><b>Max:</b> {y[1]}",
dataPoints: <%out.print(dataPoints);%>
}]
});
chart.render();
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
</body>
</html>