https://codepen.io/mo4_9/pen/xLJKXZ
this.stage.append('g')
.classed('axisX-label',true)
.attr('transform',`translate(${this.margin.left},${this.HEIGHT + this.margin.top})`)
.call(
d3.axisBottom()
.scale(this.xScaleKojin)
.ticks(3) // よしなに区切ってくれる
.tickFormat(function(d) {
if(this.parentNode.nextSibling){
return d === 0 ? d : '';
} else {
return d + " min";
}
})
)
this.stage.append('g')
.classed('axisY-label',true)
.classed('axisY-label-zentai',true)
.attr('transform',`translate(${this.margin.left + this.WIDTH - 10},${this.margin.top})`)
.call(
d3.axisRight()
.scale(this.yScaleZentai)
.ticks(3)
.tickFormat(function(d) {
return d === 0
? ''
: (d / 1e3) + " K";
})
)