开发者

I want to use my own theme for Dojo charts. how to connect it?

the current theme is connected with 开发者_JAVA技巧

dojo.require("dojox.charting.themes.PlotKit.green");

I created my theme, saved it in the same folder and tried to add to page:

dojo.require("mytheme");

But it's not connecting this way.


If you created your own module, the easiest thing to do is to place it in the folder, which is a peer of dojo:

dojo/...
dijit/...
dojox/...
my/... <- your file goes there

For example, it is called "mytheme". In this case it should go into my/mytheme.js file. In order to use it just require it and set on your chart:

dojo.require("my.mytheme");
...
chart.setTheme(my.mytheme);

Don't forget to put dojo.provide("my.mytheme"); at the top of your theme file, and define my.mytheme object (your theme).

Alternatively include it inline like I did in http://lazutkin.com/download/hicharts.html (look for myTheme). Or you can include the snippet using a regular <script> tag.

Do not forget to set your new theme explicitly on a chart: chart.setTheme(your_theme_object).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜