| 33 | } |
| 34 | |
| 35 | export function getText(textId) { |
| 36 | const textarea = document.getElementById(textId) as HTMLTextAreaElement; |
| 37 | const text = textarea.value; |
| 38 | |
| 39 | const errorDiv = document.getElementById('error'); |
| 40 | const splitRight = document.getElementById('split-right'); |
| 41 | |
| 42 | try { |
| 43 | const spec = JSON.parse(text); |
| 44 | |
| 45 | splitRight.style.opacity = '1'; |
| 46 | errorDiv.style.display = 'none'; |
| 47 | update(spec); |
| 48 | } |
| 49 | catch (e) { |
| 50 | errorDiv.innerText = e; |
| 51 | errorDiv.style.display = ''; |
| 52 | splitRight.style.opacity = '0.1'; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | fetch('./specs/scatter3D.json') |
| 57 | .then(response => response.text()) |