我从数据库中提取信息并将其放入dojo图表中。我正在试图弄清楚如何使用此图表的工作方式返回“无数据消息”:
var chart1 = new dojox.charting.Chart2D("traffic");
chart1.addPlot("default", {type: "Columns", gap: "15"});
chart1.addAxis("x", {minorTicks: false, font: "normal normal bold 9pt Arial",
labels: [{value: 1, text: 'Monday'},{value: 2, text: 'Tuesday'},{value: 3, text: 'Wednesday'},{value: 4, text: 'Thursday'},{value: 5, text: 'Friday'},{value: 6, text: 'Saturday'},{value: 7, text: 'Sunday'}]});
chart1.addAxis("y", {vertical: true, minorTicks: false, min: 0, font: "normal normal bold 12pt Arial"});
chart1.addSeries("Series 1", [<?php echo $trafficseries; ?>]);
chart1.setTheme(dojox.charting.themes.PlotKit.blue);
chart1.addPlot("Grid", {
type: "Grid",
hAxis: "x",
vAxis: "y",
hMajorLines: true,
hMinorLines: false,
vMajorLines: false,
vMinorLines: false
});
var anim_t = new dojox.charting.action2d.Tooltip(chart1, "default");
chart1.render();
如果数据为空,我会在哪里添加某种错误处理?
答案 0 :(得分:1)
检查您的数据是否没有积分,并在带有“无数据”消息的图表上覆盖<div>
。否则隐藏它。