Skip to content

Instantly share code, notes, and snippets.

@igr-santos
Created June 12, 2014 16:51
Show Gist options
  • Save igr-santos/baf48496c5f6e4bc91e4 to your computer and use it in GitHub Desktop.
Save igr-santos/baf48496c5f6e4bc91e4 to your computer and use it in GitHub Desktop.
function ReportChart(url) {
this.url = url;
}
ReportChart.prototype.getChart = function() {
$.get(
this.url,
function(result) {
chart = result['chart'];
data = result['data'];
if (chart == 'line') {
new Morris.Line(data);
} else if (chart == 'bar') {
new Morris.Bar(data);
}
}
)
}
$(document).ready(function(){
$("#generate").click(function(){
report = ReportChart("{% url 'reportlab:generate_chart' 2 %}");
report.getChart();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment