Commit 8c018c53 authored by Caillat Michel's avatar Caillat Michel
Browse files

Fixed the most stupid typo which was preventing the spectrum from being drawn...

Fixed the most stupid typo which was preventing the spectrum from being drawn with the desired orientation
parent ec26bb5f
......@@ -420,7 +420,7 @@
}
function _onLoad(event) {
// Ici, this.readyState gale XMLHttpRequest.DONE .
// Ici, this.readyState gale XMLHttpRequest.DONE .
if (this.status === 200) {
console.log("Transfert done - " + this.responseText.length + "bytes.");
var _srcURI = "data:image/png," + this.responseText;
......@@ -1195,7 +1195,7 @@ var SAMPPNGPublishControl = (function (Control) {
},
connectgaps: 'true',
hoverinfo: 'x+y',
xaxis: 'x2'
xaxis: 'x'
};
let _frequencyMarker = {
......@@ -1210,7 +1210,7 @@ var SAMPPNGPublishControl = (function (Control) {
},
x : [],
y : [0.0],
xaxis : 'x2'
xaxis : 'x'
};
/*
......@@ -1228,7 +1228,7 @@ var SAMPPNGPublishControl = (function (Control) {
zeroline: true
},
xaxis2: {
xaxis: {
zeroline: false,
showgrid: true,
autotick : true,
......@@ -1426,7 +1426,7 @@ var SAMPPNGPublishControl = (function (Control) {
}
plotData.x = xData; // abscissa ( frequency, wavelength, velocity, ...);
console.log(JSON.stringify(plotData.x, 0, 4));
switch (_ctype3) {
case 'FREQ' :
if (_cdelt3 > 0) {
......@@ -1485,7 +1485,7 @@ var SAMPPNGPublishControl = (function (Control) {
}
<%}%>
plotData.xaxis = "x2";
plotData.xaxis = "x";
var maxVal = Math.max.apply(Math, plotData.y);
var minVal = Math.min.apply(Math, plotData.y);
......@@ -1496,9 +1496,10 @@ var SAMPPNGPublishControl = (function (Control) {
var layout = _frequencyLayout;
layout.title = toptitle;
layout.xaxis2.range = [plotData.x[0], plotData.x[plotData.x[length-1]]];
layout.xaxis.range = [plotData.x[0], plotData.x[plotData.x.length-1]];
console.log("------->" + JSON.stringify(layout.xaxis.range));
layout.yaxis.range = [minVal, maxVal];
layout.xaxis2.title = xtitle; //"Frequency (GHz) " + specsys;
layout.xaxis.title = xtitle; //"Frequency (GHz) " + specsys;
_itsGD.data = [plotData, _frequencyMarker];
_itsGD.layout = layout;
......@@ -1514,7 +1515,7 @@ var SAMPPNGPublishControl = (function (Control) {
** What's the behaviour of the plot after a click on the curve ?
*/
_itsGD.on('plotly_click', function(pdata) {
console.log("A click occurred in _itsGD : enter");
console.log("A click occurred on the spectrum : enter");
switch (_ctype3) {
case 'FREQ':
if (_cdelt3 > 0) {
......@@ -1562,7 +1563,7 @@ var SAMPPNGPublishControl = (function (Control) {
// 2) In the frequency-integrated flux grach
//Plotly.redraw(_gd);
console.log("A click occurred in _itsGD : exit");
console.log("A click occurred on the spectrum : exit");
});
var justRelayedout = false;
......@@ -1575,7 +1576,7 @@ var SAMPPNGPublishControl = (function (Control) {
if (pdata["dragmode"]==="select") {
;
}
else if (pdata["dragmode"]==="zoom") {
else if (pdata["dragmode"]==="zoom") {parseFloat
// We just clicked on the zoom button ... do nothing special
_itsGD.layout.dragmode = "select";
}
......@@ -1584,35 +1585,35 @@ var SAMPPNGPublishControl = (function (Control) {
}
else {
if (justRelayedout === false){
if ((pdata["xaxis2.range[0]"] === undefined) && (pdata["xaxis2.range[1]"] === undefined)) {
if ((pdata["xaxis.range[0]"] === undefined) && (pdata["xaxis.range[1]"] === undefined)) {
var frequencyUpdate = {
'xaxis2.autorange' : false,
'xaxis2.range' :[plotData.x[0], plotData.x[plotData.x.length - 1]],
'xaxis.autorange' : false,
'xaxis.range' :[plotData.x[0], plotData.x[plotData.x.length - 1]],
'yaxis.range' : [minVal, maxVal]
};
if ( _companion && _companion.getGD() ) {
var velocityUpdate = {
'xaxis2.autorange' : false,
'xaxis2.range' : [_companion.getGD().data[0].x[0], _companion.getGD().data[0].x[_companion.getGD().data[0].x.length-1]],
'xaxis.autorange' : false,
'xaxis.range' : [_companion.getGD().data[0].x[0], _companion.getGD().data[0].x[_companion.getGD().data[0].x.length-1]],
'yaxis.range' : [Math.min.apply(Math, _companion.getGD().data[0].y), Math.max.apply(Math, _companion.getGD().data[0].y)]
};
}
}
else {
var frequencyUpdate = {
'xaxis2.autorange' : false,
'xaxis2.range' : [pdata["xaxis2.range[0]"], pdata["xaxis2.range[1]"]],
'xaxis.autorange' : false,
'xaxis.range' : [pdata["xaxis.range[0]"], pdata["xaxis.range[1]"]],
'yaxis.range' : [minVal, maxVal]
};
if ( _companion && _companion.getGD() ) {
ivelocity0 = Math.round((pdata["xaxis2.range[0]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
ivelocity1 = Math.round((pdata["xaxis2.range[1]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
ivelocity0 = Math.round((pdata["xaxis.range[0]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
ivelocity1 = Math.round((pdata["xaxis.range[1]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
var velocityUpdate = {
'xaxis2.autorange' : false,
'xaxis2.range' : [_companion.getGD().data[0].x[ivelocity0], _companion.getGD().data[0].x[ivelocity1]],
'xaxis.autorange' : false,
'xaxis.range' : [_companion.getGD().data[0].x[ivelocity0], _companion.getGD().data[0].x[ivelocity1]],
'yaxis.range' : [Math.min.apply(Math, _companion.getGD().data[0].y), Math.max.apply(Math, _companion.getGD().data[0].y)]
};
}
......@@ -1689,7 +1690,7 @@ var SAMPPNGPublishControl = (function (Control) {
showgrid: true,
zeroline: true
},
xaxis2: {
xaxis: {
zeroline: false,
showgrid: true,
ticks: 'outside',
......@@ -1745,7 +1746,7 @@ var SAMPPNGPublishControl = (function (Control) {
size : 1
},
hoverinfo: 'x+y',
xaxis2 : 'x2'
xaxis : 'x'
};
let _frequencyPlot = {
......@@ -1760,7 +1761,7 @@ var SAMPPNGPublishControl = (function (Control) {
},
connectgaps: 'true',
hoverinfo: 'x+y',
xaxis: 'x2'
xaxis: 'x'
};
let _companion = null;
......@@ -1934,13 +1935,13 @@ var SAMPPNGPublishControl = (function (Control) {
var minVal = Math.min.apply(Math, plotData.y);
_layout.title = toptitle(summedAverageSpectrum/unitRescale(summedPixelsSpectrumUnit(_bunit)), toptitle_unit);
_layout.xaxis2.title = xtitle;
_layout.xaxis2.range = [plotData.x[0], plotData.x[plotData.x.length-1]];
_layout.xaxis2.tickvals = xIndexes;
_layout.xaxis2.tickmode = "auto";
_layout.xaxis.title = xtitle;
_layout.xaxis.range = [plotData.x[0], plotData.x[plotData.x.length-1]];
_layout.xaxis.tickvals = xIndexes;
_layout.xaxis.tickmode = "auto";
_layout.dragmode = "select";
_frequencyPlotBorder.xaxis = "x2";
_frequencyPlotBorder.xaxis = "x";
_frequencyPlotBorder.x = plotData.x;
_frequencyPlotBorder.y = Array.apply(null, Array(plotData.x.length)).map(function(x, i) { return plotData.y[i]; });
_frequencyPlotBorder.fill = 'tozeroy';
......@@ -1972,17 +1973,17 @@ var SAMPPNGPublishControl = (function (Control) {
else {
// We made another action... proceed accordingly.
if(justRelayedout === false) {
if ((pdata["xaxis2.range[0]"] === undefined) && (pdata["xaxis2.range[1]"] === undefined)) {
if ((pdata["xaxis.range[0]"] === undefined) && (pdata["xaxis.range[1]"] === undefined)) {
if (_companion && _companion.getGD()) {
var frequencyUpdate = {
'xaxis2.autorange' : false,
'xaxis2.range' :[_companion.getGD().data[0].x[0], _companion.getGD().data[0].x[_companion.getGD().data[0].x.length - 1]],
'xaxis.autorange' : false,
'xaxis.range' :[_companion.getGD().data[0].x[0], _companion.getGD().data[0].x[_companion.getGD().data[0].x.length - 1]],
'yaxis.range' : [Math.min.apply(Math, _companion.getGD().data[0].y), Math.max.apply(Math, _companion.getGD().data[0].y)]
};
}
var velocityUpdate = {
'xaxis2.autorange' : false,
'xaxis2.range' : [plotData.x[0], plotData.x[plotData.x.length-1]],
'xaxis.autorange' : false,
'xaxis.range' : [plotData.x[0], plotData.x[plotData.x.length-1]],
'yaxis.range[0]' : minVal,
'yaxis.range[1]' : maxVal
};
......@@ -1990,12 +1991,12 @@ var SAMPPNGPublishControl = (function (Control) {
else {
if (_companion && _companion.getGD()) {
ifrequency0 = Math.round((pdata["xaxis2.range[0]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
ifrequency1 = Math.round((pdata["xaxis2.range[1]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
ifrequency0 = Math.round((pdata["xaxis.range[0]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
ifrequency1 = Math.round((pdata["xaxis.range[1]"] - plotData.x[0])/(plotData.x[1] - plotData.x[0]));
var frequencyUpdate = {
'xaxis2.autorange' : false,
'xaxis2.range' : [_companion.getGD().data[0].x[ifrequency0], _companion.getGD().data[0].x[ifrequency1]],
'xaxis.autorange' : false,
'xaxis.range' : [_companion.getGD().data[0].x[ifrequency0], _companion.getGD().data[0].x[ifrequency1]],
'yaxis.range' : [Math.min.apply(Math, _companion.getGD().data[0].y), Math.max.apply(Math, _companion.getGD().data[0].y)]
};
}
......@@ -2037,8 +2038,8 @@ var SAMPPNGPublishControl = (function (Control) {
return;
}
var imin = Math.round((pdata["range"]["x2"][0] - plotData.x[0]) / (plotData.x[1]-plotData.x[0]));
var imax = Math.round((pdata["range"]["x2"][1] - plotData.x[0]) / (plotData.x[1]-plotData.x[0]));
var imin = Math.round((pdata["range"]["x"][0] - plotData.x[0]) / (plotData.x[1]-plotData.x[0]));
var imax = Math.round((pdata["range"]["x"][1] - plotData.x[0]) / (plotData.x[1]-plotData.x[0]));
_frequencyPlotBorder.x=range(imin, imax-imin+1).map( i => plotData.x[i]) ;
_frequencyPlotBorder.y=range(imin, imax-imin+1).map( i => plotData.y[i] );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment