Bonjour,
Continuant ma progression et mon apprentissage je vous propose ce petit widget en espérantérant qu’il vous plaira et j’en profite pour rendre hommage à l’auteur de l’original ainsi que à tous les amis qui m’aide à mieux maitriser Jeedom ainsi que les high charts.
Voici le code:
<div class="Doc-#id# cmd tooltips cmd-widget #history# ptsCardinaux " title="" data-type="info" data-subtype="numeric" data-template="JaugeptsCardinaux" data-cmd_id="#id#" >
<div id="JaugeptsCardinaux#id#" style="width: 250px; height: 250px;"></div>
<script>
// Nom NAK Points Cardinaux
// Modification rajout et mise en couleur Par NAK le 04:02:2021
//apartir d'un creation JaugeAz par Olive 2020-02-06
// OPTIONS :
// aiguille couleur a choisir
// centre couleur a choisir
var chart#id#;
chart#id# = new Highcharts.Chart({
chart: {
renderTo: 'JaugeptsCardinaux#id#',
type: 'gauge',
backgroundColor: 'transparent',
plotBackgroundColor: null,
plotBackgroundImage: null,
plotBorderWidth: 0,
plotShadow: false,
spacingTop: 0,
spacingLeft: 0,
spacingRight: 0,
spacingBottom: 0
},
title: {
text: null
},
credits: {
enabled: false
},
pane: {
startAngle: 0,
endAngle: 360,
background: null
},
exporting : {
enabled: false
},
plotOptions: {
series: {
dataLabels: {
enabled: false
}
},
gauge: {
dial: {
backgroundColor: '#aiguille#'
},
pivot: {
backgroundColor: '#centre#'
}
}
},
yAxis: {
min: 0,
max: 360,
tickWidth: 2,
tickLength: 10,
tickInterval: 22.5,
lineWidth: 1,
labels: {
distance: -25,
formatter: function () {
if (this.value == 360) {
return '<span style="font-weight:bold !important;color:crimson !important;">N</span>';
} else if (this.value == 22.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">NNE</span>';
} else if (this.value == 45) {
return '<span style="font-weight:bold !important;color:dimgray !important;">NE</span>';
} else if (this.value == 67.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">ENE</span>';
} else if (this.value == 90) {
return '<span style="font-weight:bolder !important;color:orange !important;">E</span>';
} else if (this.value == 112.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">ESE</span>';
} else if (this.value == 135) {
return '<span style="font-weight:bold !important;color:dimgray !important;">SE</span>';
} else if (this.value == 157.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">SSE</span>';
} else if (this.value == 180) {
return '<span style="font-weight:bolder !important;color:royalblue !important;">S</span>';
} else if (this.value == 202.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">SSO</span>';
} else if (this.value == 225) {
return '<span style="font-weight:bold !important;color:dimgray !important;">SO</span>';
} else if (this.value == 247.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">OSO</span>';
} else if (this.value == 270) {
return '<span style="font-weight:bolder !important;color:darkorange !important;">O</span>';
} else if (this.value == 292.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">ONO</span>';
} else if (this.value == 315) {
return '<span style="font-weight:bold !important;color:dimgray !important;">NO</span>';
} else if (this.value == 337.5) {
return '<span style="font-weight:lighter; !important;color:silver !important;">NNO</span>';
}
}
},
title: {
text: '#unite#'
}
},
series: [{
name: '',
data: [0]
}]
});
jeedom.cmd.update['#id#'] = function(_options){
var valeur = parseFloat(_options.display_value);
var valeur2 = _options.collectDate;
chart#id#.series[0].data[0].update(valeur);
chart#id#.setTitle({ text: valeur, style: {
color: 'olivedrab',
fontSize: '20px'
}, y:177});
}
jeedom.cmd.update['#id#']({display_value:'#state#',valueDate:'#valueDate#',collectDate:'#collectDate#'});
</script>
</div>
Et les options d’affichage:
Ce widget n’est certainement pas parfait donc bienvenue à tout les remarques constructives.
![]()


