加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

dojo+线性图

发布时间:2020-12-16 22:05:02 所属栏目:百科 来源:网络整理
导读: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.Toolti

1.js脚本:

 
 
  1. 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");
  2. makeCharts=function(){
  3. varchart1=newdojox.charting.Chart2D("simplechart");
  4. /*type:
  5. *Lines,Markers,Areas,MarkersOnly
  6. */
  7. //chart1.addPlot("default",{type:"Lines"});
  8. //chart1.addPlot("default",{type:"StackedAreas",lines:true,areas:true,markers:false});
  9. chart1.addPlot("default",{type:"Lines",markers:true,tension:"X",shadows:{dx:2,dy:2}});
  10. chart1.addPlot("other",{type:"Areas"});
  11. chart1.addPlot("Grid",{type:"Grid",
  12. hAxis:"otherx",
  13. vAxis:"othery",
  14. hMajorLines:true,
  15. hMinorLines:false,
  16. vMajorLines:true,
  17. vMinorLines:false
  18. });
  19. //chart1.addAxis("x");
  20. chart1.addAxis("x",{
  21. labels:[
  22. {value:1,text:"Jan"},{value:2,text:"Feb"},
  23. {value:3,text:"Mar"},{value:4,text:"Apr"},
  24. {value:5,text:"May"},{value:6,text:"Jun"},
  25. {value:7,text:"Jul"},{value:8,text:"Aug"},
  26. {value:9,text:"Sep"},{value:10,text:"Oct"},
  27. {value:11,text:"Nov"},{value:12,text:"Dec"}
  28. ]
  29. });
  30. chart1.addAxis("y",{vertical:true});
  31. chart1.addSeries("Series1",[0,1.5,2,3,4,5,7]);
  32. chart1.addSeries("Series2",[4,1,6,3],{plot:"other",stroke:{color:"green"},fill:"lightblue"});
  33. chart1.addSeries("SeriesA",[{x:1,y:5},{x:1.5,y:1.7},{x:2,y:9},{x:5,y:3}],{stroke:{color:"red"}});
  34. chart1.render();
  35. };
  36. dojo.addOnLoad(makeCharts);

2.HTML代码:

 
 
  1. <divid="simplechart"style="width:600px;height:400px;"></div>

3.页面展示效果:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读