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");- functiongetPipe(){
- vardc=dojox.charting;
- varchartTwo=newdc.Chart2D("chartTwo");
- chartTwo.setTheme(dc.themes.MiamiNice).addPlot("default",{
- type:"Pie",
- font:"normalnormal11ptTahoma",
- fontColor:"black",
- labelOffset:-30,
- radius:80
- }).addSeries("SeriesA",[{
- y:4,
- text:"Red",
- stroke:"black",
- tooltip:"Redis50%"
- },
- {
- y:2,
- text:"Green",
- tooltip:"Greenis25%"
- },
- {
- y:1,
- text:"Blue",
- tooltip:"IamfeelingBlue!"
- },
- text:"Other",
- tooltip:"Mighty<strong>strong</strong><br>Withtwolines!"
- }]);
- varanim_a=newdc.action2d.MoveSlice(chartTwo,"default");
- varanim_b=newdc.action2d.Highlight(chartTwo,"default");
- varanim_c=newdc.action2d.Tooltip(chartTwo,"default");
- chartTwo.render();
- varlegendTwo=newdojox.charting.widget.Legend({
- chart:chartTwo
- },
- "legendTwo");
- }
- dojo.addOnLoad(getPipe);//添加onload事件
2.HTML代码:
- <divid="legendTwo">
- </div>
3.展示效果:
原文链接:https://www.f2er.com/dojo/291728.html