Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can I not see a data value when hovering over a point on the radar chart?

I have created a Radar Chart using ChartJS as follows:

HTML:

<canvas id="radarChartTest" width="800" height="600"></canvas>
<script>
    radarChartTest(["A", "B", "C", "D"], [5, 10, 15, 20], document.getElementById("radarChartTest"));
</script>

JS:

function radarChartTest(categories, totals, chartToPopulate) {
    var chartDisplay = chartToPopulate;
    var newChart = new Chart(chartDisplay, {
        type: 'radar',
        data: {
            labels: categories,
            datasets: [
                {
                    data: totals,
                    label: "test"
                }
            ]
        }
    })
}

JSFiddle

The chart draws and populates fine. However, when I hover over a radar point, it does not display the value:

broken chart

There should be a number after test:.

I am expecting something similar to this:

working radar chart

Am I missing an attribute or something? I have checked the documentation but could not spot anything for it. I have also compared my code to where I found (a working example), but could not spot anything there either.

like image 695
August Williams Avatar asked Apr 13 '19 21:04

August Williams


1 Answers

This is due to a bug in the that version (2.8.0) of Chart.js (Values on Tooltip of Radar Chart is not shown).

You can fix it by upgrading to 2.9.0.

Updated working Fiddle with version 2.9.0

<script src="https://cdn.jsdelivr.net/npm/[email protected]"> </script>
like image 145
sheilak Avatar answered Sep 30 '22 10:09

sheilak