Csdn open-source summer camp Baidu data visualization practices echarts (8) Problem Analysis

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.