d3:Adding Axis like a Box

I have d3 graph with xaxis and Y axis.I want to add axis to the top and right to make it look like a box. Something like This.enter image description here

Upvotes: 0

Views: 273

Answers (1)

samuellawrentz
samuellawrentz

Reputation: 1732

You could go through this article for adding multiple axes. You should create new axis generators and give the orient as 'right' and top and call them finally.

http://www.d3noob.org/2013/01/using-multiple-axes-for-d3js-graph.html

EDIT:

I have made a simple line chart with your requirements. Have a look at https://jsfiddle.net/j0kaLf59/

Also as mentioned in the comments, you could just add two line elements. Have a look at this fiddle https://jsfiddle.net/a6o2hkfq/

Reference:

Upvotes: 1

Related Questions