關於Echart動態加載legend和series


1.legend動態加載

動態加載時不能直接對legend賦值。需定義變量構建對象,然后在賦值給option.legend = legend;

legend = {
                    orient: 'vertical',
                    x: 'left',
                    textStyle: {
                        color: "#fff"
                    },
                    data: ['最高價(' + 10000 + ')', '最低價(' + 1000 + ')']
                };

 

2.series動態加載其中的某個對象

series = [{
                    name: '最高價(' + 10000+ ')', type: 'pie', value: b,
                    itemStyle: {
                        normal: {
                            color: "#da2b80"
                        },
                        emphasis: {
                            color: "#da2b80"
                        }
                    }
                }, {
                    name: '最低價(' + 1000+ ')', type: 'pie', value: c,
                    itemStyle: {
                        normal: {
                            color: "#ffa600"
                        },
                        emphasis: {
                            color: "#ffa600"
                        }
                    }
                }];
                option.series[0]['data'] = series;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM