dojox 图表堆叠列中的渲染不正确?

发布于 2024-08-25 21:33:53 字数 1010 浏览 3 评论 0原文

我的 dojo stackedcolumn 似乎有问题,其中某些条形的比例对于某些 x 轴点是正确的,但对于其他点则不然。这是我的代码(观察北爱尔兰水电应该是 70,但只显示为 30 左右):

dojo.addOnLoad(function() {
  var chart1 = new dojox.charting.Chart2D("sitesbycountry");
  chart1.addPlot("default", {type: "StackedColumns", gap: 10});
  chart1.addPlot("horzgrid", {type: "Grid", hMajorLines: true, vMajorLines: false});
  chart1.addAxis("x", {labels: [{value: 1, text: 'Northern Ireland'}, {value: 2, text: 'Wales'}, {value: 3, text: 'Scotland'}, {value: 4, text: 'England'}], minorTicks: false, microTicks: false});
  chart1.addAxis("y", {vertical: true, minorTicks: false, microTicks: false});
  chart1.addSeries("Hydro", [70, 53, 198, 102], {fill: "#ddddff"});
  chart1.addSeries("Wind and Wave", [67, 51, 150, 245], {fill: "#FEFFBF"});
  chart1.addSeries("Landfill", [1, 23, 40, 0], {fill: "#CFFFD1"});
  chart1.addSeries("Other Biofuels and Wastes", [4, 3, 11, 66], {fill: "#DFD2C3"});  
  chart1.render();
}); 

这是我不知道的图表行为吗?

蒂亚·

福基乔

I seem to be having a problem with my dojo stackedcolumn whereby the scale of some of the bars is correct for some x-axis points, but not others. Here's my code (observe the northern ireland hydro should be 70, but only shows as around 30):

dojo.addOnLoad(function() {
  var chart1 = new dojox.charting.Chart2D("sitesbycountry");
  chart1.addPlot("default", {type: "StackedColumns", gap: 10});
  chart1.addPlot("horzgrid", {type: "Grid", hMajorLines: true, vMajorLines: false});
  chart1.addAxis("x", {labels: [{value: 1, text: 'Northern Ireland'}, {value: 2, text: 'Wales'}, {value: 3, text: 'Scotland'}, {value: 4, text: 'England'}], minorTicks: false, microTicks: false});
  chart1.addAxis("y", {vertical: true, minorTicks: false, microTicks: false});
  chart1.addSeries("Hydro", [70, 53, 198, 102], {fill: "#ddddff"});
  chart1.addSeries("Wind and Wave", [67, 51, 150, 245], {fill: "#FEFFBF"});
  chart1.addSeries("Landfill", [1, 23, 40, 0], {fill: "#CFFFD1"});
  chart1.addSeries("Other Biofuels and Wastes", [4, 3, 11, 66], {fill: "#DFD2C3"});  
  chart1.render();
}); 

Is this a behaviour of the chart that I'm not aware of?

TIA

FokeyJoe

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

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

发布评论

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

评论(1

绳情 2024-09-01 21:33:53

抱歉..没有发现 y 轴不是从 0 开始。确切的修复方法是:

chart1.addAxis("y", {min:0, vertical: true, minorTicks: false, microTicks: false});

Sorry.. hadn't spotted that the y-axis wasn't starting from 0. Fix exactly is:

chart1.addAxis("y", {min:0, vertical: true, minorTicks: false, microTicks: false});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文