Hi, I have a simple bar chart that displays like this:
<!DOCTYPE html>
<html lang="cs">
<head>
<title>Metheus</title>
<script src="https://cdn.plot.ly/plotly-2.26.0.min.js" charset="utf-8"></script>
<meta charset="UTF-8" />
</head>
<body>
<div id="chart" style="display: block; margin: auto; width: 900px;"></div>
<script>
var test = {
y: [69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 69, 68, 69, 68, 69, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, , 65, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 67, 67, 67, 67, 67, 67, 67, , 64, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, , 63, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, , 62, 65, 65, 65, 65, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, , 64, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66],
type: 'bar',
mode: 'lines',
xaxis: 'x',
yaxis: 'y1',
connectgaps: false,
};
var data = [test];
var layout = {
bargap: 0
};
var config = {
staticPlot: false
};
Plotly.newPlot('chart', data, layout, config);
</script>
</body>
</html>
If I omit the X-axis values, the graph displays correctly. If I put the date and time on the X axis, the same graph displays incorrectly.
<!DOCTYPE html>
<html lang="cs">
<head>
<title>Metheus</title>
<script src="https://cdn.plot.ly/plotly-2.26.0.min.js" charset="utf-8"></script>
<meta charset="UTF-8" />
</head>
<body>
<div id="chart" style="display: block; margin: auto; width: 900px;"></div>
<script>
var test = {
x: ['2023-10-22 07:00:00', '2023-10-22 07:10:00', '2023-10-22 07:20:00', '2023-10-22 07:30:00', '2023-10-22 07:40:00', '2023-10-22 07:50:00', '2023-10-22 08:00:00', '2023-10-22 08:10:00', '2023-10-22 08:20:00', '2023-10-22 08:30:00', '2023-10-22 08:40:00', '2023-10-22 08:50:00', '2023-10-22 09:00:00', '2023-10-22 09:10:00', '2023-10-22 09:20:00', '2023-10-22 09:30:00', '2023-10-22 09:40:00', '2023-10-22 09:50:00', '2023-10-22 10:00:00', '2023-10-22 10:10:00', '2023-10-22 10:20:00', '2023-10-22 10:30:00', '2023-10-22 10:40:00', '2023-10-22 10:50:00', '2023-10-22 11:00:00', '2023-10-22 11:10:00', '2023-10-22 11:20:00', '2023-10-22 11:30:00', '2023-10-22 11:40:00', '2023-10-22 11:50:00', '2023-10-22 12:00:00', '2023-10-22 12:10:00', '2023-10-22 12:20:00', '2023-10-22 12:30:00', '2023-10-22 12:40:00', '2023-10-22 12:50:00', '2023-10-22 13:00:00', '2023-10-22 13:10:00', '2023-10-22 13:20:00', '2023-10-22 13:30:00', '2023-10-22 13:40:00', '2023-10-22 13:50:00', '2023-10-22 14:00:00', '2023-10-22 14:10:00', '2023-10-22 14:20:00', '2023-10-22 14:30:00', '2023-10-22 14:40:00', '2023-10-22 14:50:00', '2023-10-22 15:00:00', '2023-10-22 15:10:00', '2023-10-22 15:20:00', '2023-10-22 15:30:00', '2023-10-22 15:40:00', '2023-10-22 15:50:00', '2023-10-22 16:00:00', '2023-10-22 16:10:00', '2023-10-22 16:20:00', '2023-10-22 16:30:00', '2023-10-22 16:40:00', '2023-10-22 16:50:00', '2023-10-22 17:00:00', '2023-10-22 17:10:00', '2023-10-22 17:20:00', '2023-10-22 17:30:00', '2023-10-22 17:40:00', '2023-10-22 17:50:00', '2023-10-22 18:00:00', '2023-10-22 18:10:00', '2023-10-22 18:20:00', '2023-10-22 18:30:00', '2023-10-22 18:40:00', '2023-10-22 18:41:00', '2023-10-22 19:00:00', '2023-10-22 19:10:00', '2023-10-22 19:20:00', '2023-10-22 19:30:00', '2023-10-22 19:40:00', '2023-10-22 19:50:00', '2023-10-22 20:00:00', '2023-10-22 20:10:00', '2023-10-22 20:20:00', '2023-10-22 20:30:00', '2023-10-22 20:40:00', '2023-10-22 20:50:00', '2023-10-22 21:00:00', '2023-10-22 21:10:00', '2023-10-22 21:20:00', '2023-10-22 21:30:00', '2023-10-22 21:40:00', '2023-10-22 21:50:00', '2023-10-22 21:51:00', '2023-10-22 22:10:00', '2023-10-22 22:20:00', '2023-10-22 22:30:00', '2023-10-22 22:40:00', '2023-10-22 22:50:00', '2023-10-22 23:00:00', '2023-10-22 23:10:00', '2023-10-22 23:20:00', '2023-10-22 23:30:00', '2023-10-22 23:40:00', '2023-10-22 23:50:00', '2023-10-23 00:00:00', '2023-10-23 00:10:00', '2023-10-23 00:20:00', '2023-10-23 00:30:00', '2023-10-23 00:40:00', '2023-10-23 00:50:00', '2023-10-23 01:00:00', '2023-10-23 01:10:00', '2023-10-23 01:20:00', '2023-10-23 01:30:00', '2023-10-23 01:40:00', '2023-10-23 01:50:00', '2023-10-23 02:00:00', '2023-10-23 02:10:00', '2023-10-23 02:20:00', '2023-10-23 02:21:00', '2023-10-23 02:40:00', '2023-10-23 02:50:00', '2023-10-23 03:00:00', '2023-10-23 03:10:00', '2023-10-23 03:20:00', '2023-10-23 03:30:00', '2023-10-23 03:40:00', '2023-10-23 03:50:00', '2023-10-23 04:00:00', '2023-10-23 04:10:00', '2023-10-23 04:20:00', '2023-10-23 04:30:00', '2023-10-23 04:40:00', '2023-10-23 04:50:00', '2023-10-23 05:00:00', '2023-10-23 05:10:00', '2023-10-23 05:20:00', '2023-10-23 05:30:00', '2023-10-23 05:40:00', '2023-10-23 05:50:00', '2023-10-23 06:00:00', '2023-10-23 06:10:00', '2023-10-23 06:20:00', '2023-10-23 06:30:00', '2023-10-23 06:40:00', '2023-10-23 06:50:00', '2023-10-23 07:00:00', '2023-10-23 07:10:00', '2023-10-23 07:20:00', '2023-10-23 07:30:00', '2023-10-23 07:40:00', '2023-10-23 07:50:00', '2023-10-23 08:00:00', '2023-10-23 08:10:00', '2023-10-23 08:20:00', '2023-10-23 08:30:00', '2023-10-23 08:40:00', '2023-10-23 08:50:00', '2023-10-23 09:00:00', '2023-10-23 09:10:00', '2023-10-23 09:20:00', '2023-10-23 09:30:00', '2023-10-23 09:40:00', '2023-10-23 09:50:00', '2023-10-23 10:00:00', '2023-10-23 10:10:00', '2023-10-23 10:20:00', '2023-10-23 10:30:00', '2023-10-23 10:40:00', '2023-10-23 10:50:00', '2023-10-23 11:00:00', '2023-10-23 11:01:00', '2023-10-23 11:20:00', '2023-10-23 11:30:00', '2023-10-23 11:40:00', '2023-10-23 11:50:00', '2023-10-23 12:00:00', '2023-10-23 12:10:00', '2023-10-23 12:20:00', '2023-10-23 12:30:00', '2023-10-23 12:40:00', '2023-10-23 12:50:00', '2023-10-23 13:00:00', '2023-10-23 13:10:00', '2023-10-23 13:20:00', '2023-10-23 13:30:00', '2023-10-23 13:40:00', '2023-10-23 13:50:00', '2023-10-23 14:00:00', '2023-10-23 14:10:00', '2023-10-23 14:20:00', '2023-10-23 14:30:00', '2023-10-23 14:40:00', '2023-10-23 14:41:00', '2023-10-23 15:00:00', '2023-10-23 15:10:00', '2023-10-23 15:20:00', '2023-10-23 15:30:00', '2023-10-23 15:40:00', '2023-10-23 15:50:00', '2023-10-23 16:00:00', '2023-10-23 16:10:00', '2023-10-23 16:20:00', '2023-10-23 16:30:00', '2023-10-23 16:40:00', '2023-10-23 16:50:00', '2023-10-23 17:00:00', '2023-10-23 17:10:00', '2023-10-23 17:20:00', '2023-10-23 17:30:00', '2023-10-23 17:40:00', '2023-10-23 17:50:00', '2023-10-23 18:00:00'],
y: [69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 68, 68, 69, 68, 69, 68, 69, 69, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, , 65, 67, 67, 67, 67, 67, 67, 67, 67, 67, 68, 67, 67, 67, 67, 67, 67, 67, , 64, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, , 63, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, , 62, 65, 65, 65, 65, 64, 65, 65, 65, 65, 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, 67, , 64, 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66],
type: 'bar',
mode: 'lines',
xaxis: 'x',
yaxis: 'y1',
connectgaps: false,
};
var data = [test];
var layout = {
bargap: 0
};
var config = {
staticPlot: false
};
Plotly.newPlot('chart', data, layout, config);
</script>
</body>
</html>
Is it possible to achieve the same result with an X-axis that will have the date and time and the graph will look like the first case?