{
const data = radarData.map(d => ({
type: 'scatterpolar',
r: d.dati.map(s => s.value).concat(d.dati.map(s => s.value)[0]),
theta: d.dati.map(s => s.axis).concat(d.dati.map(s => s.axis)[0]),
name: d.nome,
visible: d.nome == "Toscana" ? true : 'legendonly',
opacity: 0.5,
line: {
width: 2,
shape: 'spline'
},
marker: {
size: 8
},
hovertemplate: '<b>%{theta}</b>' + '<br>%{r:.2f}<br>' + "<extra></extra>"
}));
const layout = {
width: width,
height: (width / 3) * 2,
polar: {
angularaxis: {
linewidth: 1,
color: 'gray',
showline: false
},
radialaxis: {
gridcolor: 'white',
gridwidth: 2,
visible: true,
range: [0, 1.05],
color: 'gray',
showline: false
},
bgcolor: 'rgb(245,245,245)'
}
};
const div = DOM.element('div');
Plotly.newPlot(div, data, layout);
return div;
}