1 | /*!
|
---|
2 | Styling for heuristiclab via jQuery
|
---|
3 | */
|
---|
4 |
|
---|
5 | function retrieveMatrix(id) {
|
---|
6 | var indexRegEx = /matrix-graph-(\d*)-(\d*)/g
|
---|
7 | var array = indexRegEx.exec(id)
|
---|
8 | if (array != null && array.length == 3) {
|
---|
9 | return { runId: array[1], parameterOffset: array[2] }
|
---|
10 | }
|
---|
11 | return null;
|
---|
12 | }
|
---|
13 |
|
---|
14 | function generatePlot(plotId, plotData) {
|
---|
15 | var seriesData = plotData.Series;
|
---|
16 | var showMarker = plotData.ShowMarker;
|
---|
17 | var labels = new Array(seriesData.length);
|
---|
18 | var series = new Array(seriesData.length);
|
---|
19 |
|
---|
20 | for (var i = 0; i < seriesData.length; i++) {
|
---|
21 | labels[i] = { label: seriesData[i].Label, showMarker : showMarker };
|
---|
22 | series[i] = seriesData[i].Values;
|
---|
23 | }
|
---|
24 |
|
---|
25 | return $.jqplot(plotId, series, {
|
---|
26 | cursor: {
|
---|
27 | show: true,
|
---|
28 | zoom: true,
|
---|
29 | showTooltip: false
|
---|
30 | },
|
---|
31 | series: labels,
|
---|
32 | legend: {
|
---|
33 | show: true,
|
---|
34 | placement: 'outsideGrid'
|
---|
35 | }
|
---|
36 | });
|
---|
37 | }
|
---|
38 |
|
---|
39 | $(document).ready(
|
---|
40 |
|
---|
41 | function () {
|
---|
42 |
|
---|
43 | /*
|
---|
44 | $('input:submit, input:reset').each(function () {
|
---|
45 | $(this).replaceWith('<button class="' + $(this).attr('class') + '" name="' + $(this).attr('name') + '" type="' + $(this).attr('type') + '">' + $(this).val() + '</button>');
|
---|
46 | });
|
---|
47 |
|
---|
48 |
|
---|
49 | $('.hl-dataTable').dataTable(
|
---|
50 | {
|
---|
51 | "bJQueryUI": true,
|
---|
52 | "sScrollX": "100%",
|
---|
53 |
|
---|
54 | }
|
---|
55 |
|
---|
56 | );
|
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|
60 | $(".hl-dataTable").addClass("display");
|
---|
61 |
|
---|
62 | $(".hl-button-text-plus").button({ icons: { primary: 'ui-icon-plus'} });
|
---|
63 | $(".hl-button-text-signon").button({ icons: { primary: 'ui-icon-key'} });
|
---|
64 | $(".hl-button-text-back").button({ icons: { primary: 'ui-icon-triangle-1-w'} });
|
---|
65 | $(".hl-icon-delete").button({ icons: { primary: 'ui-icon-close' }, text: false });
|
---|
66 | $(".hl-icon-edit").button({ icons: { primary: 'ui-icon-pencil' }, text: false });
|
---|
67 | $(".hl-icon-view").button({ icons: { primary: ' ui-icon-arrowthick-1-e' }, text: false });
|
---|
68 | $(".hl-icon-refresh").button({ icons: { primary: ' ui-icon-refresh' }, text: false });
|
---|
69 |
|
---|
70 | // Standard Table
|
---|
71 | $(".hl-table th").each(function () {
|
---|
72 |
|
---|
73 | $(this).addClass("ui-state-default hl-formHeader");
|
---|
74 |
|
---|
75 | });
|
---|
76 | $(".hl-table td").each(function () {
|
---|
77 |
|
---|
78 | $(this).addClass("ui-widget-content");
|
---|
79 |
|
---|
80 | });
|
---|
81 |
|
---|
82 | $(".hl-table td:odd").addClass("odd");
|
---|
83 | $(".hl-table td:even").addClass("even");
|
---|
84 | */
|
---|
85 | try {
|
---|
86 | $(".viewableTable").dataTable()
|
---|
87 | } catch (e) {
|
---|
88 | }
|
---|
89 |
|
---|
90 | try {
|
---|
91 | $(".editableTable").dataTable(
|
---|
92 | {
|
---|
93 | "bSort": false,
|
---|
94 | "bFilter": false
|
---|
95 | }
|
---|
96 | )
|
---|
97 | } catch (e) {
|
---|
98 | }
|
---|
99 |
|
---|
100 | try {
|
---|
101 | $(".tabable").tabs({
|
---|
102 | collapsible: true,
|
---|
103 | active: false
|
---|
104 | }
|
---|
105 | );
|
---|
106 | } catch (e) {
|
---|
107 | }
|
---|
108 |
|
---|
109 | try {
|
---|
110 | $(".collapsible").accordion("resize",
|
---|
111 | {
|
---|
112 | collapsible: true,
|
---|
113 | active: false
|
---|
114 | });
|
---|
115 | } catch (e) {
|
---|
116 | }
|
---|
117 |
|
---|
118 | try {
|
---|
119 | $(".delete-row").click(function () {
|
---|
120 | var row = $(this).closest("tr").get(0);
|
---|
121 | var dt = $(this).closest(".editableTable");
|
---|
122 | dt = dt.dataTable()
|
---|
123 | dt.fnDeleteRow(dt.fnGetPosition(row));
|
---|
124 | // TODO: Update the Ids of the next rows!!
|
---|
125 | });
|
---|
126 | } catch (e) {
|
---|
127 | }
|
---|
128 |
|
---|
129 | try {
|
---|
130 | $(".resizable").each(function (i) {
|
---|
131 | $(this).resizable();
|
---|
132 | });
|
---|
133 |
|
---|
134 | $(".matrix-graph").each(function (i) {
|
---|
135 | var tabable = $(this).closest(".tabable");
|
---|
136 | var id = this.id;
|
---|
137 | var resizerId = $(this).parent().get(0).id;
|
---|
138 | var indices = retrieveMatrix(id);
|
---|
139 |
|
---|
140 | $.ajax({
|
---|
141 | url: '/Chart/GetMatrixContentForGraph?run=' + indices.runId + '¶meterOffset=' + indices.parameterOffset + "&showMarker=false",
|
---|
142 |
|
---|
143 | success: function (result) {
|
---|
144 | var plot = generatePlot(id, result);
|
---|
145 | tabable.bind('tabsshow', function (event, ui) {
|
---|
146 | if (ui.index == 1 && plot._drawCount == 0) {
|
---|
147 | plot.replot();
|
---|
148 | }
|
---|
149 | });
|
---|
150 | var resizer = $("#"+id).closest('.resizable');
|
---|
151 | $(resizer).bind('resizestop', function (event, ui) {
|
---|
152 | var id = $(this).children('div').get(0).id;
|
---|
153 | $("#"+id).height($(this).height() * 0.96);
|
---|
154 | $("#" + id).width($(this).width() * 0.96);
|
---|
155 | plot.replot({ resetAxes: true });
|
---|
156 | });
|
---|
157 | },
|
---|
158 | error: function (jqXHR, textStatus, errorThrown) {
|
---|
159 | alert(textStatus);
|
---|
160 | alert(errorThrown);
|
---|
161 | }
|
---|
162 | });
|
---|
163 | });
|
---|
164 | } catch (e) {
|
---|
165 | }
|
---|
166 | }
|
---|
167 | );
|
---|
168 |
|
---|