Hello!
I’ve created a diagonal line through the origin, but I’d like that line to stay through the origin when the user zooms in our out - is that possible? Maybe by leveraging the equation of a line?
Update: I tried using an update function in my codepen below but this ends up crashing the entire page!!
<head>
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
</head>
<body>
<div id='myDiv'></div>
</body>
let trace = [
{
x: [1, 2, 3, 4, 5],
y: [1, 2, 4, 8, 16],
mode: 'markers',
type: 'scatter'
}
]
let layout = {
shapes: [
{
type: 'line',
yref: 'paper',
xref: 'paper',
y0: 0,
y1: 1,
x0: 0,
x1: 1,
layer: 'below',
line: {
color: 'gray',
width: 1
}
}]
}
Plotly.newPlot('myDiv',
trace,
layout,
{scrollZoom: true});
also here: https://codepen.io/MayaRGans/pen/WNMzWBZ