0

I am trying to plot output of an analysis model using D3.js This is the graph I am getting: enter image description here

But, there are chances that the error bars might overlap. So I want to move one of the error graphs(black or blue) slightly vertical. I found, in ggplot we use "position_dodge". Here is the ref http://www.cookbook-r.com/Graphs/Plotting_means_and_error_bars_(ggplot2)/

I want to know what is d3.js equivalent to position_dodge? Or is there any other way I can fix this? I am a newbie with D3.js. Any help will be appreciated. Thank you.

pas
  • 109
  • 1
  • 13
  • There's no equivalent in D3. – Lars Kotthoff Mar 21 '16 at 16:43
  • Thanks :) Is there any other way I can fix that. – pas Mar 21 '16 at 17:13
  • As Lars wrote, there's no d3 equivalent, so the only way to do it is compute all the positions and then do a 2nd pass, looping over those computed positions, detecting any overlaps and correcting the positioning. This all has to be done prior to rendering, because you need to do that second pass. So, your dodging code would operate much like `d3.layout...` modules work, computing final x and y coords prior to rendering. This is in contrast to *typical* non-layout-dependent d3 examples, in which the positioning/styling is derived "inline", ie inside the `.attr()` and `.style()` functors. – meetamit Mar 21 '16 at 17:33
  • [This question](https://stackoverflow.com/questions/17425268/d3js-automatic-labels-placement-to-avoid-overlaps-force-repulsion) is relevant here. – Lars Kotthoff Mar 21 '16 at 17:57

0 Answers0