如何用序数轴更改刻度线的文本
How to change tick's text with ordinal axis
我有下一个属性的图表:
barChart
.width(width)
.height(height)
.dimension(dim)
.group(group)
.x(d3.scale.ordinal())
.xUnits(dc.units.ordinal)
我的轴刻度看起来像 "ZZxBob"、"PxBob"
如何使用 'x' 拆分功能到每个报价单?
轴完全由 D3 生成。
您可以使用 chart.xAxis()
to retrieve the x axis object, and then axis.tickFormat()
更改它的显示方式。
所以,例如显示 x:
之前的部分
barChart.xAxis()
.tickFormat(function(l) { return l.split('x')[0]; })
我有下一个属性的图表:
barChart
.width(width)
.height(height)
.dimension(dim)
.group(group)
.x(d3.scale.ordinal())
.xUnits(dc.units.ordinal)
我的轴刻度看起来像 "ZZxBob"、"PxBob"
如何使用 'x' 拆分功能到每个报价单?
轴完全由 D3 生成。
您可以使用 chart.xAxis()
to retrieve the x axis object, and then axis.tickFormat()
更改它的显示方式。
所以,例如显示 x:
之前的部分barChart.xAxis()
.tickFormat(function(l) { return l.split('x')[0]; })