echarts icon indicating copy to clipboard operation
echarts copied to clipboard

请求帮助 十分感谢. 堆叠图与折线图关联对应中心位置

Open wangyahua opened this issue 9 years ago • 2 comments

One-line summary [问题简述]

堆叠柱形图与折线图每个对应起来

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:3.0
  • Browser version [浏览器类型和版本]:chrome最新办
  • OS Version [操作系统类型和版本]:windows

Expected behaviour [期望结果]

期望就是让每个折线图对应到柱状图中心点位置

ECharts option [ECharts配置项]

option = {
        tooltip : {
                show:false,
                trigger: 'axis',
                axisPointer : {            // 坐标轴指示器,坐标轴触发有效
                    type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
                }
            },
            legend: {
                data:['WIFI','内置应用','系统设置','建议与咨询','用户反馈率']
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    data : ['最新版本-2','最新版本-1','最新版本']
                }
            ],
            yAxis : [
                {
                    type : 'value',
                    axisLabel: {
                        formatter: '{value}%'
                    }
                },
            ],
            series : [
                {
                    name:'WIFI',
                    type:'bar',
                    stack: 'one',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    barWidth:80,
                    data:[100, 90, 70]
                },
                {
                    name:'内置应用',
                    type:'bar',
                    stack: 'one',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    data:[80, 70, 50]
                },
                {
                    name:'系统设置',
                    type:'bar',
                    stack: 'one',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    barWidth:80,
                    data:[70, 50, 30]
                },
                {
                    name:'建议与咨询',
                    type:'bar',
                    stack: 'one',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    barWidth:80,
                    data:[50, 40, 20]
                },
                {
                    name:'WIFI',
                    type:'bar',
                    stack: 'two',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    barWidth:80,
                    data:[90, 80, 60]
                },
                {
                    name:'内置应用',
                    type:'bar',
                    stack: 'two',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    barWidth:80,
                    data:[70, 60, 40]
                },
                {
                    name:'系统设置',
                    type:'bar',
                    stack: 'two',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    barWidth:80,
                    data:[50, 40, 30]
                },
                {
                    name:'建议与咨询',
                    type:'bar',
                    stack: 'two',
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                position: 'inside',
                                formatter:function(params){
                                    return params.seriesName+'\n'+params.value+"%";
                                }
                            }
                        }
                    },
                    barWidth:80,
                    data:[40, 30, 20]
                },
                {
                    name:'用户反馈率',
                    type:'line',
                    lineStyle: {
                        normal: {
                            type:'dashed'
                        }
                    },
                    data:[300, 250, 170],
                },
                {
                    name:'用户反馈率',
                    type:'line',
                    lineStyle: {
                        normal: {
                            type:'dashed'
                        }
                    },
                    data:[250, 210, 150]
                }
            ]
}

Other comments [其他信息]

目前实现的: image 想要实现的: 4 k2 iesqma2h1c 1bwdj 2

wangyahua avatar Jul 21 '17 03:07 wangyahua

这个目前不能直接用 line series 支持,只能使用 custom series 做。

可参见这个示例: http://gallery.echartsjs.com/editor.html?c=xr1AvE2JIb&v=1

100pah avatar Jul 21 '17 17:07 100pah

搜索到这个问题了,提供另一种实现 http://gallery.echartsjs.com/editor.html?c=xBkAWPljpz&v=1

luguokong avatar May 05 '18 09:05 luguokong