calagan57 BF3 : calagan57 | Bon en fouinant sur le site highcharts je pense avoir trouvé le type de graphique que je recherche :
https://www.highcharts.com/demo/col [...] dark-unica
Cela permettra d'avoir une barre qui additionne les 4 valeurs de puissance récupérées (3 positives en consommation et une négative en production)
Il faut maintenant :
- créer 4 var ID"" pour les 4 mesures
- Axe des abscisses X échelle de temps suivant les dates d'acquisition des valeurs
- Axe des ordonnées Y "dynamique échelle qui varie en positif/négatif (production/consommation) en fonction des valeurs des barres
- possibilité de choisir l'échelle du grah (heure, jour,semine,année..)
Code :
- <script src="https://code.highcharts.com/highcharts.js"></script>
- <script src="https://code.highcharts.com/modules/exporting.js"></script>
- <script src="https://code.highcharts.com/modules/export-data.js"></script>
- <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
- Highcharts.chart('container', {
- chart: {
- type: 'column'
- },
- title: {
- text: 'Stacked column chart'
- },
- xAxis: {
- categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
- },
- yAxis: {
- min: 0,
- title: {
- text: 'Total fruit consumption'
- },
- stackLabels: {
- enabled: true,
- style: {
- fontWeight: 'bold',
- color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
- }
- }
- },
- legend: {
- align: 'right',
- x: -30,
- verticalAlign: 'top',
- y: 25,
- floating: true,
- backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
- borderColor: '#CCC',
- borderWidth: 1,
- shadow: false
- },
- tooltip: {
- headerFormat: '<b>{point.x}</b><br/>',
- pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
- },
- plotOptions: {
- column: {
- stacking: 'normal',
- dataLabels: {
- enabled: true,
- color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
- }
- }
- },
- series: [{
- name: 'John',
- data: [5, 3, 4, 7, 2]
- }, {
- name: 'Jane',
- data: [2, 2, 3, 2, 1]
- }, {
- name: 'Joe',
- data: [3, 4, 4, 2, 5]
- }]
- });
|
Alors vous en pensez quoi? Faisable ou impossible pour un noob comme moi? merci à vous! ---------------
Waterbox
|