0
如何使用Dojo繪製條形圖?我有一個數據庫有2欄empid
和empsalary
。我想在dojo中繪製條形圖,empid
爲x軸,empsalary
爲y軸。請建議。使用Dojo繪製條形圖
在此先感謝
拉胡爾·庫馬爾
如何使用Dojo繪製條形圖?我有一個數據庫有2欄empid
和empsalary
。我想在dojo中繪製條形圖,empid
爲x軸,empsalary
爲y軸。請建議。使用Dojo繪製條形圖
在此先感謝
拉胡爾·庫馬爾
下面是一個腳本來繪製使用Dojo圖表的條形圖:
<script>
require([
// Require the basic chart class
"dojox/charting/Chart",
// Require the theme of our choosing
"dojox/charting/themes/MiamiNice",
// Charting plugins:
// We want to plot Columns
"dojox/charting/plot2d/Columns",
// We want to use Markers
"dojox/charting/plot2d/Markers",
// We'll use default x/y axes
"dojox/charting/axis2d/Default",
// Wait until the DOM is ready
"dojo/domReady!"
], function(Chart, theme) {
// Define the data
var chartData = [10000,9200,11811,12000,7662,13887,14200,12222,12000,10009,11288,12099];
// Create the chart within it's "holding" node
var chart = new Chart("chartNode");
// Set the theme
chart.setTheme(theme);
// Add the only/default plot
chart.addPlot("default", {
type: "Columns",
markers: true,
gap: 5
});
// Add axes
chart.addAxis("x");
chart.addAxis("y", { vertical: true, fixLower: "major", fixUpper: "major" });
// Add the series of data
chart.addSeries("Monthly Sales",chartData);
// Render the chart!
chart.render();
});
</script>
<div id="chartNode" style="width:800px;height:400px;"></div>
請找到詳細的解釋here in Dojo tutorials