Vega-Lite X 轴标签未完整显示

Vega-Lite X-axis labels not showing in full

在Vega-Lite中x轴标签名称有点长,所以我把它弄成一个角度,

标签没有完整显示,是否可以使其完整显示,

同样在工具提示中,window 未显示完整,名称超出 window,是否可以将 window 变大或换行?

也不是所有的 x 轴刻度都显示标签,只有交替显示,如何更正它

完整的标签应该是,例如:

creditloandata-extratreesclassifier-24nov2020-14h45m58s

您需要设置labelLimit轴属性;例如 (open in editor):

{
  "data": {
    "values": [
      {"x": "creditloandata-extratreesclassifier-24nov2020-14h45m58s", "y": 1},
      {"x": "creditloandata-extratreesclassifier-24nov2020-15h45m58s", "y": 2},
      {"x": "creditloandata-extratreesclassifier-24nov2020-16h45m58s", "y": 3}
    ]
  },
  "mark": "line",
  "encoding": {
    "x": {
      "field": "x",
      "type": "nominal",
      "axis": {"labelAngle": -30, "labelLimit": 0}
    },
    "y": {"field": "y", "type": "quantitative"}
  },
  "width": 400
}

默认 labelLimit 为 100,这意味着标签被截断超过 100 个像素。您可以将其设置为更高的值,或将其设置为零以指示不应有限制。有关详细信息,请参阅 Vega-Lite Axis Documentation