echart x轴标签偏移,echart 散点图x轴标记的点偏移,对不上

let XlineData= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]

let YlineData= [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

option = {

tooltip: {

trigger: 'axis',

axisPointer: {

type: 'cross',

label: {

backgroundColor: '#6a7985'

}

}

},

xAxis: {

name: 'x:月份',

type: 'category',

data: XlineData,

textStyle: {

color: '#8090A9',

fontsize: '11px'

},

axisLine: {

show: true,

onZero: true,

lineStyle: {

color: '#979797',

type: 'dotted'

},

label: {

show: true

}

},

axisTick: {

show: false,

alignWithLabel:false,

inside:false,

length:5,

},

axisLabel: {

formatter: function(params) {

return params

},

margin: 30

},

boundaryGap: false,

},

yAxis: {

type: 'category',

name: 'y:能量强度',

nameLocation: 'end',

nameTextStyle: {

align: 'center',

verticalAlign: 'bottom'

},

boundaryGap: false,

data: YlineData,

textStyle: {

color: '#8090A9',

fontsize: '11px'

},

axisLine: {

show: false

},

axisTick: {

show: false,

alignWithLabel: true

},

splitLine: {

show: true,

lineStyle: {

color: '#979797',

type: 'dotted'

}

},

splitArea: {

areaStyle: {

shadowOffsetX: {

step: 100

}

}

},

axisLabel: {

formatter: function(params) {

return params + '%'

},

margin: 20

}

},

series: [

{

data: [

0, 1, 3, 4

],

type: 'scatter'

}]

};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
echarts中,的X轴可以通过设置xAxisIndex来实现。具体实现方式如下: 1. 首先,在xAxis中定义两个x轴,一个用于折线,一个用于,并将的x轴设置为第二个x轴。例如: ```javascript xAxis: [ { type: 'category', // 第一个x轴用于折线,设置为类目轴 data: ['A', 'B', 'C', 'D', 'E'], // 其他配置项... }, { type: 'category', // 第二个x轴用于,设置为类目轴 show: false, // 隐藏第二个x轴 // 其他配置项... } ] ``` 2. 在的series中,通过设置xAxisIndex为1,将的X轴指定为第二个x轴。例如: ```javascript series: [ { type: 'scatter', // 类型 xAxisIndex: 1, // 指定X轴为第二个x轴 // 其他配置项... } ] ``` 这样就可以将的X轴设置为第二个x轴,并且的数据也会跟着折线的X轴进行变动。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [echarts表开发中遇到的问题总结。比如:设置断点,legend换行,x轴固定值以及修改样式](https://blog.csdn.net/weixin_48400717/article/details/128935213)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [echarts时间轴demo,内含两种实现方式。1.X轴为数值轴(type=value);2.X轴为时间轴(type=time)](https://download.csdn.net/download/qq_38880700/86017429)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值