File size: 929 Bytes
f6c521d 3ea9120 f6c521d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
<!DOCTYPE html>
<html>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<body>
<div id="myPlot" style="width:100%;max-width:700px"></div>
<script>
// Пример даты и времени
const xArray = [
new Date(2022, 0, 1, 0),
new Date(2022, 0, 1, 1),
new Date(2022, 0, 1, 2),
new Date(2022, 0, 1, 3),
new Date(2022, 0, 1, 4),
new Date(2022, 0, 1, 5),
new Date(2022, 0, 1, 6),
new Date(2022, 0, 1, 7),
new Date(2022, 0, 1, 8),
new Date(2022, 0, 1, 9),
new Date(2022, 0, 1, 10)
];
const yArray = [7,8,8,9,9,9,10,11,14,14,15];
// Define Data
const data = [{
x: xArray,
y: yArray,
mode: "lines"
}];
// Define Layout
const layout = {
xaxis: {
title: "Date and Time",
type: 'date'
},
yaxis: {range: [5, 16], title: "Price in Millions"},
title: "House Prices vs. Time"
};
// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
</script>
</body>
</html> |