简体   繁体   English

Dc.js折线图yAxis滴答

[英]Dc.js line chart yAxis ticks

I am creating a line chart with dc.js. 我正在用dc.js创建折线图。 The line chart can successfully render but the y axis is overlapped. 折线图可以成功渲染,但y轴重叠。 I want to reduce the tick number on the y axis value with yAxis().ticks() but failed. 我想用yAxis().ticks()减少y轴值上的刻度数但是失败了。 Can somebody help me with this issue? 有人可以帮我解决这个问题吗? Thanks a lot. 非常感谢。

var DateD = ndx.dimension(function(d){return d.parsedDate});
var DateGroup = DateD.group().reduceCount();

var DatelineCharts = dc.lineChart("#chart-line")
    .width(1000).height(100)
    .dimension(DateD)
    .group(DateGroup)
    .x(d3.time.scale().domain([minDate,maxDate]))
    .elasticX(true)
    .elasticY(true)
    .xAxis().ticks(15);

    DatelineCharts.yAxis().ticks(15);

Always give xAxis and yAxis ticks separately from the Charts Definitions. 始终将xAxisyAxis刻度与图表定义分开。 Try the code below: 请尝试以下代码:

var DatelineCharts = dc.lineChart("#chart-line")
  .width(1000).height(100)
  .dimension(DateD)
  .group(DateGroup)
  .x(d3.time.scale().domain([minDate,maxDate]))
  .elasticX(true)
  .elasticY(true);
  //.xAxis().ticks(15);

DatelineCharts.xAxis().ticks(15);
DatelineCharts.yAxis().ticks(10);

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

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