Using Echart to realize the progress monitoring of each link

Source: Internet
Author: User

Ideas:

The Echart Waterfall chart is used to achieve the comparison between planned and actual progress, showing differences and durations. The Gantt chart uses the Echart layout because the timeline is poorly tuned and not good-looking.

The company just wants to focus on the main link, hoping one screen can see the information I want, so I think of fixing the time in 6-8 sections (because the project will be postponed). However, the timeline can be dynamically generated.

The following code can be run directly in the official editor of Echart. The assignment interface has been set up, and presumably the person who used it should know how to assign the value. The code is as follows:

option = {title: {text: ' XX contract Project schedule ', Subtext: ' From Excelhome ',}, tooltip: {trig  GER: ' Axis ', Axispointer: {//Axis indicator, axis trigger valid type: ' Shadow '//default line, Optional: ' Lines ' | ' Shadow '}, Formatter:function (params) {var data1={' link One ': ' 2017-11-01 ', ' link two ': ' 2017-11-03 ', '
            Link three ': ' 2017-11-05 ', ' link Four ': ' 2017-11-13 '};
            var data2={' link One ': ' 2017-11-01 ', ' link two ': ' 2017-11-10 ', ' link three ': ' 2017-11-12 ', ' link Four ': ' 2017-11-13 '};
            var data3={' link One ': ' 2017-11-01 ', ' link two ': ' 2017-11-03 ', ' link three ': ' 2017-11-05 ', ' link Four ': ' 2017-11-14 '};
            var data4={' link One ': ' 2017-11-01 ', ' link two ': ' 2017-11-11 ', ' link three ': ' 2017-11-13 ', ' link Four ': ' 2017-11-14 '};
            var tar = params[1];
            var tar2 = params[3];
            var plantext= "plan time:" + data1[tar.name]+ "~" +data2[tar.name];
            var actualtext= "actual time:" + data3[tar.name]+ "~" +data4[tar.name]; return tar.name + ' <br/> ' + plantext+ ' <br/> ' +actualtext+ ' <br/> ' + tar.seriesname + ': ' + tar.value+ ' <br/> ' + tar2.seriesname + ': ' + tar2.value;
    Grid: {left: ' 3% ', right: ' 4% ', bottom: ' 3% ', containlabel:true}, YAxis: {type: ' Category ', Splitline: {show:false}, data: [' Link one ', ' link two ', ' link three ', ' link four ', ' link five ', ' link Six ', ' Link Six ']}, Xaxis: {type: ' Value ', Axislabel: {textStyle: {//The remaining properties default to use full
                    Bureau text style, see TextStyle color: ' White ', fontsize:18,}, Formatter:function (value,i) {var data=[' 2017-11-01 ', ' 2017-11-11 ', ' 2017-11-21 ', ' 2
                        017-12-01 ', ' 2017-12-11 ', ' 2017-12-21 ', ' 2017-12-31 ', ' 2018-01-10 ', ' 2017-01-20 '];
                         return value;
                    return data[i]; }}, Series: [{name: ' auxiliary ', TypE: ' Bar ', stack: ' Plan ', ItemStyle: {normal: {barbordercolor:
                    ' Rgba (0,0,0,0) ', Color: ' Rgba (0,0,0,0) '}, emphasis: {
            Barbordercolor: ' Rgba (0,0,0,0) ', Color: ' Rgba (0,0,0,0) '}},
            Data: [0, 3, 5, A, a, {]}, {name: ' Scheduled duration ', type: ' Bar ', Stack: ' Schedule ', Label: {normal: {show:true, Position: ' Inside '}, data:[1,7, 7,1,30, 30,37]}, {name: ' auxiliary '
                    , type: ' Bar ', stack: ' Actual ', ItemStyle: {normal: {  Barbordercolor: ' Rgba (0,0,0,0) ', Color: ' Rgba (0,0,0,0) '}, emphasis: {bArbordercolor: ' Rgba (0,0,0,0) ', Color: ' Rgba (0,0,0,0) '}}, Da TA: [0, 3, 5, G, G,]}, {name: ' Actual Duration ', type: ' Bar ', stack: ' Actual ', Label: {normal: {show:true, Position: ' Inside
 '}}, Data:[1, 9, 8,1,40, 30,36]}};
The implementation effect is as follows:


You can say a little more about the timeline: The following assignment is in the code:

var data=[' 2017-11-01 ', ' 2017-11-11 ', ' 2017-11-21 ', ' 2017-12-01 ', ' 2017-12-11 ', ' 2017-12-21 ', ' 2017-12-31 ', ' 2018-01-10 ', ' 2017-01-20 '];
This code can be dynamically assigned in the background, based on the duration of the start and End time section set, and then put it here. You can achieve different results for each project progress timeline.

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.