7604 |
25 Feb 19 |
nicklas |
/* $Id $ |
7604 |
25 Feb 19 |
nicklas |
2 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
Copyright (C) 2013 Nicklas Nordborg |
7604 |
25 Feb 19 |
nicklas |
4 |
|
7604 |
25 Feb 19 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
7604 |
25 Feb 19 |
nicklas |
Available at http://base.thep.lu.se/ |
7604 |
25 Feb 19 |
nicklas |
7 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is free software; you can redistribute it and/or |
7604 |
25 Feb 19 |
nicklas |
modify it under the terms of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
as published by the Free Software Foundation; either version 3 |
7604 |
25 Feb 19 |
nicklas |
of the License, or (at your option) any later version. |
7604 |
25 Feb 19 |
nicklas |
12 |
|
7604 |
25 Feb 19 |
nicklas |
BASE is distributed in the hope that it will be useful, |
7604 |
25 Feb 19 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7604 |
25 Feb 19 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7604 |
25 Feb 19 |
nicklas |
GNU General Public License for more details. |
7604 |
25 Feb 19 |
nicklas |
17 |
|
7604 |
25 Feb 19 |
nicklas |
You should have received a copy of the GNU General Public License |
7604 |
25 Feb 19 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
7604 |
25 Feb 19 |
nicklas |
20 |
------------------------------------------------------------------ |
7604 |
25 Feb 19 |
nicklas |
21 |
|
7604 |
25 Feb 19 |
nicklas |
@author Nicklas |
7604 |
25 Feb 19 |
nicklas |
23 |
*/ |
7604 |
25 Feb 19 |
nicklas |
'use strict'; |
7604 |
25 Feb 19 |
nicklas |
25 |
|
7604 |
25 Feb 19 |
nicklas |
var Plotter = function() |
7604 |
25 Feb 19 |
nicklas |
27 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plotter = {}; |
7604 |
25 Feb 19 |
nicklas |
29 |
|
7604 |
25 Feb 19 |
nicklas |
30 |
/** |
7604 |
25 Feb 19 |
nicklas |
Initialize the page. |
7604 |
25 Feb 19 |
nicklas |
32 |
*/ |
7604 |
25 Feb 19 |
nicklas |
plotter.initPage = function() |
7604 |
25 Feb 19 |
nicklas |
34 |
{ |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('close', App.closeWindow); |
7604 |
25 Feb 19 |
nicklas |
36 |
|
7604 |
25 Feb 19 |
nicklas |
// Plot size |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('width', 'keypress', Events.integerOnly); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('height', 'keypress', Events.integerOnly); |
7604 |
25 Feb 19 |
nicklas |
40 |
|
7604 |
25 Feb 19 |
nicklas |
// Aggregate |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('yAggregateCount', 'click', plotter.aggregateOnChange); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('yAggregateMean', 'click', plotter.aggregateOnChange); |
7604 |
25 Feb 19 |
nicklas |
44 |
|
7604 |
25 Feb 19 |
nicklas |
// Plot type |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('plotTypeScatter', 'change', plotter.plotTypeOnChange); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('plotTypeHistogram', 'change', plotter.plotTypeOnChange); |
7604 |
25 Feb 19 |
nicklas |
plotter.plotTypeOnChange(); |
7604 |
25 Feb 19 |
nicklas |
49 |
|
7604 |
25 Feb 19 |
nicklas |
// Annotations |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('annotationPresets', 'change', plotter.annotationOnChange); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler('annotationExp', 'change', plotter.annotationExpressionOnChange); |
7604 |
25 Feb 19 |
nicklas |
53 |
|
7604 |
25 Feb 19 |
nicklas |
// Buttons |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnPreviewPlot', plotter.previewPlot); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnViewPlot', plotter.viewPlot); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnDownloadPlot', plotter.downloadPlot); |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler('btnSavePlot', plotter.savePlotAs); |
7604 |
25 Feb 19 |
nicklas |
59 |
|
7604 |
25 Feb 19 |
nicklas |
60 |
} |
7604 |
25 Feb 19 |
nicklas |
61 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.initElements = function(element, autoInit) |
7604 |
25 Feb 19 |
nicklas |
63 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (autoInit == 'formula-presets') |
7604 |
25 Feb 19 |
nicklas |
65 |
{ |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(element, 'change', plotter.presetOnChange); |
7604 |
25 Feb 19 |
nicklas |
67 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (autoInit == 'expression-builder') |
7604 |
25 Feb 19 |
nicklas |
69 |
{ |
7604 |
25 Feb 19 |
nicklas |
Buttons.addClickHandler(element, plotter.openExpressionBuilder); |
7604 |
25 Feb 19 |
nicklas |
71 |
} |
7604 |
25 Feb 19 |
nicklas |
72 |
} |
7604 |
25 Feb 19 |
nicklas |
73 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.getPlotType = function() |
7604 |
25 Feb 19 |
nicklas |
75 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
return Forms.getCheckedRadio(frm.plotType).value; |
7604 |
25 Feb 19 |
nicklas |
78 |
} |
7604 |
25 Feb 19 |
nicklas |
79 |
|
7604 |
25 Feb 19 |
nicklas |
80 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.validateParameters = function() |
7604 |
25 Feb 19 |
nicklas |
82 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plotType = plotter.getPlotType(); |
7604 |
25 Feb 19 |
nicklas |
if (plotType == 'scatter') |
7604 |
25 Feb 19 |
nicklas |
85 |
{ |
7604 |
25 Feb 19 |
nicklas |
return plotter.validateScatterPlot(); |
7604 |
25 Feb 19 |
nicklas |
87 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (plotType == 'histogram') |
7604 |
25 Feb 19 |
nicklas |
89 |
{ |
7604 |
25 Feb 19 |
nicklas |
return plotter.validateHistogramPlot(); |
7604 |
25 Feb 19 |
nicklas |
91 |
} |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
93 |
} |
7604 |
25 Feb 19 |
nicklas |
94 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.validateScatterPlot = function() |
7604 |
25 Feb 19 |
nicklas |
96 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.yFormulaScatter.value) == '') |
7604 |
25 Feb 19 |
nicklas |
99 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.yFormulaScatter, 'You must enter an expression for the Y axis'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
102 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (Strings.trim(frm.xFormulaScatter.value) == '') |
7604 |
25 Feb 19 |
nicklas |
104 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.xFormulaScatter, 'You must enter an expression for the X axis'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
107 |
} |
7604 |
25 Feb 19 |
nicklas |
return true; |
7604 |
25 Feb 19 |
nicklas |
109 |
} |
7604 |
25 Feb 19 |
nicklas |
110 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.validateHistogramPlot = function() |
7604 |
25 Feb 19 |
nicklas |
112 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
var yAggregate = Forms.getCheckedRadio(frm.yAggregate).value; |
7604 |
25 Feb 19 |
nicklas |
if (Strings.trim(frm.xFormulaHistogram.value) == '') |
7604 |
25 Feb 19 |
nicklas |
116 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.xFormulaHistogram, 'You must enter an expression for the X axis'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
119 |
} |
7604 |
25 Feb 19 |
nicklas |
else if (yAggregate != 'count' && Strings.trim(frm.yFormulaHistogram.value) == '') |
7604 |
25 Feb 19 |
nicklas |
121 |
{ |
7604 |
25 Feb 19 |
nicklas |
Forms.showNotification(frm.yFormulaHistogram, 'You must enter an expression for the Y axis'); |
7604 |
25 Feb 19 |
nicklas |
return false; |
7604 |
25 Feb 19 |
nicklas |
124 |
} |
7604 |
25 Feb 19 |
nicklas |
return true; |
7604 |
25 Feb 19 |
nicklas |
126 |
} |
7604 |
25 Feb 19 |
nicklas |
127 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.plotTypeOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
129 |
{ |
7604 |
25 Feb 19 |
nicklas |
var isScatter = plotter.getPlotType() == 'scatter'; |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('scatterSection', isScatter); |
7604 |
25 Feb 19 |
nicklas |
Doc.showHide('histogramSection', !isScatter); |
7604 |
25 Feb 19 |
nicklas |
133 |
} |
7604 |
25 Feb 19 |
nicklas |
134 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.presetOnChange = function(event) |
7604 |
25 Feb 19 |
nicklas |
136 |
{ |
7604 |
25 Feb 19 |
nicklas |
var list = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
var selected = list[list.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
139 |
|
7604 |
25 Feb 19 |
nicklas |
var formulaField = Data.get(list, 'formula-id'); |
7604 |
25 Feb 19 |
nicklas |
Doc.element(formulaField).value = selected.value; |
7604 |
25 Feb 19 |
nicklas |
142 |
|
7604 |
25 Feb 19 |
nicklas |
var labelField = Data.get(list, 'label-id'); |
7604 |
25 Feb 19 |
nicklas |
if (labelField && selected.value != '') Doc.element(labelField).value = selected.text; |
7604 |
25 Feb 19 |
nicklas |
list.selectedIndex = 0; |
7604 |
25 Feb 19 |
nicklas |
146 |
} |
7604 |
25 Feb 19 |
nicklas |
147 |
|
7604 |
25 Feb 19 |
nicklas |
148 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.openExpressionBuilder = function(event) |
7604 |
25 Feb 19 |
nicklas |
150 |
{ |
7604 |
25 Feb 19 |
nicklas |
var formulaField = Doc.element(Data.get(event.currentTarget, 'formula-id')); |
7604 |
25 Feb 19 |
nicklas |
152 |
|
7604 |
25 Feb 19 |
nicklas |
if (!formulaField.disabled) |
7604 |
25 Feb 19 |
nicklas |
154 |
{ |
7604 |
25 Feb 19 |
nicklas |
var title = Data.get(event.currentTarget, 'title'); |
7604 |
25 Feb 19 |
nicklas |
var formulaType = Data.get(event.currentTarget, 'formula-type'); |
7604 |
25 Feb 19 |
nicklas |
var rawDataType = Data.get(event.currentTarget, 'raw-data-type'); |
7604 |
25 Feb 19 |
nicklas |
var channels = Data.int(event.currentTarget, 'channels'); |
7604 |
25 Feb 19 |
nicklas |
var bioAssaySetId = Data.int(event.currentTarget, 'bioassayset'); |
7604 |
25 Feb 19 |
nicklas |
160 |
|
7604 |
25 Feb 19 |
nicklas |
Dialogs.openExpressionBuilder(formulaField, title, formulaType, rawDataType, channels, bioAssaySetId); |
7604 |
25 Feb 19 |
nicklas |
162 |
} |
7604 |
25 Feb 19 |
nicklas |
163 |
} |
7604 |
25 Feb 19 |
nicklas |
164 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.aggregateOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
166 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
var selected = Forms.getCheckedRadio(frm.yAggregate); |
7604 |
25 Feb 19 |
nicklas |
var isCount = selected.value == 'count'; |
7604 |
25 Feb 19 |
nicklas |
frm.yFormulaHistogram.disabled = isCount; |
7604 |
25 Feb 19 |
nicklas |
frm.yPresetsHistogram.disabled = isCount; |
7604 |
25 Feb 19 |
nicklas |
frm.yLogHistogram.disabled = isCount; |
7604 |
25 Feb 19 |
nicklas |
for (var i = 0; i < frm.hiloAggregate.length; i++) |
7604 |
25 Feb 19 |
nicklas |
174 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.hiloAggregate[i].disabled = isCount; |
7604 |
25 Feb 19 |
nicklas |
176 |
} |
7604 |
25 Feb 19 |
nicklas |
if (isCount) |
7604 |
25 Feb 19 |
nicklas |
178 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.removeClass(frm.yFormulaHistogram, 'required'); |
7604 |
25 Feb 19 |
nicklas |
frm.yLabelHistogram.value = 'Count'; |
7604 |
25 Feb 19 |
nicklas |
181 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
183 |
{ |
7604 |
25 Feb 19 |
nicklas |
Doc.addClass(frm.yFormulaHistogram, 'required'); |
7604 |
25 Feb 19 |
nicklas |
var yPreset = frm.yPresetsHistogram[frm.yPresetsHistogram.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
if (yPreset.value != '') frm.yLabelHistogram.value = yPresetHistogram.text; |
7604 |
25 Feb 19 |
nicklas |
187 |
} |
7604 |
25 Feb 19 |
nicklas |
188 |
} |
7604 |
25 Feb 19 |
nicklas |
189 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.annotationOnChange = function(event) |
7604 |
25 Feb 19 |
nicklas |
191 |
{ |
7604 |
25 Feb 19 |
nicklas |
var list = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
var selected = list[list.selectedIndex]; |
7604 |
25 Feb 19 |
nicklas |
var value = selected.value && selected.value != '$' ? selected.text : ''; |
7604 |
25 Feb 19 |
nicklas |
value = value.replace('\[A\] ', ''); |
7604 |
25 Feb 19 |
nicklas |
frm.subTitle.value = value; |
7604 |
25 Feb 19 |
nicklas |
198 |
|
7604 |
25 Feb 19 |
nicklas |
if (selected.value.substring(0, 1) == '$') |
7604 |
25 Feb 19 |
nicklas |
200 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.annotationExp.disabled = true; |
7604 |
25 Feb 19 |
nicklas |
202 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
204 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (selected.value) |
7604 |
25 Feb 19 |
nicklas |
206 |
{ |
7604 |
25 Feb 19 |
nicklas |
frm.annotationExp.value = selected.value; |
7604 |
25 Feb 19 |
nicklas |
208 |
} |
7604 |
25 Feb 19 |
nicklas |
frm.annotationExp.disabled = false; |
7604 |
25 Feb 19 |
nicklas |
frm.annotationExp.focus(); |
7604 |
25 Feb 19 |
nicklas |
211 |
} |
7604 |
25 Feb 19 |
nicklas |
212 |
} |
7604 |
25 Feb 19 |
nicklas |
213 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.annotationExpressionOnChange = function() |
7604 |
25 Feb 19 |
nicklas |
215 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
frm.annotationPresets.selectedIndex = frm.annotationPresets.length-1; |
7604 |
25 Feb 19 |
nicklas |
218 |
} |
7604 |
25 Feb 19 |
nicklas |
219 |
|
7604 |
25 Feb 19 |
nicklas |
220 |
|
7604 |
25 Feb 19 |
nicklas |
221 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.generatePlotUrl = function(fullSize) |
7604 |
25 Feb 19 |
nicklas |
223 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (plotter.validateParameters()) |
7604 |
25 Feb 19 |
nicklas |
225 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
var url = 'plot?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&bioassayset_id='+Data.get('page-data', 'bioassayset'); |
7604 |
25 Feb 19 |
nicklas |
url += '&bioassay_id='+Data.get('page-data', 'bioassay'); |
7604 |
25 Feb 19 |
nicklas |
url += '&title='+encodeURIComponent(frm.title.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&subTitle='+encodeURIComponent(frm.subTitle.value); |
7604 |
25 Feb 19 |
nicklas |
if (fullSize) |
7604 |
25 Feb 19 |
nicklas |
233 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&width='+frm.width.value; |
7604 |
25 Feb 19 |
nicklas |
url += '&height='+frm.height.value; |
7604 |
25 Feb 19 |
nicklas |
236 |
} |
7604 |
25 Feb 19 |
nicklas |
237 |
|
7604 |
25 Feb 19 |
nicklas |
if (frm.filter.value != '') |
7604 |
25 Feb 19 |
nicklas |
239 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&filter='+encodeURIComponent(frm.filter.value); |
7604 |
25 Feb 19 |
nicklas |
241 |
} |
7604 |
25 Feb 19 |
nicklas |
242 |
|
7604 |
25 Feb 19 |
nicklas |
var annotation = ''; |
7604 |
25 Feb 19 |
nicklas |
if (!frm.annotationExp.disabled) |
7604 |
25 Feb 19 |
nicklas |
245 |
{ |
7604 |
25 Feb 19 |
nicklas |
if (frm.annotationExp.value) |
7604 |
25 Feb 19 |
nicklas |
247 |
{ |
7604 |
25 Feb 19 |
nicklas |
annotation = '=' + frm.annotationExp.value; |
7604 |
25 Feb 19 |
nicklas |
249 |
} |
7604 |
25 Feb 19 |
nicklas |
250 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
252 |
{ |
7604 |
25 Feb 19 |
nicklas |
annotation = frm.annotationPresets.value.substring(1); |
7604 |
25 Feb 19 |
nicklas |
254 |
} |
7604 |
25 Feb 19 |
nicklas |
if (annotation) |
7604 |
25 Feb 19 |
nicklas |
256 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&annotation='+encodeURIComponent(annotation); |
7604 |
25 Feb 19 |
nicklas |
258 |
} |
7604 |
25 Feb 19 |
nicklas |
259 |
|
7604 |
25 Feb 19 |
nicklas |
var plotType = plotter.getPlotType(); |
7604 |
25 Feb 19 |
nicklas |
if (plotType == 'scatter') |
7604 |
25 Feb 19 |
nicklas |
262 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&type=scatter'; |
7604 |
25 Feb 19 |
nicklas |
url += '&x='+encodeURIComponent(frm.xFormulaScatter.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&xLabel='+encodeURIComponent(frm.xLabelScatter.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&xLog='+(frm.xLogScatter.checked ? 1 : 0); |
7604 |
25 Feb 19 |
nicklas |
url += '&y='+encodeURIComponent(frm.yFormulaScatter.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&yLabel='+encodeURIComponent(frm.yLabelScatter.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&yLog='+(frm.yLogScatter.checked ? 1 : 0); |
7604 |
25 Feb 19 |
nicklas |
270 |
} |
7604 |
25 Feb 19 |
nicklas |
else |
7604 |
25 Feb 19 |
nicklas |
272 |
{ |
7604 |
25 Feb 19 |
nicklas |
var yAggregate = Forms.getCheckedRadio(frm.yAggregate).value; |
7604 |
25 Feb 19 |
nicklas |
url += '&type=histogram'; |
7604 |
25 Feb 19 |
nicklas |
url += '&x='+encodeURIComponent(frm.xFormulaHistogram.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&xLabel='+encodeURIComponent(frm.xLabelHistogram.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&xLog='+(frm.xLogHistogram.checked ? 1 : 0); |
7604 |
25 Feb 19 |
nicklas |
url += '&binSize='+encodeURIComponent(frm.binSize.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&yAggregate='+yAggregate; |
7604 |
25 Feb 19 |
nicklas |
url += '&yLabel='+encodeURIComponent(frm.yLabelHistogram.value); |
7604 |
25 Feb 19 |
nicklas |
if (yAggregate != 'count') |
7604 |
25 Feb 19 |
nicklas |
282 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&y='+encodeURIComponent(frm.yFormulaHistogram.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&yLog='+(frm.yLogHistogram.checked ? 1 : 0); |
7604 |
25 Feb 19 |
nicklas |
url += '&hiloAggregate='+Forms.getCheckedRadio(frm.hiloAggregate).value |
7604 |
25 Feb 19 |
nicklas |
286 |
} |
7604 |
25 Feb 19 |
nicklas |
287 |
} |
7604 |
25 Feb 19 |
nicklas |
return url; |
7604 |
25 Feb 19 |
nicklas |
289 |
} |
7604 |
25 Feb 19 |
nicklas |
290 |
} |
7604 |
25 Feb 19 |
nicklas |
291 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.previewPlot = function() |
7604 |
25 Feb 19 |
nicklas |
293 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = plotter.generatePlotUrl(false); |
7604 |
25 Feb 19 |
nicklas |
if (url) |
7604 |
25 Feb 19 |
nicklas |
296 |
{ |
7604 |
25 Feb 19 |
nicklas |
url += '&width=540&height=360'; |
7604 |
25 Feb 19 |
nicklas |
298 |
|
7604 |
25 Feb 19 |
nicklas |
var overlayImg = Doc.element('overlay'); |
7604 |
25 Feb 19 |
nicklas |
overlayImg.src = App.getRoot()+'images/plot_generating.gif'; |
7604 |
25 Feb 19 |
nicklas |
301 |
|
7604 |
25 Feb 19 |
nicklas |
var tmpPlot = new Image(); |
7604 |
25 Feb 19 |
nicklas |
Events.addEventHandler(tmpPlot, 'load', plotter.previewLoaded); |
7604 |
25 Feb 19 |
nicklas |
tmpPlot.src = url; |
7604 |
25 Feb 19 |
nicklas |
305 |
} |
7604 |
25 Feb 19 |
nicklas |
306 |
} |
7604 |
25 Feb 19 |
nicklas |
307 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.previewLoaded = function(event) |
7604 |
25 Feb 19 |
nicklas |
309 |
{ |
7604 |
25 Feb 19 |
nicklas |
var tmpPlot = event.currentTarget; |
7604 |
25 Feb 19 |
nicklas |
311 |
|
7604 |
25 Feb 19 |
nicklas |
var previewImg = Doc.element('preview'); |
7604 |
25 Feb 19 |
nicklas |
previewImg.src = tmpPlot.src; |
7604 |
25 Feb 19 |
nicklas |
314 |
|
7604 |
25 Feb 19 |
nicklas |
var overlayImg = Doc.element('overlay'); |
7604 |
25 Feb 19 |
nicklas |
overlayImg.src = App.getRoot() + 'images/blankbutton.gif'; |
7604 |
25 Feb 19 |
nicklas |
317 |
} |
7604 |
25 Feb 19 |
nicklas |
318 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.viewPlot = function() |
7604 |
25 Feb 19 |
nicklas |
320 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plotUrl = plotter.generatePlotUrl(true); |
7604 |
25 Feb 19 |
nicklas |
if (plotUrl) |
7604 |
25 Feb 19 |
nicklas |
323 |
{ |
7604 |
25 Feb 19 |
nicklas |
var frm = document.forms['plot']; |
7604 |
25 Feb 19 |
nicklas |
var width = parseInt(frm.width.value); |
7604 |
25 Feb 19 |
nicklas |
var height = parseInt(frm.height.value); |
7604 |
25 Feb 19 |
nicklas |
if (!width || width < 600) width = 600; |
7604 |
25 Feb 19 |
nicklas |
if (!height || height < 400) height = 400; |
7604 |
25 Feb 19 |
nicklas |
var url = 'view.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&title='+encodeURIComponent(frm.title.value); |
7604 |
25 Feb 19 |
nicklas |
url += '&plot='+encodeURIComponent(plotUrl); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.openPopup(url, 'ViewPlot', width+150, height+100); |
7604 |
25 Feb 19 |
nicklas |
333 |
} |
7604 |
25 Feb 19 |
nicklas |
334 |
} |
7604 |
25 Feb 19 |
nicklas |
335 |
|
7604 |
25 Feb 19 |
nicklas |
336 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.downloadPlot = function() |
7604 |
25 Feb 19 |
nicklas |
338 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plotUrl = plotter.generatePlotUrl(true); |
7604 |
25 Feb 19 |
nicklas |
if (plotUrl) |
7604 |
25 Feb 19 |
nicklas |
341 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = 'download.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&plot='+encodeURIComponent(plotUrl); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.openPopup(url, 'DownloadPlot', 300, 200); |
7604 |
25 Feb 19 |
nicklas |
345 |
} |
7604 |
25 Feb 19 |
nicklas |
346 |
} |
7604 |
25 Feb 19 |
nicklas |
347 |
|
7604 |
25 Feb 19 |
nicklas |
plotter.savePlotAs = function() |
7604 |
25 Feb 19 |
nicklas |
349 |
{ |
7604 |
25 Feb 19 |
nicklas |
var plotUrl = plotter.generatePlotUrl(true); |
7604 |
25 Feb 19 |
nicklas |
if (plotUrl) |
7604 |
25 Feb 19 |
nicklas |
352 |
{ |
7604 |
25 Feb 19 |
nicklas |
var url = 'save_as.jsp?ID='+App.getSessionId(); |
7604 |
25 Feb 19 |
nicklas |
url += '&plot='+encodeURIComponent(plotUrl); |
7604 |
25 Feb 19 |
nicklas |
Dialogs.openPopup(url, 'SavePlotAs', 450, 300); |
7604 |
25 Feb 19 |
nicklas |
356 |
} |
7604 |
25 Feb 19 |
nicklas |
357 |
} |
7604 |
25 Feb 19 |
nicklas |
358 |
|
7604 |
25 Feb 19 |
nicklas |
359 |
|
7604 |
25 Feb 19 |
nicklas |
return plotter; |
7604 |
25 Feb 19 |
nicklas |
361 |
}(); |
7604 |
25 Feb 19 |
nicklas |
362 |
|
7604 |
25 Feb 19 |
nicklas |
Doc.onLoad(Plotter.initPage); |
7604 |
25 Feb 19 |
nicklas |
Doc.addElementInitializer(Plotter.initElements); |
7604 |
25 Feb 19 |
nicklas |
365 |
|