0
|
1 /*
|
|
2 * FuzzyTimelineGui.js
|
|
3 *
|
|
4 * Copyright (c) 2013, Sebastian Kruse. All rights reserved.
|
|
5 *
|
|
6 * This library is free software; you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU Lesser General Public
|
|
8 * License as published by the Free Software Foundation; either
|
|
9 * version 3 of the License, or (at your option) any later version.
|
|
10 *
|
|
11 * This library is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * Lesser General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU Lesser General Public
|
|
17 * License along with this library; if not, write to the Free Software
|
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
19 * MA 02110-1301 USA
|
|
20 */
|
|
21
|
|
22 /**
|
|
23 * @class FuzzyTimelineGui
|
|
24 * FuzzyTimeline GUI Implementation
|
|
25 * @author Sebastian Kruse (skruse@mpiwg-berlin.mpg.de)
|
|
26 *
|
|
27 * @param {FuzzyTimelineWidget} parent FuzzyTimeline widget object
|
|
28 * @param {HTML object} div parent div to append the FuzzyTimeline gui
|
|
29 * @param {JSON} options FuzzyTimeline configuration
|
|
30 */
|
|
31 function FuzzyTimelineGui(fuzzyTimelineWidget, div, options) {
|
|
32
|
|
33 this.parent = fuzzyTimelineWidget;
|
|
34 var fuzzyTimelineGui = this;
|
|
35
|
|
36 this.fuzzyTimelineContainer = div;
|
|
37 //if no height is given, draw it in a 32/9 ratio
|
|
38 if ($(this.fuzzyTimelineContainer).height() === 0)
|
|
39 $(this.fuzzyTimelineContainer).height($(this.fuzzyTimelineContainer).width()*9/32);
|
|
40 //this.fuzzyTimelineContainer.style.position = 'relative';
|
|
41
|
|
42 this.sliderTable = document.createElement("table");
|
|
43 $(this.sliderTable).addClass("ddbToolbar");
|
|
44 $(this.sliderTable).width("100%");
|
|
45 $(this.sliderTable).height("49px");
|
|
46 div.appendChild(this.sliderTable);
|
|
47
|
|
48 this.plotDIVHeight = $(this.fuzzyTimelineContainer).height()-$(this.sliderTable).height();
|
|
49 var plotScrollContainer = $("<div></div>");
|
|
50 plotScrollContainer.css("overflow-x","auto");
|
|
51 plotScrollContainer.css("overflow-y","hidden");
|
|
52 plotScrollContainer.width("100%");
|
|
53 plotScrollContainer.height(this.plotDIVHeight);
|
|
54 $(div).append(plotScrollContainer);
|
|
55 this.plotDiv = document.createElement("div");
|
|
56 $(this.plotDiv).width("100%");
|
|
57 $(this.plotDiv).height(this.plotDIVHeight);
|
|
58 plotScrollContainer.append(this.plotDiv);
|
|
59 if (this.parent.options.showRangePiechart){
|
|
60 this.rangePiechartDiv = document.createElement("div");
|
|
61 $(this.rangePiechartDiv).css("float","right");
|
|
62 //alter plot div width (leave space for piechart)
|
|
63 $(this.plotDiv).width("75%");
|
|
64 $(this.rangePiechartDiv).width("25%");
|
|
65 $(this.rangePiechartDiv).height(plotDIVHeight);
|
|
66 div.appendChild(this.rangePiechartDiv);
|
|
67 }
|
|
68 };
|
|
69
|
|
70 FuzzyTimelineGui.prototype = {
|
|
71 }; |