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

面积图中负值向上长 #6707

Closed
web3fans opened this issue Sep 18, 2017 · 1 comment
Closed

面积图中负值向上长 #6707

web3fans opened this issue Sep 18, 2017 · 1 comment
Labels

Comments

@web3fans
Copy link

One-line summary [问题简述]

多个类别公用一段代码,负值面积向下增长(错误)。
http://gallery.echartsjs.com/editor.html?c=xH1oFV2n9W&v=1

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:3.6.0
  • Browser version [浏览器类型和版本]: chrome49
  • OS Version [操作系统类型和版本]:win7

Expected behaviour [期望结果]

负值面积向下生长

ECharts option [ECharts配置项]

option = {
                legend: {
                    data: ['沪伦比值(左)', '进口盈亏(右)']
                },
                tooltip: {
                    trigger: 'axis',
                    position: function (pt) {
                        return [pt[0], '10%'];
                    },
                    confine: true
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                credits: {
                    enable: false
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: xdata.map(function (str) {
                        return str.replace(' ', '\n')
                    }),
                    axisLabel: {
                    	formatter: function (value, index) {
                    	    // 格式化成月/日,只在第一个刻度显示年份
                    	    var date = new Date(value);
                    	    var texts = [(date.getMonth() + 1), date.getDate()];
                    	    if (index === 0) {
                    	        texts.unshift(date.getFullYear());
                    	    }
                    	    return texts.join('/');
                    	}
                    }
                },
                yAxis:
                    [
                        {
                            type: 'value',
                            scale: true,
                            position: 'left'
                        },
                        {
                            type: 'value',
                            scale: true,
                            position: 'right'
                        }
                    ],
                series: [
                    {
                        name: '沪伦比值(左)',
                        type: 'line',
                        smooth:true,  
                        data: yAdata
                    },
                    {
                        name: '进口盈亏(右)',
                        type: 'line',
                        yAxisIndex: 1,
                        smooth: true,
                        symbol: 'none',
                        sampling: 'average',
                        itemStyle: {
                            normal: {
                                color: 'rgb(255, 70, 131)'
                            }
                        },
                        areaStyle: {
                            normal: {
                                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                                    offset: 0,
                                    color: 'rgb(255, 158, 68)'
                                }, {
                                    offset: 1,
                                    color: 'rgb(255, 70, 131)'
                                }])
                            }
                        },
                        data: yBdata
                    }
                ]
            }

Other comments [其他信息]

线上实例
http://gallery.echartsjs.com/editor.html?c=xH1oFV2n9W&v=1

@Ovilia Ovilia self-assigned this Sep 19, 2017
@Ovilia Ovilia added the bug label Sep 19, 2017
@Ovilia Ovilia closed this as completed in 2e7e2fc Sep 26, 2017
@Ovilia
Copy link
Contributor

Ovilia commented Sep 26, 2017

这个问题其实是当数值轴的最大值是负的情况下,面积图的区域绘制错误。已修复,下个版本上线。

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

No branches or pull requests

2 participants