mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[ADD] new timeline widget
This commit is contained in:
committed by
Tom Blauwendraat
parent
765c0c4670
commit
7f985f06fe
120
static/lib/timeline/examples/example28_custom_controls.html
Normal file
120
static/lib/timeline/examples/example28_custom_controls.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Timeline demo</title>
|
||||
|
||||
<style type="text/css">
|
||||
body {font: 10pt arial;}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
|
||||
<script type="text/javascript" src="../timeline.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../timeline.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
var timeline;
|
||||
|
||||
google.load("visualization", "1");
|
||||
|
||||
// Set callback to run when API is loaded
|
||||
google.setOnLoadCallback(drawVisualization);
|
||||
|
||||
// Called when the Visualization API is loaded.
|
||||
function drawVisualization() {
|
||||
// Create and populate a data table.
|
||||
var data = new google.visualization.DataTable();
|
||||
data.addColumn('datetime', 'start');
|
||||
data.addColumn('datetime', 'end');
|
||||
data.addColumn('string', 'content');
|
||||
|
||||
data.addRows([
|
||||
[new Date(), , 'Conversation<br>' +
|
||||
'<img src="img/comments-icon.png" style="width:32px; height:32px;">'],
|
||||
[new Date(2010,7,23,23,0,0), , 'Mail from boss<br>' +
|
||||
'<img src="img/mail-icon.png" style="width:32px; height:32px;">'],
|
||||
[new Date(2010,7,24,16,0,0), , 'Report'],
|
||||
[new Date(2010,7,26), new Date(2010,8,2), 'Traject A'],
|
||||
[new Date(2010,7,28), , 'Memo<br>' +
|
||||
'<img src="img/notes-edit-icon.png" style="width:48px; height:48px;">'],
|
||||
[new Date(2010,7,29), , 'Phone call<br>' +
|
||||
'<img src="img/Hardware-Mobile-Phone-icon.png" style="width:32px; height:32px;">'],
|
||||
[new Date(2010,7,31), new Date(2010,8,3), 'Traject B'],
|
||||
[new Date(2010,8,4,12,0,0), , 'Report<br>' +
|
||||
'<img src="img/attachment-icon.png" style="width:32px; height:32px;">']
|
||||
]);
|
||||
|
||||
// specify options
|
||||
var options = {
|
||||
"width": "100%",
|
||||
"height": "300px",
|
||||
"style": "box"
|
||||
};
|
||||
|
||||
// Instantiate our timeline object.
|
||||
timeline = new links.Timeline(document.getElementById('mytimeline'), options);
|
||||
|
||||
// Draw our timeline with the created data and options
|
||||
timeline.draw(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Zoom
|
||||
* @param zoomVal
|
||||
*/
|
||||
function zoom(zoomVal) {
|
||||
timeline.zoom(zoomVal);
|
||||
timeline.trigger("rangechange");
|
||||
timeline.trigger("rangechanged");
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the visible time range such that all events are visible.
|
||||
*/
|
||||
function adjustVisibleTimeRangeToAccommodateAllEvents() {
|
||||
timeline.setVisibleChartRangeAuto();
|
||||
}
|
||||
|
||||
/**
|
||||
* Move
|
||||
* @param moveVal
|
||||
*/
|
||||
function move(moveVal) {
|
||||
timeline.move(moveVal);
|
||||
timeline.trigger("rangechange");
|
||||
timeline.trigger("rangechanged");
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the visible range such that the current time is located in the center of the timeline.
|
||||
*/
|
||||
function moveToCurrentTime() {
|
||||
timeline.setVisibleChartRangeNow();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>This page demonstrates the timeline zoom and move functions</h1>
|
||||
|
||||
<div>
|
||||
<h2>Zoom controls</h2>
|
||||
<input type="button" value="Zoom in" title="Zoom in" onclick="zoom(0.4);">
|
||||
<input type="button" value="Adjust visible range to accommodate all events" title="Adjust visible range to accommodate all events" onclick="adjustVisibleTimeRangeToAccommodateAllEvents();">
|
||||
<input type="button" value="Zoom out" title="Zoom in" onclick="zoom(-0.4);">
|
||||
</div>
|
||||
<div>
|
||||
<h2>Move controls</h2>
|
||||
<input type="button" value="Move left" title="Move left" onclick="move(-0.2);">
|
||||
<input type="button" value="Move to current time" title="Move to current time" onclick="moveToCurrentTime();">
|
||||
<input type="button" value="Move right" title="Move right" onclick="move(0.2);">
|
||||
</div>
|
||||
|
||||
<div id="mytimeline"></div>
|
||||
|
||||
<!-- Information about where the used icons come from -->
|
||||
<p style="color:gray; font-size:10px; font-style:italic;">
|
||||
Icons by <a href="http://dryicons.com" target="_blank" title="Aesthetica 2 Icons by DryIcons" style="color:gray;" >DryIcons</a>
|
||||
and <a href="http://www.tpdkdesign.net" target="_blank" title="Refresh Cl Icons by TpdkDesign.net" style="color:gray;" >TpdkDesign.net</a>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user