65 lines
1.8 KiB
HTML
65 lines
1.8 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>Colors: color gradient</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 = [
|
|
{ sales:"2.9", year:"2000" },
|
|
{ sales:"3.5", year:"2001" },
|
|
{ sales:"3.1", year:"2002" },
|
|
{ sales:"4.2", year:"2003" },
|
|
{ sales:"4.5", year:"2004" },
|
|
{ sales:"9.6", year:"2005" },
|
|
{ sales:"7.4", year:"2006" },
|
|
{ sales:"9.0", year:"2007" },
|
|
{ sales:"7.3", year:"2008" },
|
|
{ sales:"4.8", year:"2009" }
|
|
];
|
|
|
|
window.onload = function(){
|
|
var barChart = new dhtmlXChart({
|
|
view:"bar",
|
|
container:"chart_container",
|
|
value:"#sales#",
|
|
label:"#year#",
|
|
padding:{
|
|
bottom:0,
|
|
right:0,
|
|
left:0
|
|
},
|
|
width:30,
|
|
gradient:function(gradient){
|
|
gradient.addColorStop(1.0,"#FF0000");
|
|
gradient.addColorStop(0.2,"#FFFF00");
|
|
gradient.addColorStop(0.0,"#00FF22");
|
|
}
|
|
})
|
|
barChart.parse(data,"json");
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<p>The color of Bar Chart can be defined by gradient property. <br/>
|
|
In this case you should set a function that takes a gradient object as an argument. And using addColorStop you may define colors for chart.</p>
|
|
<div id="chart_container" style="width:500px;height:300px;border:1px solid #A4BED4;"></div>
|
|
</body>
|
|
</html>
|