繁体   English   中英

轴的D3文字未显示

[英]D3 text for axis not showing

这是我的代码:

    var height = 500,
        width = 500,
        margin = 25,
        offset = 50;
    var data = [4, 8, 15, 16, 23, 42];
    var axisWidth = width - 2 * margin;
    var x = d3.scale.linear()
     .range([0, axisWidth])
     .domain([0,42]);
    var xAxis = d3.svg.axis()
    .scale(x)
        .ticks(20, ",.1s")
        .tickSize(6, 0)
     .orient("bottom");
    var chart = d3.select(".chart")
        .attr("width", width)
        .attr("height", height);

    chart.append("g")
        .attr("class", "x axis")
       .attr("transform", "translate(0,200)")
        .call(xAxis);

我遵循了几个示例,它们都有一行连接刻度线和刻度线的文本值,我只剩下刻度线了? 有什么线索吗? 使用Chrome。

您还需要设置线条的样式:

path, line {
  fill: none;
  stroke: black;
}

在此处完成演示。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM