本文介绍了Dojox绘图程序使用商店系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用编程方法使dojo图表工作。我尝试过以下操作,但图形没有显示,

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

});

推荐答案

而不是使用dojox.charting.StoreSeries,我使用的是dojox.charting.DataSeries,同时使用相同的代码,它的工作原理

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

addSeries (我的月,新的dojox.charting。 DataSeries (mystore,{query:{}},MyMonth))。

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

这是它。

这篇关于Dojox绘图程序使用商店系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 09:29