Version
5.0.2
Steps to reproduce
option = {
"tooltip":{
"trigger":"axis",
"axisPointer":{"type":"cross"},
"confine":true},
"legend":{"right":16,"data":["投入数","产量","产出率"]},
"xAxis":[{
"type":"category",
"axisLabel":{"lineHeight":12,"interval":0}}],
"grid":{"left":"26px","right":"26px","top":"55px","bottom":"16px","containLabel":true},
"dataset":{"demensions":["fz","trsl","hgsl","ccl"],
"source":[["J成型工段",null,null,null],["J成烧工段",null,null,null]]},
"yAxis":[{"type":"value","scale":false,"splitLine":{"show":true},
"axisLine":{"show":false},
"yAxisIndex":0,
"splitNumber":5,
"interval":0.2,
"min":0,"max":1},
{"type":"value",
"axisLabel":{"formatter":"{value}%"},
"scale":true,
"splitLine":{"lineStyle":{"type":"dashed"}},
"axisLine":{"show":false},
"yAxisIndex":1,"splitNumber":5,
"interval":0.2,"min":0,"max":1}],
"series":[{
"name":"投入数",
"type":"bar",
"yAxisIndex":0,
"itemStyle":{"color":"#488AFF"},
"animation":false,
"symbolSize":0,
"label":false,
"barGap":"10%",
"lineStyle":{"color":"#488AFF"},
"barMinWidth":"20px","barCategoryGap":"50%"},
{"name":"产量",
"columnName":"hgsl",
"type":"bar","yAxisIndex":0,
"itemStyle":{"color":"#14CBC6"},
"animation":false,
"symbolSize":0,
"label":false,
"barGap":"10%",
"lineStyle":{"color":"#14CBC6"},
"barMinWidth":"20px",
"barCategoryGap":"50%"},
{"name":"产出率",
"columnName":"ccl",
"type":"line",
"yAxisIndex":1,
"connectNulls":true,
"itemStyle":{"color":"#FFBE28"},
"animation":false,
"markPoint":{"data":[{
"type":"max",
"name":"最大值",
"symbolSize":1,
"symbolOffset":[0,-10],
"label":{"color":"#FFBE28"}},
{"type":"min",
"name":"最小值",
"symbolSize":1,
"symbolOffset":[0,10],
"label":{"color":"#FFBE28"}}]},
"symbolSize":4,
"symbol":"circle",
"label":false,"barGap":"10%",
"lineStyle":{"color":"#FFBE28"}}],
"toolbox":{"show":false},"splitNumber":5}
What is expected?
dataset source数组内传几项,对应X轴坐标显示几项
What is actually happening?
数组第一项为NULL时,X坐标不显示第一内容
官网的Demo中设置dataset 的source第一项数值为null,X坐标也不显示对象坐标名称
2条答案
按热度按时间o2rvlv0m1#
我发现可以通过给source这个二维数组第一项插入['product', '投入数', '产量', '产出率'],可解决这个问题
ssm49v7z2#
This even appear in the official example
在官方示例中甚至可以看到这种现象
https://echarts.apache.org/examples/en/editor.html?c=data-transform-sort-bar