odoo/addons/web_graph/static/lib/dhtmlxGraph/samples/01_initialization/04_load_jsarray.html

69 lines
1.9 KiB
HTML

<!--conf
<sample>
<product version="2.6" edition="std"/>
<modifications>
<modified date="100609"/>
</modifications>
</sample>
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Data Loading: JS array</title>
<script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script>
<link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css">
<style>
.dhx_chart_title{
padding-left:3px
}
</style>
<script>
var data = [
[ "2.9", "2000" ],
[ "3.5", "2001" ],
[ "3.1", "2002" ],
[ "4.2", "2003" ],
[ "4.5", "2004" ],
[ "9.6", "2005" ],
[ "7.4", "2006" ],
[ "9.0", "2007" ],
[ "7.3", "2008" ],
[ "2.8", "2009" ]
];
window.onload = function(){
var barChart = new dhtmlXChart({
view:"bar",
container:"chart_container",
value:"#data0#",
label:"#data1#",
padding:{
bottom:0,
right:0,
left:0
},
width:30,
gradient:true,
border:false
})
barChart.parse(data,"jsarray");
var barChart2 = new dhtmlXChart({
view:"pie",
container:"chart_container2",
value:"#data0#",
details:"#data1#"
});
barChart2.parse(data,"jsarray");
}
</script>
</head>
<body>
<p>When data are loaded from JS array, you should use "data" and field index to define field in the template, for example, "#data0#","#data1#",etc.<br/>Charts in this sample represents values in the first column. Therefore, we have set value:"#data0#" in a chart contructor.</p>
<div id="chart_container" style="width:450px;height:300px;border:1px solid #A4BED4;float:left;margin-right:20px"></div>
<div id="chart_container2" style="width:450px;height:300px;border:1px solid #A4BED4;"></div>
</body>
</html>