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

Dataset的dimensions存在'0',无法正常工作,图表报错 #9363

Closed
elephantme opened this issue Nov 7, 2018 · 5 comments · Fixed by OpenTMI/opentmi-default-gui#32 or DeviaVir/zenbot#2011 · May be fixed by dyna-dot/iClient-JavaScript-s#1
Labels

Comments

@elephantme
Copy link

elephantme commented Nov 7, 2018

One-line summary [问题简述]

将官方提供的demo中的source中的2015修改为0,控制台报错,无法正常绘制图表

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 4.2.0
  • Browser version [浏览器类型和版本]: Chrome
  • OS Version [操作系统类型和版本]: Mac OS

Expected behaviour [期望结果]

正常工作

ECharts option [ECharts配置项]

option = {
    legend: {},
    tooltip: {},
    dataset: {
        source: [
            ['product', '0', '2016', '2017'],
            ['Matcha Latte', 43.3, 85.8, 93.7],
            ['Milk Tea', 83.1, 73.4, 55.1],
            ['Cheese Cocoa', 86.4, 65.2, 82.5],
            ['Walnut Brownie', 72.4, 53.9, 39.1]
        ]
    },
    xAxis: {type: 'category'},
    yAxis: {},
    // Declare several bar series, each will be mapped
    // to a column of dataset.source by default.
    series: [
        {type: 'bar'},
        {type: 'bar'},
        {type: 'bar'}
    ]
};

Other comments [其他信息]

@pissang pissang added the support label Nov 8, 2018
@pissang
Copy link
Contributor

pissang commented Nov 8, 2018

http://echarts.baidu.com/option.html#dataset.dimensions 参考 dimensions 文档里,可以设置字段类型,“0” 这样的可能会被自动识别成数字

@elephantme
Copy link
Author

elephantme commented Nov 9, 2018

http://echarts.baidu.com/option.html#dataset.dimensions 参考 dimensions 文档里,可以设置字段类型,“0” 这样的可能会被自动识别成数字

我换成这种写法可以了:

option = {
    legend: {},
    tooltip: {},
    dataset: {
        dimensions: ['product', {displayName: '0'}, '2', '3'],
        source: [
            ['Matcha Latte', 43.3, 85.8, 93.7],
            ['Milk Tea', 83.1, 73.4, 55.1],
            ['Cheese Cocoa', 86.4, 65.2, 82.5],
            ['Walnut Brownie', 72.4, 53.9, 39.1]
        ]
    },
    xAxis: {type: 'category'},
    yAxis: {},
    // Declare several bar series, each will be mapped
    // to a column of dataset.source by default.
    series: [
        {type: 'bar'},
        {type: 'bar'},
        {type: 'bar'}
    ]
};

你说的dimensions中的type我理解是指定dataset中data的数据类型的。目前这个问题是维度名称中出现'0',js就会报错,换成'1'都是可以正常展示的。

@yujinranran
Copy link

@pissang 大哥,修复了没,我也遇到了 啊!

@yujinranran
Copy link

很耽误事,维度为啥不是自动为 string

@yujinranran
Copy link

三万颗星,如此严重的故障,到现在还没修复,

http://echarts.baidu.com/option.html#dataset.dimensions 参考 dimensions 文档里,可以设置字段类型,“0” 这样的可能会被自动识别成数字

这个说实话也看不懂,这么坑,文档还不好理解

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