หากคุณทำงานใน d3.v4 ตามที่แนะนำคุณสามารถใช้อินสแตนซ์นี้เพื่อเสนอทุกสิ่งที่คุณต้องการ
คุณอาจแค่ต้องการแทนที่ข้อมูลแกน X ด้วย "วัน" ของคุณ แต่อย่าลืมแยกวิเคราะห์ค่าสตริงให้ถูกต้องและอย่าใช้แบบเรียงต่อกัน
parseTime อาจใช้เคล็ดลับสำหรับวันที่ปรับขนาดด้วยรูปแบบวันที่หรือไม่
d3.json("data.json", function(error, data) {
if (error) throw error;
data.forEach(function(d) {
  d.year = parseTime(d.year);
  d.value = +d.value;
});
x.domain(d3.extent(data, function(d) { return d.year; }));
y.domain([d3.min(data, function(d) { return d.value; }) / 1.005, d3.max(data, function(d) { return d.value; }) * 1.005]);
g.append("g")
    .attr("class", "axis axis--x")
    .attr("transform", "translate(0," + height + ")")
    .call(d3.axisBottom(x));
g.append("g")
    .attr("class", "axis axis--y")
    .call(d3.axisLeft(y).ticks(6).tickFormat(function(d) { return parseInt(d / 1000) + "k"; }))
  .append("text")
    .attr("class", "axis-title")
    .attr("transform", "rotate(-90)")
    .attr("y", 6)
    .attr("dy", ".71em")
    .style("text-anchor", "end")
    .attr("fill", "#5D6971")
    .text("Population)");
ซอกับ global css / js
     
              
.attr("transform", "rotate(-90)")ทำให้ระบบพิกัดทั้งหมดหมุน ดังนั้นหากคุณวางตำแหน่งด้วย "x" และ "y" คุณต้องสลับตำแหน่งจากที่ฉันคาดไว้