CARVIEW |
Select Language
HTTP/2 200
accept-ranges: bytes
access-control-allow-origin: *
age: 0
cache-control: max-age=600
content-encoding: gzip
content-type: text/html; charset=utf-8
date: Wed, 15 Oct 2025 17:12:47 GMT
etag: W/"68e952e4-7568"
expires: Wed, 15 Oct 2025 17:22:46 GMT
last-modified: Fri, 10 Oct 2025 18:39:32 GMT
server: Vercel
strict-transport-security: max-age=63072000
vary: Accept-Encoding
via: 1.1 varnish
x-cache: MISS
x-cache-hits: 0
x-fastly-request-id: 8ca750c95e14cff0446c91e21eeece334aad3c6d
x-github-request-id: E5D5:F373C:22515:27842:68EFD60C
x-origin-cache: HIT
x-proxy-cache: MISS
x-robots-tag: index
x-served-by: cache-bom-vanm7210095-BOM
x-timer: S1760548367.741142,VS0,VE287
x-vercel-cache: MISS
x-vercel-id: bom1::zf9cm-1760548366722-198088fb7420
content-length: 7873
Range slider and selector in JavaScript
Range Slider and Selector in JavaScript
How to add range sliders to a D3.js-based line or scatter chart. Examples of Range Sliders
Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now.
var rawDataURL = 'https://raw.githubusercontent.com/plotly/datasets/master/2016-weather-data-seattle.csv';
var xField = 'Date';
var yField = 'Mean_TemperatureC';
var selectorOptions = {
buttons: [{
step: 'month',
stepmode: 'backward',
count: 1,
label: '1m'
}, {
step: 'month',
stepmode: 'backward',
count: 6,
label: '6m'
}, {
step: 'year',
stepmode: 'todate',
count: 1,
label: 'YTD'
}, {
step: 'year',
stepmode: 'backward',
count: 1,
label: '1y'
}, {
step: 'all',
}],
};
d3.csv(rawDataURL, function(err, rawData) {
if(err) throw err;
var data = prepData(rawData);
var layout = {
title: {
text: 'Time series with range slider and selectors'
},
xaxis: {
rangeselector: selectorOptions,
rangeslider: {}
},
yaxis: {
fixedrange: true
}
};
Plotly.newPlot('myDiv', data, layout);
});
function prepData(rawData) {
var x = [];
var y = [];
rawData.forEach(function(datum, i) {
x.push(new Date(datum[xField]));
y.push(datum[yField]);
});
return [{
mode: 'lines',
x: x,
y: y
}];
}
