const graph_div = document.getElementById("graph"); const command_div = document.getElementById("command"); function reload_graph () { console.log("yay"); const data = [...Array(100).keys()] .map((x) => x + 1) .map((x) => ({ lvl: x, duty_cycle: duty_cycle_map(x), freq: freq_map(x) })); const duty_cycles = data.map((row) => row.duty_cycle); const freqs = data.map((row) => row.freq); let config = { type: "line", data: { labels: data.map((row) => row.lvl), datasets: [ { label: "duty cycle", yAxisID: "y", data: duty_cycles }, { label: "freq", yAxisID: "freq_scale", data: freqs } ], }, options: { scales: { freq_scale: { type: "linear", position: "right", min: Math.min(...freqs), max: Math.max(...freqs) } } } }; console.log(config); const chart = new Chart(graph_div, config); //graph_div.innerHTML = "reloaded"; command_div.innerHTML = "MC" + generate_command() + "ER"; } function copy_command () { const item = new ClipboardItem({ "text/plain": command_div.innerHTML }); navigator.clipboard.write([item]); } reload_graph(); copy_command();