Estoy tratando de cargar información de data.txt que tiene estos archivos incluidos.
<script> google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Datum', 'E5 (SUPER)', 'E10 (SUPER)', 'B7 (DIESEL)'], ['01.11.2021', 1.12, 1.49, 1.50], ['02.11.2021', 1.18, 1.52, 1.55], ['03.11.2021', 1.22, 1.55, 1.70], ['04.11.2021', 1.25, 1.30, 1.75], ['05.11.2021', 1.26, 1.61, 1.79], ['06.11.2021', 1.30, 1.70, 1.85], ['07.11.2021', 1.40, 1.81, 1.95], ['08.11.2021', 1.45, 1.85, 1.99], ['09.11.2021', 1.53, 1.90, 2.00] ]); var options = { title: 'Preisentwicklung', hAxis: {title: '', titleTextStyle: {color: '#333'}}, vAxis: {minValue: 1.0} }; var chart = new google.visualization.AreaChart(document.getElementById('chart_div')); chart.draw(data, options); } </script>La línea 8-16 está en data.txt. ¿Qué sería lo mejor para reemplazarlo del archivo original y decirle al script que cargue la información de data.txt?
He intentado algo con Google:
var url = "data.txt"; var locations = JSON.parse("[" + this.responseText + "]");Pero uff, no puedo hacerlo funcionar