Ero sivun ”Widget:Test” versioiden välillä
Järvi-meriwikistä
(3 välissä olevaa versiota samalta käyttäjältä ei näytetä) | |||
Rivi 1: | Rivi 1: | ||
<div id="timeline" style="height: 180px;"></div> | <div id="timeline" style="height: 180px;"></div> | ||
+ | <script type="text/javascript" src="https://www.sttinfo.fi/embedded/prs_embedded.js"></script> | ||
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> | <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
Rivi 5: | Rivi 6: | ||
google.charts.setOnLoadCallback(drawChart); | google.charts.setOnLoadCallback(drawChart); | ||
function drawChart() { | function drawChart() { | ||
+ | |||
var container = document.getElementById('timeline'); | var container = document.getElementById('timeline'); | ||
var chart = new google.visualization.Timeline(container); | var chart = new google.visualization.Timeline(container); | ||
Rivi 17: | Rivi 19: | ||
[ 'Jefferson', new Date(1801, 2, 4), new Date(1809, 2, 4) ]]); | [ 'Jefferson', new Date(1801, 2, 4), new Date(1809, 2, 4) ]]); | ||
− | chart.draw(dataTable); | + | chart.draw(dataTable, { explorer: { axis: 'horizontal' } } ); |
} | } | ||
</script> | </script> |
Nykyinen versio 10. maaliskuuta 2023 kello 10.41
<script type="text/javascript" src="https://www.sttinfo.fi/embedded/prs_embedded.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['timeline']}); google.charts.setOnLoadCallback(drawChart); function drawChart() {
var container = document.getElementById('timeline'); var chart = new google.visualization.Timeline(container); var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'President' }); dataTable.addColumn({ type: 'date', id: 'Start' }); dataTable.addColumn({ type: 'date', id: 'End' }); dataTable.addRows([ [ 'Washington', new Date(1789, 3, 30), new Date(1797, 2, 4) ], [ 'Adams', new Date(1797, 2, 4), new Date(1801, 2, 4) ], [ 'Jefferson', new Date(1801, 2, 4), new Date(1809, 2, 4) ]]);
chart.draw(dataTable, { explorer: { axis: 'horizontal' } } ); } </script>