Vue uses Echarts to achieve click highlight. vueecharts

Source: Internet
Author: User

Vue uses Echarts to achieve click highlight. vueecharts

This article describes how to use Echarts in vue to achieve click highlight.

1. First, let's take a look at the introduction on the official website:

Http://echarts.baidu.com/api.html#action.graph.focusNodeAdjacency

2. bind these two events during initialization. Events to be bound are mouse click events and right-click events.

Mounted: function () {let that = this; let myChart = this. $ echarts. init (document. getElementById ('mychart'); myChart. on ('click', function (params) {console. log (params); // click to highlight that. myChart. dispatchAction ({type: 'focusnodeadjacency ', // use dataIndex to locate a node. DataIndex: params. dataIndex}); if (params. dataType = 'edge ') {that. handleClick (params);} else if (params. dataType = 'node') {if (that. firstNode = '') {that. firstNode = params. name;} else {that. secondNode = params. name ;}}); // deselect the context menu document. oncontextmenu = function () {return false ;}; // right-click to cancel highlighting myChart. on ('textmenu ', function (params) {console. log (params); that. myChart. dispatchAction ({type: 'unfocusnodeadjacency ', // use seriesId, seriesIndex, or seriesName to locate the series. seriesIndex: params. seriesIndex,}); that. myChart = myChart; that. drawLine ();},

The running effect is as follows:

The above example of using vue in combination with Echarts to achieve click highlight effect is all the content shared by xiaobian. I hope to give you a reference, and I hope you can provide more support for the customer's house.

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.