afdsdsafadwer
afdsdsafadwer

Reputation: 67

Dc.js line chart yAxis ticks

I am creating a line chart with dc.js. The line chart can successfully render but the y axis is overlapped. I want to reduce the tick number on the y axis value with yAxis().ticks() but failed. 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);

Upvotes: 3

Views: 2652

Answers (1)

Daya Paari
Daya Paari

Reputation: 96

Always give xAxis and yAxis ticks separately from the Charts Definitions. 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);

Upvotes: 1

Related Questions