Skip to content

Instantly share code, notes, and snippets.

@hvitorino
Created May 10, 2013 13:24
Show Gist options
  • Save hvitorino/5554358 to your computer and use it in GitHub Desktop.
Save hvitorino/5554358 to your computer and use it in GitHub Desktop.
App.Graficos.Pizza = function (elementoHtml) {
var self = this;
self.Opcoes = {
title : { text: 'Demitir funcionário?' },
legend: {
labelFormatter: function () {
return this.name + ": " + this.y;
}
},
plotOptions: { pie: { showInLegend: true } },
series : [
{
type: 'pie',
name: 'Total',
data: []
}
]
};
self.Votos = [];
self.Limpa = function () {
self.Votos = [];
self.Highchart.series[0].setData([], true);
};
self.NovoVoto = function (opcoes, total) {
self.Votos.push(new App.Voto(opcoes, total));
var novosDados = [];
for (var i = 0; i < self.Votos.length; i++)
novosDados.push(self.Votos[i]);
self.Highchart.series[0].setData(novosDados, true);
return self;
};
elementoHtml.highcharts(self.Opcoes);
self.Highchart = elementoHtml.highcharts();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment