dojo+饼图
1.js脚本:
- dojo.require("dojox.charting.Chart2D");
dojo.require("dojox.charting.plot2d.Pie");
dojo.require("dojox.charting.action2d.Highlight");
dojo.require("dojox.charting.action2d.MoveSlice");
dojo.require("dojox.charting.action2d.Tooltip");
dojo.require("dojox.charting.themes.MiamiNice");
dojo.require("dojox.charting.widget.Legend"); - function getPipe() {
- var dc = dojox.charting;
- var chartTwo = new dc.Chart2D("chartTwo");
- chartTwo.setTheme(dc.themes.MiamiNice).addPlot("default", {
- type: "Pie",
- font: "normal normal 11pt Tahoma",
- fontColor: "black",
- labelOffset: -30,
- radius: 80
- }).addSeries("Series A", [{
- y: 4,
- text: "Red",
- stroke: "black",
- tooltip: "Red is 50%"
- },
- {
- y: 2,
- text: "Green",
- stroke: "black",
- tooltip: "Green is 25%"
- },
- {
- y: 1,
- text: "Blue",
- stroke: "black",
- tooltip: "I am feeling Blue!"
- },
- {
- y: 1,
- text: "Other",
- stroke: "black",
- tooltip: "Mighty <strong>strong</strong><br>With two lines!"
- }]);
- var anim_a = new dc.action2d.MoveSlice(chartTwo, "default");
- var anim_b = new dc.action2d.Highlight(chartTwo, "default");
- var anim_c = new dc.action2d.Tooltip(chartTwo, "default");
- chartTwo.render();
- var legendTwo = new dojox.charting.widget.Legend({
- chart: chartTwo
- },
- "legendTwo");
- }
- dojo.addOnLoad(getPipe);//添加onload事件
2.HTML代码:
- <div id="legendTwo">
- </div>
3.展示效果:
转载于:https://blog.51cto.com/zhaojianping/502708