Dojox 使用商店系列以编程方式绘制图表

发布于 2024-12-06 19:53:06 字数 1201 浏览 0 评论 0原文

我一直在尝试使用编程方法来制作道场图表。我已尝试以下操作,但图表未显示。

//Requirements

dojo.require("dojo.data.ItemFileWriteStore");
dojo.require('dojox.charting.Chart2D');
dojo.require('dojox.charting.widget.Chart2D');
dojo.require('dojox.charting.themes.PlotKit.blue');
dojo.require('dojox.charting.plot2d.Columns');
dojo.require('dojox.charting.StoreSeries');

dojo.ready(function() {


var data = {"identifier":"MyMonth","label":"MyMonth","items":[{"MyAmount":"98498.67","MyMonth":"1"},{"MyAmount":"114384.10","MyMonth":"2"},{"MyAmount":"125307.86","MyMonth":"3"},{"MyAmount":"87534.38","MyMonth":"4"},{"MyAmount":"90376.60","MyMonth":"5"},{"MyAmount":"96233.60","MyMonth":"6"},{"MyAmount":"112824.29","MyMonth":"7"},{"MyAmount":"119593.06","MyMonth":"8"},{"MyAmount":"95691.64","MyMonth":"9"}]};

var mystore= new dojo.data.ItemFileWriteStore({data: data});

var chart1 = new dojox.charting.Chart2D('testChart').
    setTheme(dojox.charting.themes.PlotKit.blue).
    addAxis('x', {min: 0, max: 12}).
    addAxis('y', { vertical: true, min: 1}).
    addPlot('default', {type: 'Columns'}). 
    addSeries("My Month", new dojox.charting.StoreSeries(mystore, {query:{}}, "MyMonth")).
    render();
});

I have been trying to get dojo charting working using the programmatic method. I have tried the following but the graph is not showing.

//Requirements

dojo.require("dojo.data.ItemFileWriteStore");
dojo.require('dojox.charting.Chart2D');
dojo.require('dojox.charting.widget.Chart2D');
dojo.require('dojox.charting.themes.PlotKit.blue');
dojo.require('dojox.charting.plot2d.Columns');
dojo.require('dojox.charting.StoreSeries');

dojo.ready(function() {


var data = {"identifier":"MyMonth","label":"MyMonth","items":[{"MyAmount":"98498.67","MyMonth":"1"},{"MyAmount":"114384.10","MyMonth":"2"},{"MyAmount":"125307.86","MyMonth":"3"},{"MyAmount":"87534.38","MyMonth":"4"},{"MyAmount":"90376.60","MyMonth":"5"},{"MyAmount":"96233.60","MyMonth":"6"},{"MyAmount":"112824.29","MyMonth":"7"},{"MyAmount":"119593.06","MyMonth":"8"},{"MyAmount":"95691.64","MyMonth":"9"}]};

var mystore= new dojo.data.ItemFileWriteStore({data: data});

var chart1 = new dojox.charting.Chart2D('testChart').
    setTheme(dojox.charting.themes.PlotKit.blue).
    addAxis('x', {min: 0, max: 12}).
    addAxis('y', { vertical: true, min: 1}).
    addPlot('default', {type: 'Columns'}). 
    addSeries("My Month", new dojox.charting.StoreSeries(mystore, {query:{}}, "MyMonth")).
    render();
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生生漫 2024-12-13 19:53:06

我没有使用 dojox.charting.StoreSeries,而是使用了 dojox.charting.DataSeries,同时使用相同的代码,它可以工作

addSeries("My Month", new dojox.charting.DataSeries(mystore, {query :{}},“我的月份”))。

就是这样。

Instead of using dojox.charting.StoreSeries, I used the dojox.charting.DataSeries while using the same code and it worked

addSeries("My Month", new dojox.charting.DataSeries(mystore, {query:{}}, "MyMonth")).

Thats it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文