Skip to content

Instantly share code, notes, and snippets.

@ismaild
Created November 21, 2012 22:47
Show Gist options
  • Select an option

  • Save ismaild/4128351 to your computer and use it in GitHub Desktop.

Select an option

Save ismaild/4128351 to your computer and use it in GitHub Desktop.
My App Code
charts_dict = {
'inactivity': {
'title': 'Inactivity Aging Summary' ,
'url': 'inactivity.json',
'container': 'inactivity',
'width': '100%',
'height': '250'
}
}
@app.route('/dashboard')
def dashboard():
return render_template('dashboard.html', charts=charts_dict)
{% macro render(title, url, container, width='100%', height='100%') -%}
<div class="box-header">
<h2>{{ title }}</h2>
</div>
<div class="box-content" id="{{ container }}">
Loading Graph
<script type="text/javascript"><!--
var myChart = new FusionCharts( "/static/charts/Column2D.swf","my{{ container }}", "{{ width }}%", "{{ height }}", "0", "1" );
myChart.setJSONUrl("/static/data/{{ url }}");
myChart.setTransparent(true);
myChart.render("{{ container }}");
// -->
</script>
</div>
{%- endmacro %}
{% import 'macros/chart_render.html' as chart %}
{{ chart.render('Inactivity' ,'inactivity.json', 'inactivity', height='250') }}
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment