66 lines
1.9 KiB
HTML
66 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: CSV</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\n\
|
||
|
3.5, 2001\n\
|
||
|
3.1, 2002\n\
|
||
|
4.2, 2003\n\
|
||
|
4.5, 2004\n\
|
||
|
9.6, 2005\n\
|
||
|
7.4, 2006\n\
|
||
|
9.0, 2007\n\
|
||
|
7.3, 2008\n\
|
||
|
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,"csv");
|
||
|
|
||
|
var barChart2 = new dhtmlXChart({
|
||
|
view:"pie",
|
||
|
container:"chart_container2",
|
||
|
value:"#data0#",
|
||
|
details:"#data1#"
|
||
|
});
|
||
|
barChart2.parse(data,"csv");
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<p>When data are loaded from CSV string, 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>
|