Created
July 2, 2017 06:44
-
-
Save BrunoDSouza/880d8671cbed720da79b5f30191e0ed6 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
var chartFaturamento = { | |
create : function(element){ | |
$.ajax({ | |
type : "GET", | |
contentType : "application/json", | |
url : "/ajax/chartFaturamento", | |
success : function(data, statusText, xhr) { | |
//Instancia de um novo map<month, value> | |
data = new Map(JSON.parse(data) | |
.map(function(v, k, array){ | |
return Object.values(array[k]) | |
})) | |
var month = Array.from(data.keys()) | |
var dados = Array.from(data.values()) | |
Highcharts.chart(element, { | |
title: { | |
text: '' | |
}, | |
exporting:{ | |
enabled : false | |
}, | |
xAxis: { | |
categories: month | |
}, | |
tooltip: { | |
pointFormat: 'Retorno de <b>R${point.y:,.0f}</b><br/>' | |
}, | |
series: [{ | |
type: 'column', | |
colorByPoint: true, | |
data: dados, | |
showInLegend: true | |
}], | |
}); | |
}, | |
error : function(e) { | |
alert("ERROR: " + e.responseText) | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment