document.barChart function ladeStatistikRangliste () { $.ajax({ url: '../index.php', type: 'GET', data: { application: 'loadstatistiktangliste', tournament: $('#tournament_rangliste').val() }, dataType: 'json' }).done(function (response) { barChart.data = response barChart.update() }) } $(document).ready(function () { const ctx = document.getElementById('dotterStatistikRangliste') barChart = new Chart(ctx, { type: 'bar', data: [], options: { animation: { y: { duration: 2000, from: 500 } }, indexAxis: 'y', maintainAspectRatio: true, scaleShowValues: true, responsive: true, elements: { bar: { borderWidth: 2 } }, plugins: { legend: { display: true, position: 'right', color: '#cecece' } }, scales: { x: { title: { display: true, text: 'Punkte', color: '#cecece' } }, y: { title: { display: true, text: 'Athlet:innen', color: '#cecece' }, ticks: { autoSkip: false } } } } }) ladeStatistikRangliste() })