So, I am trying plot more two chart using encapsulate function, I did this:
1 - I created a function with highchart:
Code: Select all
function pieChart(div_id, title, data){
// Radialize the colors
Highcharts.setOptions({
colors: Highcharts.map(Highcharts.getOptions().colors, function (color) {
return {
radialGradient: {
cx: 0.5,
cy: 0.3,
r: 0.7
},
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
]
};
})
});
// Build the chart
Highcharts.chart(div_id, {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: title
},
tooltip: {
pointFormat: '{series.name}: <b> {point.y}</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
},
connectorColor: 'silver'
}
}
},
series: [{
name: data.name,
type: 'pie',
data: data.data.map(function(x){
return {name: x.key, y: x.value}
})
}]
});
}
Code: Select all
pieChart("container_1", "Test_1", dados)
pieChart("container_2", "Test_2", dados_2)
Code: Select all
<div id="container_1" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
<div id="container_2" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>
[img]
https://drive.google.com/open?id=1KG154 ... SozyaAmoSU
[/img]
Can anybody help me, please?