Created
May 10, 2013 13:24
-
-
Save hvitorino/5554358 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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