Created
June 12, 2014 16:51
-
-
Save igr-santos/baf48496c5f6e4bc91e4 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
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