Closed
Description
It would be helpful to be able to use an UpdateMenu to permit a user to change the range of a plot's axis.
This seems possible, based on example code for Plotly for Python:
https://community.plotly.com/t/pre-defined-range-buttons/39267/3
However I don't see how it's possible to do this from Plotly.NET, based on the need to send an axis start and end value.
I've attempted this with the following code, and several variations:
var buttons = new List<UpdateMenuButton>();
for (var time = timeInterval.StartInterval; time < timeInterval.EndInterval; time = time.AddHours(1))
{
buttons.Add(UpdateMenuButton.init(
Label: $"{time:h:mm tt}",
Method: StyleParam.UpdateMethod.Relayout,
Args: new[] { "xaxis.range",
$"{time:yyyy-MM-dd HH:mm:ss} - {time.AddHours(1):yyyy-MM-dd HH:mm:ss}" }
));
}
and
.WithLayout(layout: Layout.init<iConv>(UpdateMenus: new []{UpdateMenu.init(Buttons: buttons)}))
Using the above code, the UpdateMenu appears, the labels are correct, and selecting something does change the X axis range. However, it always changes to 1/1/2000 - 12/31/2000 rather than the desired range.