Set Echarts mouse hover style

Source: Internet
Author: User

Add the following code in the ToolTip under option:

(This article is in the background to pass the value is also one of the viewstate[])

 ToolTip: {show:true, Trigger: ' axis ',//show:true                        ,//default true showdelay:0,//display delay, add display delay to avoid frequent switching hidedelay:50,//hidden delay transitionduration:0,//Animation transform duration backgroundcolor: ' Rgba (0,0,0,0.7) ',//Background color (this is the default                        color) borderradius:8,//Border fillet padding:10,//[5, 10, 15, 20] inner margin Position:function (p) {//Position callback//Console.log &AMP;&A mp                            Console.log (P);                        return [p[0] + ten, p[1]-10];                            }, Formatter:function (params, ticket, callback) {Console.log (params)                            var res = "Class" + ': ' + params[0].name + "class <br/>";    for (var i = 0, L = params.length; i < L; i++) {                            Res + = ' <br/> ' + params[i].seriesname + ': ' + params[i].value + ' <%=viewstate[' unit                                "]%>";//the string contents of the mouse hover display} setTimeout (function () {                            Only to simulate asynchronous callback callback (ticket, RES);                        }, (+) return ' loading ... ';                    }//formatter: "Template Formatter: <br/>{b}<br/>{a}:{c}<br/>{a1}:{c1}" },


Hope to help small friends! 0.0

PS: To display a random color for each graph of a column chart:

ItemStyle: {normal: {color:function (value) {return \ "#\" + (\ "00000\" + ((Math.random () *16777215+0.5) >>0). ToString (+)). Slice (-6); }},},

Add the above code within the series.

Set Echarts mouse hover style

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: 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.