有气泡图可用于海军报here 请注意,您如果您不希望它们覆盖图表,则需要自行调整气泡大小。文档是here。
要使用它,添加以下的HTML页面的beggining:
,并从JSON结果调用或该样本中的任何数据对象,如:
$.getJSON('myQuery.py?'+params, function(oJson) {
// ... Some validation here to see if the query worked well ...
$.plot('#myContainer',
// ---------- Series ----------
[{
label: 'Line Sample',
data: oJson.lineData,
color: 'rgba(192, 16, 16, .2)',
lines: { show: true },
points: { show: false }
},{
label: 'Bubble Sample',
data: oJson.bubbleData, // arrays of [x,y,size]
color: 'rgba(80, 224, 80, .5)',
lines: { show: false },
points: { show: false },
},{
label: 'Points sample',
data: oJson.pointsData,
color: 'rgba(255, 255, 0, 1)',
lines: { show: false },
points: { show: true, fillColor: 'rgba(255, 255, 0, .8)' }
},{
...other series
}],
// ---------- Options ----------
{ legend: {
show: true,
labelBoxBorderColor: 'rgba(32, 32, 32, .2)',
noColumns: 6,
position: "se",
backgroundColor: 'rgba(224, 224, 224, .2)',
backgroundOpacity: .2,
sorted: false
},
series: {
bubbles: { active: true, show: true, fill: true, linewidth: 2 }
},
grid: { hoverable: true, clickable: true } },
xaxis: { tickLength: 0 }
}); // End of plot call
// ...
}); // End of getJSON call
我试图用jqPlot做同样的事情,它具有一些优点,但不能在同一个图上使用气泡和其他类型的系列。另外,Flot在将许多系列的公共轴标尺同步方面做得更好。 Highchart在这方面做得非常好(混合了其他类型的泡沫图表),但对我们来说却不是免费的(政府环境)。
你可以创建它作为服务器端的图像? – Bemmu 2011-04-05 05:12:56
不是一个坏主意。你能推荐任何图书馆吗? – 2011-04-06 03:14:29