Legend
Pie Chart provides property "legend" that displays information about all sectors.
PieChart with default legend | PieChart with custom legend |
Pie Chart provides property "legend" that displays information about all sectors.
PieChart with default legend | PieChart with custom legend |
<script src="../../codebase/dhtmlxchart.js" type="text/javascript"></script> <link rel="STYLESHEET" type="text/css" href="../../codebase/dhtmlxchart.css"> <script></script> <table> <tr> <td>PieChart with default legend</td> <td>PieChart with custom legend</td> </tr> <tr> <td><div id="chart1" style="width:400px;height:300px;border:1px solid #A4BED4;"></div></td> <td><div id="chart2" style="width:400px;height:300px;border:1px solid #A4BED4;"></div></td> </tr> </table>var data = [{ sales: "3.0", year: "2000" }, { sales: "3.8", year: "2001" }, { sales: "3.4", year: "2002" }, { sales: "4.1", year: "2003" }, { sales: "4.3", year: "2004" }, { sales: "9.9", 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 pieChart = new dhtmlXChart({ view: "pie", container: "chart1", value: "#sales#", pieInnerText: "#sales#", gradient: true, tooltip: { template: "#sales#"; }, legend: "#year#", padding: { left: 0; } }); pieChart.parse(data, "json"); var pieChart2 = new dhtmlXChart({ view: "pie", container: "chart2", value: "#sales#", pieInnerText: "#sales#", gradient: true, legend: { width: 75, align: "right", valign: "middle", marker: { type: "round", width: 15; }, template: "#year#"; } }); pieChart2.parse(data, "json"); }