Im trying to load informations from data.txt which has this files included.
<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>
Line 8-16 is in data.txt - What would be the best to replace it from the original file, and tell the script to load the information from data.txt?
I've tried something with from Google:
var url = "data.txt";
var locations = JSON.parse("[" + this.responseText + "]");
But uff, i cant get it working