ok, I finally got open-flash-chart to work. 1. create an xhtml-file and insert (something like) this: <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/ flash/swflash.cab#version=8,0,0,0" width="600" height="400" id="graph-2" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="/media/site/chart/open-flash-chart.swf? width=600&height=400&data=/chart_data/" /> <param name="quality" value="high" /> <param name="bgcolor" value="#FFFFFF" /> <embed src="/media/site/chart/open-flash-chart.swf? width=600&height=400&data=/chart_data/" quality="high" bgcolor="#FFFFFF" width="600" height="400" name="open-flash-chart" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"; /> </object> 2. define the url for the chart, eg: (r'^chart/$', 'www.views.charts.chart'), 3. define the url for the chart-data, e.g.: (r'^chart_data/$', 'www.views.charts.chart_data'), 4. the views: def chart(request): ### nothing really required. whatever you want to do here. points to the html-file created above return render_to_response('site/charts/chart.html', { 'var': 'var', }, context_instance=RequestContext(request) ) def chart_data(request): import random g = graph() data_1 = [] data_2 = [] data_3 = [] for i in range(12): data_1.append( random.randint(14,19) ) data_2.append( random.randint(8,13) ) data_3.append( random.randint(1,7) ) g.title('PageViews (2007)', '{color: #999999; font-size: 16; text- align: center}' ); g.bg_colour = '#ffffff' # we add 3 sets of data: g.set_data( data_1 ) g.set_data( data_2 ) g.set_data( data_3 ) # we add the 3 line types and key labels g.line_dot( 3, 5, '#333333', 'Page views', 10 ) g.line_dot( 3, 5, '#666666', 'Visits', 10) # <-- 3px thick + dots g.line_hollow( 2, 4, '#999999', 'Unique visitors', 10 ) g.set_x_labels( 'Jänner,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember'.split(',') ) g.set_x_label_style( 11, '0x666666', 2, 1) g.set_y_max(20) g.y_label_steps(4) g.set_y_label_style( 10, '0x666666') return HttpResponse(g.render())
Never been to CodeSnippets before?
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
Django and Open-flash-charts (See related posts)
Comments on this post
You need to create an account or log in to post comments to this site.
Related Posts
» Use Flash's MovieClipLoader ... in flash actionscript
» Retreiving a Flash movie's d... in flash actionscript
» Dynamically placed buttons in flash actionscript
» SetTimeout : Flash in flash actionscript
» Using FlashObject and the mi... in javascript expressionengine flash plugin
» Internet Connection: Flash 8... in flash actionscript flash8
Snippets (source code soon to be available) developed by Peter Cooper and powered by Ruby On Rails