Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //----------------------------------------Gerando Chart de Relatório Bolsa Por Ano
- $scope.gerarGraficoBolsaPorOrientador = function gerarGraficoBolsaPorProfessor(ano_inicial,ano_final,departamento){
- //busca dados
- var rows = [];
- var data = { ano_inicial: ano_inicial ,
- ano_final: ano_final,
- departamento: departamento };
- $http.post('get_chart_relatorio_bolsa_por_orientador', data).then(function(resposta){
- if (resposta.data.status === "error"){
- toastr["error"]('', resposta.data.message);
- }
- for (var i in resposta.data){
- rows.push({
- c: [resposta.data[i]]
- });
- }
- //desenha Chart
- $scope.chartRelatorioProjetoPorOrientador = {};
- $scope.chartRelatorioProjetoPorOrientador.type = "BarChart";
- $scope.chartRelatorioProjetoPorOrientador.options = {
- 'title': 'Gráfico de barra: Bolsas por orientador',
- colors: ['#ff0000', 'red blue gabriel'],
- legend:{position: 'bottom'},
- chartArea: {width: '50%'},
- hAxis: {
- title: 'Quantidade de bolsas por orientador',
- minValue: 0,
- textStyle: {
- bold: true,
- fontSize: 12,
- color: '#4d4d4d'
- },
- titleTextStyle: {
- bold: true,
- fontSize: 18,
- color: '#4d4d4d'
- }
- },
- vAxis: {
- textStyle: {
- fontSize: 12,
- bold: true,
- color: '#848484'
- }
- },
- width: $(window).width()*0.75,
- height: $(window).height()*1
- };
- var chartGerado = new google.visualization.DataTable();
- chartGerado.addColumn({id: "t", label: "Topping", type: "string"});
- chartGerado.addColumn({id: "s", label: "Bolsas", type: "number"});
- chartGerado.addColumn({id: "l", label: "Label", type: "number", role:"annotation"});
- chartGerado.addColumn({id: "x", label: "Cor", type:"string", role:"style"});
- chartGerado.addRows(rows.length);
- for(var i = 0; i < rows.length; i++){
- chartGerado.setCell(
- i,0,rows[i].c["0"].orientador
- );
- chartGerado.setCell(
- i,1,rows[i].c["0"].bolsas
- );
- chartGerado.setCell(
- i,2,rows[i].c["0"].bolsas
- );
- chartGerado.setCell(
- i,3,'color: #ff0000'
- );
- }
- $scope.chartRelatorioProjetoPorOrientador.data = chartGerado;
- var my_div = document.getElementById('chartRelatorioProjetoPorOrientador');
- var my_chart = new google.visualization.ChartType(BarChart);
- google.visualization.events.addListener(my_chart, 'ready', function () {
- my_div.innerHTML = '<img src="' + my_chart.getImageURI() + '">';
- });
- my_chart.draw(chartGerado,options);
- });
- };
- <div google-chart id="chartRelatorioProjetoPorOrientador" chart="chartRelatorioProjetoPorOrientador" style="height:100%; width:100%; left: 10; top: 20; overflow:scroll;"></div>
Add Comment
Please, Sign In to add comment