-
-
Notifications
You must be signed in to change notification settings - Fork 139
Description
I am working on an application which allows charting of multiple timeseries and selecting whether to display them on a left or right y-axis. I have written my own react component which uses react-plotly.js and data and layout props are created within the render method. I seem to reliably be able to produce this chart where the top blue line is ghosted by updating my state from a 1-item data array with yaxis: 'y' to a 2-item with yaxis: 'y' to a 2-item with 1x yaxis: 'y' and 1x yaxis: 'y2'. I'm not sure if this is a bug or if I have misconfigured multiple axes (based on https://plot.ly/javascript/multiple-axes/)
When I build the data array I set the yaxis parameter to either 'y' or 'y2' e.g.
{
hoverinfo: 'x+y+text',
mode: 'lines',
name: label,
type: 'scatter',
x: params.data.keySeq().map((date)=>DateTimeFormatter.ISO_LOCAL_DATE.format(date)).toArray(),
y: params.data.valueSeq().toArray(),
yaxis: params.yaxis==='left'?'y': 'y2'
}
My layout:
{
annotations: [{
ax: 0,
captureevents: true,
text: 'BOE-25bp',
x: '2016-08-04',
y: 0
},
{
ax: 0,
captureevents: true,
text: 'BOE+25bp',
x: '2017-11-02',
y: 0
}],
height: 800,
width: this.state.chartWidth,
xaxis: {
range: [DateTimeFormatter.ISO_LOCAL_DATE.format(this.state.chartOptions.startDate()),
DateTimeFormatter.ISO_LOCAL_DATE.format(this.state.chartOptions.endDate)],
type: 'date'
},
yaxis: {
side: 'left',
},
yaxis2: {
overlaying: 'y'as'/^y([2-9]|[1-9][0-9]+)?$/',
side: 'right'
}
}
Props via the react chrome debugger shown below:
I also exported the data here:
https://plot.ly/~jfreedman/1/