Add range slider to the chart (#7525)

This commit is contained in:
Tsuneo Yoshioka
2025-09-10 04:22:53 +09:00
committed by GitHub
parent 120250152f
commit 47b1309f13

View File

@@ -8,9 +8,30 @@ import updateAxes from "./updateAxes";
import updateChartSize from "./updateChartSize";
import { prepareCustomChartData, createCustomChartRenderer } from "./customChartUtils";
const rangeSliderIcon = {
'width': 400,
'height': 400,
'path': 'M50 180h300a20 20 0 0 1 0 40H50a20 20 0 0 1 0-40z M160 200a40 40 0 1 0 -80 0a40 40 0 1 0 80 0 M320 200a40 40 0 1 0 -80 0a40 40 0 1 0 80 0',
};
Plotly.setPlotConfig({
modeBarButtonsToRemove: ["sendDataToCloud"],
modeBarButtonsToAdd: ["togglespikelines", "v1hovermode"],
modeBarButtonsToAdd: ["togglespikelines", "v1hovermode",
{
name: 'toggleRangeslider',
title: 'Toggle rangeslider',
icon: rangeSliderIcon,
click: function(gd: any) {
if(gd?.layout?.xaxis) {
let newRangeslider: any = {};
if (gd.layout.xaxis?.rangeslider) {
newRangeslider = null;
}
(Plotly.relayout as any)(gd, 'xaxis.rangeslider', newRangeslider);
}
}
},
],
locale: window.navigator.language,
});