本文介绍了需要dojo散点或气泡图的例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难理解如何处理dojo中的散点图和气泡图。有谁有一个例子或好的文档,我可以看看帮助我吗?

解决方案

不像任何其他图表,每点需要两个输入的区域x和y)



气泡图每点需要三个输入(x,y和气泡的大小) strong>



气泡图示例:

  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 d1.push({x:i,y:parseInt(Math.random()* 30),size: parseInt(Math.random()* 10)});
//或者你可以把size:1简化为
}
var chart = new Chart(container);
chart.addPlot(default,{
type:bubble
});
chart.addAxis(x);
chart.addAxis(y,{vertical:true,fixLower:major,fixUpper:major});

//添加一系列数据
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 d1.push({x:i,y:parseInt(Math.random ()* 30)});
}
var chart = new Chart(container);
chart.addPlot(default,{
type:Scatter
});
chart.addAxis(x);
chart.addA xis(y,{vertical:true,fixLower:major,fixUpper:major});

//添加一系列数据
chart.addSeries(Demo,d1);
chart.render();
});

希望这有帮助... ..


I'm having a bit of trouble understanding how to tackle the scatter and bubble chart in dojo. Does anyone have an example or good documentation I can look at to help me out?

解决方案

unlike any other chart (line,bar,area which takes two inputs per point , x and y)

bubble chart takes three inputs per point ( x, y , and size of bubble)

Bubble Chart Example:

            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();
            });

Scattered charts are similar to any other point chart except the x axis values can be in float (or double) type.

Scattered Chart Example :

            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();
            });

Hope this helps ... ..

这篇关于需要dojo散点或气泡图的例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 09:08