Updating x2 axis when sliding x axis

Hi communauty !

Basically I am trying to plot a date/value set of data in X(bottom)-Y and a duration/value in the X2(top)-Y .


I get duration by substract a reference date (early in 2010 in the graph above) to the set of date. So, x and X2 axes have to be linked together.
When sliding x axes, i would like slide also the x2 axis.

Someone can help to fix this ?

Hi @ylu,

How are you sliding the x-axis? If you pan by dragging in the middle of the chart I would expect the two xaxes to slide together. But if you click and drag on either xaxis then this would slide only the axis you’re clicking on.

Is this what you’re seeing?
-Jon

Yes that’s exactly it. But in my case both axis are stongly dependent (date and duration)
So, when i click and drag on either xaxis I would like to force the other axis to move also in the same way.

Hi @ylu,

I don’t know of a way to force the axis drag to pan both axes. If you’re displaying the plot using plotly.offline.iplot/plot, you could disable the axis dragging, so that the only way to pan is to click in the middle of the plot. Here’s how that would look.

from plotly.offline import init_notebook_mode, iplot
...
iplot(fig, config={'showAxisDragHandles': False, 'showAxisRangeEntryBoxes': False})

-Jon

Thanks Jon !
Currently I am quite satisfied since i work offline. Disabling the drag behavior on the x axis is enough for me.

ylu

1 Like