CSDN open source summer camp Baidu data visualization practices ECharts (8) problem analysis, csdnecharts

Source: Internet
Author: User

CSDN open source summer camp Baidu data visualization practices ECharts (8) problem analysis, csdnecharts
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 #





How can I participate in ACM Programming Competition and CSDN open-source summer camp?

Three college students ?? As far as I know, it seems that two books have scored more than 400 points and nearly 500 points. If you have these three books, don't go to any competition. Just get a job with a diploma!


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.