Skip to content

怎么让坐标轴全部显示呢? #3485

@daoyuanjiao

Description

@daoyuanjiao

问题简述 (One-line summary)

在折线图坐标中,比如我的X轴 dataObj2 = [0,1,2,3,4,5,6,7,8,9,10,11,12]; 在我加载数据的时候,X轴上的数字总是根据我的系列数据在变化。比如我的系列数据是data:[11, 11, 15, 13, 12, 13, 10,20,38], 那么我的X轴上显示的就是0,1,2,3,4,5,6,7,8。
另外:我也配置了 type:'cross' ,但是鼠标移动的时候还是一根竖线。

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):
  • 浏览器类型和版本 (Browser version):
  • 操作系统类型和版本 (OS Version):

重现步骤 (Steps to reproduce)

期望结果 (Expected behaviour)

希望能够全部显示出来!X轴一直显示为0,1,2,3,4,5,6,7,8,9,10,11,12,Y轴也需要从零开始显示。鼠标移动到数据点时,显示的是十字光标。

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

ECharts配置项 (ECharts option)

option = {
tooltip: {
                trigger: 'axis',
                type:'cross' 
                },
                toolbox: {
                    show : true,
                    feature : {
                    mark : {show: true},
                    dataZoom : {show: true},
                    dataView : {show: true, readOnly: false},
                    restore : {show: true},
                    saveAsImage : {show: true}
                    }
                    },
                axisLine: {onZero: false},
             xAxis:  {
                    type: 'category',
                    boundaryGap: false,
                    data : [0,1,2,3,4,5,6,7,8,9,10,11,12]
                },
                yAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data : [0,1,2,3,4,5,6,7,8,9,10,11,12]
                },
            series: [{
                name: '0141301',
                type: 'line',
             data: [[1,1], [2, 1], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], [9, 9], [10, 10]]
            }]
}

其他信息 (Other comments)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions