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

line系列中的数据内容数组为类目名称时无法画图 #3494

Closed
daoyuanjiao opened this Issue Jun 24, 2016 · 10 comments

Comments

Projects
None yet
2 participants
@daoyuanjiao

daoyuanjiao commented Jun 24, 2016

问题简述 (One-line summary)

我在画line线的过程中将数组类容设为类目名称:
var data = [['8:40:52','第一日',1],['8:45:52','第二日',4],['8:49:52','第三日',7]];
则无法绘图;
将data设为类目的index时:
var data = [[0,0,1],[1,1,4],[2,3,7]];
则可以正常绘图。但是在
http://echarts.baidu.com/option.html#series-line.data
说明中是可以用类目名称的:
【【在坐标系两个轴都为类目轴的时候,每个数据项也需要是一个数组,单个数据项至少要有两个值表示在两个轴上类目的索引或者类目的名称,如下:
[[0, 0, 2], ['星期一', 2, 1], [2, 1, 2], [3, 3, 5]]

每一项数值数组从第三个值开始可以表示数据的其它维度,配合 visualMap 组件可以将指定的一个或多个维度映射到颜色,大小等多个图形属性上。
】】

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):
    网站最新,刚刚在线生成的
  • 浏览器类型和版本 (Browser version):
  • 操作系统类型和版本 (OS Version):

重现步骤 (Steps to reproduce)

期望结果 (Expected behaviour)

能够按照类目名称画图

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

option = {
var hours = ['8:40:52','8:45:52','8:49:52','8:54:00','8:55:53','8:56:43','8:59:44','9:00:14','9:02:56','9:03:31','9:05:18','9:05:48','9:07:51','9:08:21','9:10:36','9:11:11','9:14:41','9:15:06','9:16:58','9:17:23','9:20:08','9:20:33','9:22:46','9:23:21','9:25:47','9:26:22','9:28:30','9:29:05','9:30:54','9:31:39','9:36:42','9:37:07','9:41:20','9:41:50','9:46:50','9:47:35'];
var days =['第一日','第二日','第三日','第四日','第五日','第六日','第七日','第八日','第九日','第十日','第十一日','第十二日','第十三日','第十四日','第十五日']
//var data = [['8:40:52','第一日',1],['8:45:52','第二日',4],['8:49:52','第三日',7]];
var data = [[0,0,1],[1,1,4],[2,3,7]];
option = {
    title: {
        text: 'Punch Card of Github',
        link: 'https://github.com/pissang/echarts-next/graphs/punch-card'
    },
    legend: {
        data: ['Punch Card'],
        left: 'right'
    },
    tooltip: {
        position: 'top',
        formatter: function (params) {
            return params.value[2] + ' commits in ' + hours[params.value[0]] + ' of ' + days[params.value[1]];
        }
    },
    grid: {
        left: 2,
        bottom: 10,
        right: 10,
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: hours,
        boundaryGap: false,
        splitLine: {
            show: true,
            lineStyle: {
                color: '#ddd',
                type: 'dashed'
            }
        },
        axisLine: {
            show: false
        }
    },
    yAxis: {
        type: 'category',
        data: days,
        axisLine: {
            show: false
        }
    },
    series: [{
        name: 'Punch Card',
        type: 'line',
         data: data,
    }]
};
}

其他信息 (Other comments)

@pissang

This comment has been minimized.

Show comment
Hide comment
@pissang

pissang Jun 24, 2016

Contributor
Contributor

pissang commented Jun 24, 2016

@daoyuanjiao

This comment has been minimized.

Show comment
Hide comment
@daoyuanjiao

daoyuanjiao Jun 24, 2016

请您将我的data换成我注释掉的data(即变为类目索引时),就无法生成了!

daoyuanjiao commented Jun 24, 2016

请您将我的data换成我注释掉的data(即变为类目索引时),就无法生成了!

@pissang

This comment has been minimized.

Show comment
Hide comment
@pissang

pissang Jun 24, 2016

Contributor

是有这个 bug,95a64c6 中已修复

Contributor

pissang commented Jun 24, 2016

是有这个 bug,95a64c6 中已修复

@pissang pissang closed this Jun 24, 2016

@daoyuanjiao

This comment has been minimized.

Show comment
Hide comment
@daoyuanjiao

daoyuanjiao Jun 24, 2016

我将echarts.js中18956行中的 if (categoryDimIndex === dimIndex) { 替换为 if (dimensions[dimIndex].type === 'ordinal') { 是可以出现折线,但是只是一条直线,没有显示出数据的变化。我用索引的时候画出的是一条斜线。您有时间可以再测试一下,谢谢!

daoyuanjiao commented Jun 24, 2016

我将echarts.js中18956行中的 if (categoryDimIndex === dimIndex) { 替换为 if (dimensions[dimIndex].type === 'ordinal') { 是可以出现折线,但是只是一条直线,没有显示出数据的变化。我用索引的时候画出的是一条斜线。您有时间可以再测试一下,谢谢!

@daoyuanjiao

This comment has been minimized.

Show comment
Hide comment
@daoyuanjiao

daoyuanjiao Jun 27, 2016

这个是有人负责跟进吗?

daoyuanjiao commented Jun 27, 2016

这个是有人负责跟进吗?

@pissang

This comment has been minimized.

Show comment
Hide comment
@pissang

pissang Jun 27, 2016

Contributor

@daoyuanjiao c4c7278 中修复了这个问题

Contributor

pissang commented Jun 27, 2016

@daoyuanjiao c4c7278 中修复了这个问题

@daoyuanjiao

This comment has been minimized.

Show comment
Hide comment
@daoyuanjiao

daoyuanjiao Jun 28, 2016

不好意思,在这个 c4c7278 中的ThemeRiverSeries.js 文件中的var data = this.fixData(option.data); 我在网站打包后的echarts.js中,没有找到呢?该怎么弄呢?

daoyuanjiao commented Jun 28, 2016

不好意思,在这个 c4c7278 中的ThemeRiverSeries.js 文件中的var data = this.fixData(option.data); 我在网站打包后的echarts.js中,没有找到呢?该怎么弄呢?

@daoyuanjiao

This comment has been minimized.

Show comment
Hide comment
@daoyuanjiao

daoyuanjiao Jun 28, 2016

我是在网站下载的源代码,只有一个echarts.js文件

daoyuanjiao commented Jun 28, 2016

我是在网站下载的源代码,只有一个echarts.js文件

@daoyuanjiao

This comment has been minimized.

Show comment
Hide comment
@daoyuanjiao

daoyuanjiao Jun 28, 2016

我在本网站下载源代码之后,按照 c4c7278 中的要求,进行了修改!然后项目引用echarts-3.1.10文件夹中的index.js后,用类目索引是可以画出来的,但是将数据修改为类目名称时,就是只有坐标,没有任何线条!您有时间可以用我上面的数据测试一下!还是我的引用方法有问题!

daoyuanjiao commented Jun 28, 2016

我在本网站下载源代码之后,按照 c4c7278 中的要求,进行了修改!然后项目引用echarts-3.1.10文件夹中的index.js后,用类目索引是可以画出来的,但是将数据修改为类目名称时,就是只有坐标,没有任何线条!您有时间可以用我上面的数据测试一下!还是我的引用方法有问题!

@pissang

This comment has been minimized.

Show comment
Hide comment
@pissang

pissang Jun 30, 2016

Contributor

@daoyuanjiao 等明天新版本发布再试下吧?

Contributor

pissang commented Jun 30, 2016

@daoyuanjiao 等明天新版本发布再试下吧?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment