Echarts Problem description:
The problem is that the points on the line chart are displayed. Someone asked if they can not be displayed at the beginning. When you click or move the mouse over it, the points on the line chart are displayed?
As shown in:
Analysis: if the point on the line is not displayed, the symbol attribute can be set to "NONE ". Considering that the point on the line is displayed when you click, you can re-load the option event in the on event. When you click a key point in a broken line, you can reload the symbol attribute in the data, set it to the desired shape, and be sure to reload the setoption event.
{Self} on |
{String} eventname, {Function} eventlistener |
Event binding. The event name is uniformly mounted to require ('echarts/config '). event (not modularized to echarts. config. in the namespace, we recommend that you use this namespace as the event name reference. Currently, the following events are supported: Refresh, restore, resize, click, hover ), Data_changed (data modification), data_view_changed (data view modification ), Magic_type_changed (dynamic type switching), timeline_changed (timeline change ), Data_zoom (data area scaling), data_range (value range roaming), map_roam (MAP roaming ), Legend_selected (legend selection), map_selected (MAP selection), and pie_selected (pie chart selection) |
The Code is as follows:
Option = {tooltip: {trigger: 'item'}, Legend: {data: ['highest ', 'lowest']}, toolbox: {Show: True, feature: {MARK: {Show: true}, dataview: {readonly: false}, magictype: {Show: True, type: ['line', 'bar', 'stack ', 'tid']}, restore: {Show: true}, saveasimage: {Show: True }}, calculable: True, datazoom: {Show: True, realtime: True, start: 40, end: 60}, xaxis: [{type: 'category ', boundarygap: True, data: function () {var list = []; for (VAR I = 1; I <= 30; I ++) {list. push ('2017-03-'+ I);} return list;} ()}], yaxis: [{type: 'value'}], Series: [{Name: 'highest ', type: 'line', data: function () {var list = []; for (VAR I = 1; I <= 30; I ++) {list. push ({value: math. round (math. random () * 30) + 30, Symbol: 'none'});} return list;} ()}, {Name: 'minimal', type: 'bar ', data: function () {var list = []; for (VAR I = 1; I <= 30; I ++) {list. push (math. round (math. random () * 10);} return list;} ()}]}; var ecconfig = require ('echarts/config'); MyChart. on (ecconfig. event. click, function (Params) {Option. series [Params. seriesindex]. data [Params. dataindex]. symbol = 'star' MyChart. setoption (option );});
Final implementation result:
The above code is the code in option. For details, refer:
Http://echarts.baidu.com/doc/example/event.html #
Csdn open-source summer camp Baidu data visualization practices echarts (8) Problem Analysis