echarts去除x轴和y轴上的刻度值_Echarts柱状图之隐藏坐标轴和刻度

调整图表位置:

grid:数值单位px,支持百分比(字符串),如'50%'(显示区域横向中心)。

grid: {

top: '10%',

left: '8%',

right: '35%',

bottom: '5%',

containLabel: true

}

同时隐藏坐标轴(xAxis,yAxis)和刻度:

xAxis: {

show: false

}

单独隐藏坐标线:

axisLine: {

show: false,

lineStyle: {

...

} // 样式

}

单独隐藏刻度线:

axisTick: {

show: false

}

坐标轴文字倾斜:

axisLabel: {

interval: 0,

rotate: 45 // 角度

}

label数据展示:

label: {

show: true, //开启显示

position: 'top', //在上方显示

textStyle: { //数值样式

color: 'aqua',

fontSize: 15

}

}

全部js代码

// 为echarts对象加载数据

var myChart0 = echarts.init(document.getElementById('lt_3'));

option0 = {

grid: {

top: '10%',

left: '8%',

right: '35%',

bottom: '5%',

containLabel: true

},

xAxis: {

data: ["生产单位", "销售单位(有仓库)", "销售单位(无仓库)", "销售单位"],

axisTick: {

show: false

},

axisLine: {

show: true,

lineStyle: {

color: '#00ffee'

}

},

axisLabel: {

interval: 0,

rotate: 45

},

},

yAxis: {

show: false

},

series: [{

name: '销量',

type: 'bar',

barWidth: '10%',

data: [120, 204, 312, 312],

itemStyle: {

normal: {

color: 'aqua',

label: {

show: true, //开启显示

position: 'top', //在上方显示

textStyle: { //数值样式

color: 'aqua',

fontSize: 15

}

}

}

}

}]

};

// 使用刚指定的配置项和数据显示图表。

myChart0.setOption(option0);

效果图

7469d5a08582?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

柱形图.png

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要自定义echarts3D柱坐标轴刻度,您可以使用echarts的axis3D配置项来实现。可以通过设置axis3D中的tick和label配置项来自定义坐标轴刻度的显示和样式。 例如,您可以通过设置axis3D中的tick.alignWithLabel属性来控制刻度线与刻度标签的对齐方式,设置为true表示刻度线与刻度标签对齐,设置为false表示刻度线与刻度标签不对齐。 此外,还可以通过设置axis3D中的label.rotate属性来控制刻度标签的旋转角度,通过设置axis3D中的label.formatter属性来自定义刻度标签的格式化方式。 请参考以下示例代码,以自定义echarts3D柱坐标轴刻度为例: ```javascript option = { xAxis3D: { type: 'category', data: ['A', 'B', 'C', 'D', 'E'], axisLabel: { rotate: 45, // 刻度标签旋转角度 formatter: '{value}%' } }, yAxis3D: { type: 'value', axisTick: { alignWithLabel: true // 刻度线与刻度标签对齐 } }, zAxis3D: { type: 'category', data: ['X', 'Y', 'Z'] }, grid3D: { boxWidth: 200, boxHeight: 80, boxDepth: 50, viewControl: { distance: 150 } }, series: [{ type: 'bar3D', data: [ ['A', 'X', 30], ['A', 'Y', 60], ['A', 'Z', 90], ['B', 'X', 40], ['B', 'Y', 70], ['B', 'Z', 80], ['C', 'X', 50], ['C', 'Y', 80], ['C', 'Z', 70], ['D', 'X', 60], ['D', 'Y', 90], ['D', 'Z', 60], ['E', 'X', 70], ['E', 'Y', 50], ['E', 'Z', 80] ] }] }; ``` 这样,您就可以通过自定义axis3D中的tick和label配置项来实现对echarts3D柱坐标轴刻度的自定义设置。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值