关于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