<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<button onclick="build()">Click me</button>
<div id="container"></div>
<textarea id="chartCode" name="w3review" cols="30" rows="15" >
{
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}],
exporting: {
sourceWidth: 900,
sourceHeight: 400,
}
}
</textarea>
const chart = document.getElementById('chartCode').textContent
console.log(chart)
Highcharts.chart('container', chart);
I'm trying to make a simple page where you add this section of the highcharts code into the textarea and click build and the chart will build with the code you input. I think it has to do with .textContent being a string.
https://jsfiddle.net/b2p7nrLc/3/
I using other methods to build the chart but could not get it working