我刚刚创建了一个简单的Chart2d,这个图表一切正常(数据系列只显示正常,主题还可以等等),所以我继续前进并尝试添加Tooltip和Legend功能这张图表。所以我想出了下面的代码:
require([
"dojox/charting/Chart",
"dojox/charting/action2d/Tooltip",
"dojox/charting/themes/Tom",
"dojox/charting/widget/SelectableLegend",
"dojox/charting/plot2d/Lines",
"dojox/charting/plot2d/Markers",
"dojox/charting/axis2d/Default",
"dojo/store/JsonRest",
"dojo/store/Memory",
"dojo/store/Cache",
"dojox/charting/StoreSeries",
"dojo/domReady!"
], function(Chart, Tooltip, Tom, SelectableLegend, LinesPlot, JsonRest, StoreSeries){
// ... the data store is initialed here ..
chart.setTheme(Tom);
chart.addPlot("default", {
type: LinesPlot,
markers: true
});
.
.
.
chart.render();
var tip = new Tooltip(chart, "default");
var leg = new dojox.charting.widget.SelectableLegend({ chart: chart, horizontal: true }, "legend1");
});
现在,问题是我可以看到此图表的图例/工具提示,但似乎图表主题不适用于它们。
答案 0 :(得分:0)
我的不好..我只是忘了将主要的dojo样式表(+可选的主题)添加到我的html文档中:
<style type="text/css">
@import "./res/dojo__1_10_4/dojo/resources/dojo.css";
@import "./res/dojo__1_10_4/dijit/themes/tundra/tundra.css";
</style>
<style>