Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wangyahua opened this issue Jul 21, 2017 · 2 comments
Closed

Comments

@wangyahua
Copy link

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

@100pah
Copy link
Member

100pah commented Jul 21, 2017

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

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

@pissang pissang closed this as completed Jul 26, 2017
@luguokong
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants