Vishnu
Vishnu

Reputation: 475

horizontal lines along the y axis d3 bar chart

https://jsfiddle.net/betasquirrel/pnyn7vzj/1/ in this plunkr how the horizontal lines along the y axis are added

I just tried adding this css code

  .axis path,
  .axis line {
    fill: none;
    stroke: #000;
  }

I want to develop bar without the x axis , I have attached an image please check with that.enter image description here

Upvotes: 2

Views: 1822

Answers (2)

Gaet
Gaet

Reputation: 689

I just wanted clarify that Andrei Roba gave the correct answer to the original question: the piece of code in the jsfiddle that draws the horizontal lines accross the graph is

.tickSize(-width, 0, 0)

The ticks have their size set to the whole width of the graph, which effectively draws a whole line.

Upvotes: 0

Andrei Roba
Andrei Roba

Reputation: 2322

In your code, where you define your xAxis. Instead of:

var xAxis = d3.svg.axis()
  .scale(x)
  .orient("bottom")
  .tickFormat(d3.time.format("%Y"));

You should try:

var xAxis = d3.svg.axis()
  .scale(x)
  .orient("bottom")
  .tickValues([]);

This will remove your x-axis labels and ticks. Read this post for more information.

Upvotes: 1

Related Questions