|
List Info
Thread: render xml component in container
|
|
| render xml component in container |

|
2008-01-03 00:44:58 |
|
Hi,
I'm looking for the most pythonic [or djangonautic] way to render a FusionChart [http://www.fusioncharts.com/gadgets/docs/] in Django. I searched through the forums and didn't see this addressed directly -- my apologies if this is very basic and obvious!
1. I have a django template, container.html:
{% block head %} <script language="JavaScript" src="/site_media/swf/Charts/FusionCharts.js"></script> {% endblock head %}
{% block main_content %} <div id="chartdiv" align="center">
The chart will appear within this DIV. This text will be replaced by the chart. </div> <script type="text/javascript">
var myChart = new FusionCharts("/site_media/swf/Charts/HLinearGauge.swf", "myChartId", "400", "200", "0", "0");
myChart.setDataXML("your_data.xml");
myChart.render("chartdiv");
</script> {% endblock main_content %}
2. your_data.xml is also a django template, stored in myapp/templates/you/your_data.xml, and the TEMPLATE_DIRS setting includes myapp/template
<chart lowerLimit='0' upperLimit='100
' lowerLimitDisplay='Bad' upperLimitDisplay='Good'
palette='1' numberSuffix='%' chartRightMargin='
20'> <colorRange>
<color minValue='0' maxValue='75
' code='FF654F' label='Bad'/>
<color minValue='75' maxValue='
90' code='F6BD0F' label='Moderate'
/> <color minValue='90' maxValue
='100' code='8BBA00' label='Good
'/> </colorRange> <pointers>
<pointer value=9;{{ your.value }}' /> </pointers
> </chart>
3. I have a view --- def your_data(request). I want this view to
a) populate the your.value object in the xml template -- your_data.xml b) render the containing template,
container.html.
Any suggestions on the best approach for this ... ?
Thanks!
TU
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users googlegroups.com To unsubscribe from this group, send email to django-users-unsubscribe googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|