dojo+线性图

前端之家收集整理的这篇文章主要介绍了dojo+线性图前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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.页面展示效果

猜你在找的Dojo相关文章