mardi 23 juin 2020

Automaticaly update html graphs from a spreadsheat

I'm currently working on a small project in which i want to integrate somes graphs of analyses from a lab in a website.

I have currently found how to create all my graphs but i wanted to know if there was a way of automaticaly update the graphs values from a spreadsheat instead of modifying each graph's code each time there is a new value,

Here an exemple of the graph's code i'm using

https://jsfiddle.net/tristanpm/06amekv4/5/

<html>
<head>
<title>My first chart using FusionCharts Suite XT</title>
<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest    /fusioncharts.js"></script>
<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<script type="text/javascript">
    FusionCharts.ready(function(){
        var chartObj = new FusionCharts({
type: 'scrollline2d',
dataFormat: 'json',
renderAt: 'chart-container',
width: '680',
height: '390',
dataSource: {
    "chart": {
        "theme": "fusion",
        "caption": "Evolution de l'azote total",
        "subCaption": "(Depuis 2019)",
        "xAxisName": "Mois",
        "yAxisName": "% mass MB",
        "numberPrefix": "",
        "yAxisMinValue": "5",
        "lineThickness": "3",
        "flatScrollBars": "1",
        "scrollheight": "10",
        "numVisiblePlot": "8",
        "showHoverEffect": "1"
    },
    "categories": [{
        "category": [{"label": "  13/06/2016  "},{"label": "  20/07/2016  "},{"label": "  13/09/2016  "},{"label": "  02/11/2016  "},{"label": "  12/12/2016  "},{"label": "  06/02/2017  "},{"label": "  18/04/2017  "},{"label": "  12/06/2017  "},{"label": "  24/08/2017  "},{"label": "  16/10/2017  "},{"label": "  04/12/2017  "},{"label": "  13/02/2018  "},{"label": "  09/04/2018  "},{"label": "  09/07/2018  "},{"label": "  20/08/2018  "},{"label": "  15/10/2018  "},{"label": "  18/12/2018  "},{"label": "  11/02/2019  "},{"label": "  08/04/2019  "},{"label": "  17/06/2019  "},{"label": "  19/08/2019  "},{"label": "  14/10/2019  "},
        ]
    }],
    "dataset": [{
        "data": [{"Value": "   "},{"Value": " 0.14  "},{"Value": " 0.17  "},{"Value": " 0.27  "},{"Value": " 0.3  "},{"Value": " 0.3  "},{"Value": " 0.28  "},{"Value": " 0.30975  "},{"Value": " 0.35  "},{"Value": " 0.32  "},{"Value": " 0.31  "},{"Value": " 0.25  "},{"Value": " 0.26  "},{"Value": " 0.28  "},{"Value": " 0.3  "},{"Value": " 0.36  "},{"Value": " 0.31  "},{"Value": " 0.33  "},{"Value": " 0.33  "},{"Value": " 0.28  "},{"Value": " 0.34  "},{"Value": " 0.33  "},]}]}});
        chartObj.render();
    });
</script>
</head>
<body>
    <div id="chart-container">FusionCharts XT will load here!</div>
</body>
```

Thank you for the help




Aucun commentaire:

Enregistrer un commentaire