Example of echarts-heat Force diagram

Source: Internet
Author: User

1. Load Echarts.js

2. Page JS Code

//get the JSON data you need with Ajax$.get (".. /.. /.. /mall/querypagewtsrpost.do ", {                 ' Sdate ': Sdate,' Edate ': Edate},function(result, resultstate) {if(Resultstate = = "Success") {                    varResultjson =eval (result); if(resultjson!= ""){                         //add a picture that needs to implement a thermal distribution$ (' #graphic '). HTML ("<div id= ' main ' style= ' Width:1130px;height : 2500px; ' ></div> "); varHeatdata=NewArray ();//define array access background data                            //encapsulates the required data x: pixels from the right margin, y: pixels from the top margin, h: Heat                             for(vari = 0;i < resultjson.length; i++) {Heatdata[i]=[resultjson[i].x,resultjson[i].y,resultjson[i].h]; }                                                                                    //Echartsrequire ([' Echarts ',                                ' Echarts/chart/heatmap '//load bar module with bar chart, load on Demand                            ],                            function(EC) {//Initialize the Echarts chart based on the prepared Dom                                varMyChart = Ec.init (document.getElementById (' main '))); varoption ={title: {text:' Heat diagram Custom style '}, Series: [ {type:' Heatmap ', Data:heatdata, hover Able:false, gradientcolors: [{ Offset:0.4, Color:' Green '}, {offset:0.5, Color:' Yellow '}, {offset:0.8, Color:' Orange '}, {offset:1, Color:' Red '}], Minalpha:0.2, ValueScale:2, opacity:0.6                                            }                                        ]                                                        }; //loading data for Echarts objectsmychart.setoption (option);                        }                        ); }                                            }                                    });

3.html Code

<DivID= "Graphic"class= "Col-md-8"style= "width:1130px;margin:0 auto;float:none!important;">            <imgID= "Baidu-img"src= "./10086mall.png">            <DivID= "Main"style= "width:1130px; height:2500px;"></Div>        </Div>

4.

 

5. Finally, please explain

Note: These points in the figure are manually adjusted to the corresponding position, that is, the value of x, y in Heatdata to determine the location of the

Example of echarts-heat Force diagram

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.