如图所示,y轴刻度的值跟实际值不对应:

image.png

方法一

series中的stack属性删除

series: [
                            {
                                name: 'Email',
                                type: 'line',
                                // stack: 'Total',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [120, 132, 101, 134, 90, 230, 210]
                            },
                            {
                                name: 'Union Ads',
                                type: 'line',
                                // stack: 'Total',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [220, 182, 191, 234, 290, 330, 310]
                            },
                            {
                                name: 'Video Ads',
                                type: 'line',
                                // stack: 'Total',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [150, 232, 201, 154, 190, 330, 410]
                            },
                            {
                                name: 'Direct',
                                type: 'line',
                                // stack: 'Total',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [320, 332, 301, 334, 390, 330, 320]
                            },
                            {
                                name: 'Search Engine',
                                type: 'line',
                                // stack: 'Total',
                                label: {
                                    show: true,
                                    position: 'top'
                                },
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [820, 932, 901, 934, 1290, 1330, 1320]
                            }
                        ]

方法二

series中的stack属性名称改为不一致

series: [
                            {
                                name: 'Email',
                                type: 'line',
                                stack: 'Total1',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [120, 132, 101, 134, 90, 230, 210]
                            },
                            {
                                name: 'Union Ads',
                                type: 'line',
                                stack: 'Total2',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [220, 182, 191, 234, 290, 330, 310]
                            },
                            {
                                name: 'Video Ads',
                                type: 'line',
                                stack: 'Total3',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [150, 232, 201, 154, 190, 330, 410]
                            },
                            {
                                name: 'Direct',
                                type: 'line',
                                stack: 'Total4',
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [320, 332, 301, 334, 390, 330, 320]
                            },
                            {
                                name: 'Search Engine',
                                type: 'line',
                                stack: 'Total5',
                                label: {
                                    show: true,
                                    position: 'top'
                                },
                                areaStyle: {},
                                emphasis: {
                                    focus: 'series'
                                },
                                data: [820, 932, 901, 934, 1290, 1330, 1320]
                            }
                        ]

效果

image.png

最后修改:2024 年 12 月 09 日
如果觉得我的文章对你有用,请随意赞赏