Color change of Echarts x-axis Y-axis

Source: Internet
Author: User
Tags json

When operating echarts, the requirements require that the echarts xy axis be of the same color as the graphic.

Figure 1:

Figure 2:

Solution:

Code Show:

var MyChart1;  
                $ (function () {document.getElementById ("Begin1"). Flatpickr ();  
                document.getElementById ("End1"). Flatpickr ();  
                MyChart1 = Echarts.init (document.getElementById (' Mychart1 '));  
                Mychart1.showloading ({text: "The chart data is trying to load ..."}); Number of bidders for the top ten statistics var options1 = {title: {Tex T: ' Bidder's cumulative number of registrations ', X: ' Center '},//col  
                            Or:colorarr, tooltip: {trigger: ' axis ', Axispointer: {//Axis indicator, axis trigger valid type: ' Shadow '//default is line, Optional: ' Lines ' |  
                          
                        ' Shadow '},  
   Toolbox: {                         Show:true, x: ' 950 ',//download font display not full feat Ure: {//dataview: {show:false, readonly:false}, M  
                                Agictype: {show:true, type: [' line ', ' Bar ']},//restore: {show:true},                   Saveasimage: {show:true}}},//                            Legend: {//x: ' Left ',//data: [' bidding agent name ']//                          }, Grid: {//Left: ' 1% ',// Right: ' 10% ',//Bottom: ' 3% ',//Containlabel:tru  
                            E y2:140}, Xaxis: { Type: ' CatEgory ', Name: ' Bidder ', data: ['], axislabel:{interval:0,//Transverse information display rotate:-30,// -30 degree angle tilt Display}, axisline:{line style:{color: ' #0087ED ', width:1,//here for highlighting plus  
                        }},  
                            YAxis: {type: ' value ', Name: ' Unit: Times ',   
                                    Splitline: {lineStyle: {//using shades of color  
                            Color: [' #0087ED ']}  
                 },           Nametextstyle: {color: [' #0087ED ']}, axisline:{linestyle:{C  
                            Olor: ' #0087ED ', width:1,//here to highlight the addition of} }}, Series: [{Nam  
                            E: ' Bidder name ', type: ' Bar ', stack: ' Number ',  
                                    Label: {normal: {show:true,  
                            Position: ' Top '}, Data: ['], color:[' #0087ED '], item  
             Style: {                   Normal: {barborderradius:5,}  
                    }, Barwidth:30,}]  
                };  
                Mychart1.setoption (OPTIONS1);  
            GetChartData1 ();  
  
            }); function GetChartData1 () {//Get the Options object of the chart var newOption1 = Mych  
                Art1.getoption ();  
                The parameter var StartDate = $ ("#begin1"). Val ();  
                var endDate = $ ("#end1"). Val ();  
                var type = $ ("#jylx-type1"). Val ();  
                if (Type==null | | type== "" | | type== "undefine") {type = "${type}";  
                } var Centercode = $ ("#jyzx-all1"). Val (); Number of bidders to register the top ten statistics $.ajax ({type: "POST", async: false,//synchronous execution URL: "Bidder!bmcsbar.do", data: {  
                        Startdate:startdate, Enddate:enddate, Type:type,    
                    Centercode:centercode}, DataType: "JSON",//return data in the form of JSON Success:function (data) {if (data) {NewOption1  
                            . Xaxis[0].data = Data.category;  
                            Newoption1.series[0].data = data.series;  
                            Mychart1.hideloading ();  
                        Mychart1.setoption (NewOption1); }}, Error:function (errormsg) {alert ("Chart request data failed!")  
                        );  
                    Mychart1.hideloading ();  
            }  
                });  
 }//Load column chart based on query criteria           function ShowChart1 () {getChartData1 ();   } </script>



Reprint Address: http://blog.csdn.net/wu920604/article/details/53422960

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.