Today would like to be able to add their own buttons in the Echarts Toolbox, and then read the Toolbox code, and try it yourself, validation is OK.
1.
A red box button in the picture
2. Code
selfbuttons:{//custom button Danielinbiti, here Add, Selfbuttons can take the name show:true,//whether to display title: ' Custom ',//mouse to move up the text displayed icon: ' test.png ',//icon option:{}, onclick:function (option1) {//click event, here option1 is chart option information Alert (' 1 ');//Here you can add your own processing code, switch different graphics } }
Of course, there are a lot of icons built in, and these icons are all drawn.
Iconlibrary: {mark: _iconmark, Markundo: _iconmarkundo, Markclear: _iconmarkclear, Datazoom: _icondatazoom, Datazoomreset: _icondatazoomreset, restore: _iconrestore, Linechart: _iconlinechart, Barchart: _iconbarchart, Piechart: _iconpiechart, Funnelchart: _iconfunnelchart, Forcechart: _iconforcechart, Chordchart: _iconchordchart, Stackchart: _iconstackchart, Tiledchart: _icontiledchart, DataView: _icondataview, Saveasimage: _icon Save, Cross: _iconcross, Circle: _iconcircle, Rectangle: _iconrectangle, Trian GLE: _icontriangle, Diamond: _icondiamond, Arrow: _iconarrow, star: _iconstar, Heart: _iconheart, droplet: _icondroplet, Pin: _iconpin, Image: _iconimage}
The chart suffix is placed in the Magictype type, while the suffix chart is not used, the program will automatically splicing, such as Linechart, write ' line '
Echarts Add custom buttons in custom toolbox