我在理解如何处理 dojo 中的散点图和气泡图时遇到了一些麻烦。有没有人有我可以查看的示例或好的文档来帮助我?
问问题
1165 次
1 回答
2
与任何其他图表不同(线、条、区域,每个点需要两个输入,x 和 y)
气泡图每点需要三个输入(x、y 和气泡大小)
气泡图示例:
require([
"dojox/charting/Chart",
"dojox/charting/themes/MiamiNice",
"dojox/charting/plot2d/Bubble",
"dojox/charting/plot2d/Markers",
"dojox/charting/axis2d/Default",
"dojo/domReady!"
],function(Chart,theme){
var d1 = [];
for (var i = 0; i <= 10; i += 1){
d1.push({x: i, y: parseInt(Math.random() * 30), size: parseInt(Math.random() * 10)});
// or you can put "size:1" for simplicity
}
var chart = new Chart("container");
chart.addPlot("default", {
type:"Bubble"
});
chart.addAxis("x");
chart.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major"});
// Add the series of data
chart.addSeries("Demo", d1);
chart.render();
});
散点图类似于任何其他点图,除了 x 轴值可以是浮点(或双精度)类型。
散点图示例:
require([
"dojox/charting/Chart",
"dojox/charting/themes/MiamiNice",
"dojox/charting/plot2d/Scatter",
"dojox/charting/plot2d/Markers",
"dojox/charting/axis2d/Default",
"dojo/domReady!"
],function(Chart,theme){
var d1 = [];
for (var i = 0; i <= 4; i += 0.1){
d1.push({x: i, y: parseInt(Math.random() * 30)});
}
var chart = new Chart("container");
chart.addPlot("default", {
type:"Scatter"
});
chart.addAxis("x");
chart.addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major"});
// Add the series of data
chart.addSeries("Demo", d1);
chart.render();
});
希望这可以帮助 ... ..
于 2013-05-27T09:45:36.877 回答