1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| require(["dojox/charting/Chart",
"dojox/charting/themes/Midwest",
"dojox/charting/plot2d/Bubble",
"dojox/charting/plot2d/Markers",
"dojox/charting/axis2d/Default",
"dojo/store/Observable",
"dojo/store/Memory",
"dojox/charting/StoreSeries",
"dojo/domReady!"
], function (Chart, theme, ObservableStore, MemoryStore, StoreSeries) {
var data = [
// This information, presumably, would come from a database or web service
// Note that the values for site are either 1 or 2
{ x: 0, y: 5, size: 0.1 },
{ x: 1, y: 7, size: 0.1 },
{ x: 5, y: 9, size: 0.1 },
{ x: 6, y: 1, size: 0.1 },
{ x: 5, y: 3, size: 0.1 },
{ x: 5, y: 5, size: 0.1 },
{ x: 5, y: 9, size: 0.1 },
{ x: 2, y: 6, size: 0.1 },
{ x: 5, y: 7, size: 0.1 },
{ x: 4, y: 4, size: 0.1 },
{ x: 9, y: 2, size: 0.1 },
{ x: 7, y: 5, size: 0.1 }
];
// Create the data store
// Store information in a data store on the client side
var store = new ObservableStore(new MemoryStore({
data: {
identifier: "id",
label: "Users Online",
items: data
}
}));
// console.log(store)
var graphBubble = new Chart("bubbles").
addAxis("x", { min: 0, max: 6, fixLower: "minor", fixUpper: "minor", natural: true }).
addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major", includeZero: true }).
addPlot("default", { type: "Bubble" }).
addSeries("y", new StoreSeries(store, { query: {} }, "id"));
graphBubble.render();
}); |
Partager