var energy = []; var jpi = []; var Name; function GetData(){ Name = document.getElementById('isotopes_name').value; let maxEx = parseFloat(document.getElementById('maxEx').value); console.log(maxEx); let str = 'get_nuclear_data.py?isotopes_name=' + Name + "&maxEx=" + maxEx; let client = new XMLHttpRequest(); client.onreadystatechange = function() { let haha = client.responseText.split('\n').slice(17); jpi = []; energy = []; haha.forEach(line =>{ // console.log(line); if( line.includes(" fontSizeMeV) { count++; } } if (count === l) { noOverlap = true; } loop++; } for (let i = 0; i < l; i++) { fig.data.push({ x: [0, 1], y: [energy[i], energy[i]], mode: 'lines', line: { color: 'black', width: 1 } }); fig.data.push({ x: [1.03, 1.1, 1.19], y: [energy[i], ypos[i], ypos[i]], mode: 'lines', line: { color: 'gray', width: 1 } }); // console.log(energy[i]+ ", " + ypos[i]); fig.layout.annotations.push({ x: 1.2, y: ypos[i], text: `${energy[i].toFixed(3)}, ${jpi[i]}`, xanchor: 'left', font: { size: fontSize }, showarrow: false }); } // let NameYPos = (parseFloat(maxEx) + 2*fontSizeMeV); // console.log(NameYPos); fig.layout.annotations.push({ x: 0.5, y: (parseFloat(maxEx) + 0.5), text: Name, font: { size: 2 * fontSize }, showarrow: false }); // Create the plot Plotly.newPlot('Plot_Levels', fig.data, fig.layout); }