上一篇,選擇echarts原有的主題樣式,那么如何自定義自己的主題
與選擇原有主題類似
1.echarts官網地址http://echarts.baidu.com/echarts2/doc 在工具中
選擇皮膚主題設計工具
在頁面上進行修改
修改完畢,復制代碼。
2.粘貼到自定義的js文件中 例如,myselStyle.js
define(function() {
var theme = {} //注意:本次代碼中只有theme={}的部分,缺少的部分要加上
return theme;
});
3.在js文件中
require.config({
paths:{
echarts:'build/dist'
}
});
require([
'echarts',
'echarts/theme2/myselStyle',
'echarts/chart/line',
'echarts/chart/bar'
],
function(ec,theme){
var myCharts=ec.init(document.getElementById("main"),theme);//注意:theme 為加上文件中 var theme={} 的theme 可自定義 注意一致