Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

using chartjs with Excel

$
0
0

I'm trying to use chartjs to create charts based on data I have in an excel (.xlsx) file. The data is in tidy format.

The following post gives an example: https://nagix.github.io/chartjs-plugin-datasource/

However it is not working for me. I can't see why.

<html>
<head>
</head>

<body>

<canvas id="myChart"></canvas>

<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script lang="javascript" src="dist/xlsx.full.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datasource"></script>

<script>

var ctx = document.getElementById('myChart').getContext('2d');

var chart = new Chart(ctx, {
    type: 'bar' ,
    plugins: [ChartDataSource],
    options: {
    datasource: {
        url: 'mydata.xlsx',
        rowMapping: 'datapoint',
         datapointLabelMapping: {

        _dataset: 'Date',

        _index: 'H1',

        x: 'H1',

        y: 'H2'
        }
        }
        }

        });

</script>


</body>
</html>

Viewing all articles
Browse latest Browse all 88835

Trending Articles