Dynamic pie and bar charts with ezP ?

Author Message

laurent le cadet

Wednesday 30 March 2005 12:21:39 am

Hi,

I'm looking a way to add dynamic charts to website.
Is there any way to use eZp for that ?

Laurent

Paul Borgermans

Wednesday 30 March 2005 1:11:56 am

Laurent

You wil need to write your own template operator. I would advise you to take a look at the jpgraph library which provides a ton of chart types.

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

laurent le cadet

Wednesday 30 March 2005 1:37:21 am

Hi Paul,

thanks for the hint.

Laurent

Ekkehard Dörre

Wednesday 30 March 2005 5:13:20 am

Hi Laurent,

http://ez.no/community/forum/developer/implementing_jpgraph_into_ezpublish

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

laurent le cadet

Wednesday 30 March 2005 5:24:11 am

Hi Ekkehard,

More and more interesting !

Thanks.

Laurent

Bjørn Sandvik

Wednesday 30 March 2005 6:22:59 am

I'm using FusionCharts with eZ publish.

http://globalis.fn.no/land/bangladesh?show=indicators&indicator=138&country2=NO

FusionCharts is higly adaptable to any technical plattform.

http://www.infosoftglobal.com/FusionCharts

http://blog.thematicmapping.org
http://www.globalis.no

laurent le cadet

Wednesday 30 March 2005 6:27:21 am

Nice !
Do you have any hint how to use it with eZ P ?

Ps : ezDebug is "on" on your site

Bjørn Sandvik

Wednesday 30 March 2005 6:38:03 am

Our site is still under construction.

You need to find a way to save your data in the database. One solution is to use the matrix-datatype, but this depends on your data. We are having our data on a separate server and are fetcing the data using a simple extension.

Secondly, you need to make a new pagelayout which can put together the XML-data that FusionCharts needs.

http://blog.thematicmapping.org
http://www.globalis.no

laurent le cadet

Wednesday 30 March 2005 6:57:03 am

About the pagelayout.

I don't know how are the .fla but do you think it's possible to create a chart.tpl (or a pie.tpl, doonut.tpl,...) base on the full flash.tpl to and use it as a regular classe ?

Bjørn Sandvik

Wednesday 30 March 2005 7:35:32 am

Hi again,

This is the way I've done it with FusionCharts:

1. Put the .fla files under the design folder for you site (I've made a folder "charts" the same place where you finde "fonts", "images" and "stylesheets".

2. Make a class and one or more objects that can contain the data you want to show (f.ex. an indicator class). Save your data using the matrix attribute.

3. Make an override template for the class. Can look something like this:

<h1>{$node.name|wash}</h1>

{attribute_view_gui attribute=$node.data_map.description}
  
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="570" HEIGHT="400" id="FusionCharts" ALIGN="">
  <PARAM NAME=movie VALUE="/design/globalis/charts/FC_2_3_Column3D.swf?dataURL=/layout/set/trend/(object)/{$node.object.id}/&chartWidth=570&chartHeight=400"> 
  <PARAM NAME=quality VALUE="high"> 
  <PARAM NAME=bgcolor VALUE="#FFFFFF"> 
  <EMBED src="/design/globalis/charts/FC_2_3_Column3D.swf?dataURL=/layout/set/trend/(object)/{$node.object.id}/&chartWidth=570&chartHeight=400" quality="high" bgcolor="#FFFFFF"  WIDTH="570" HEIGHT="400" NAME="FusionCharts" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>  
  
{attribute_view_gui attribute=$node.data_map.data}

3. The chart-file (.fla) will fetch the XML-data from the pagelayout-file trend_pagelout (sending object id as a paramterer):

{let trend=fetch( 'content', 'object', hash( 'object_id', $view_parameters.object ) )}
  <graph yAxisMinValue="15000" yAxisName="Millioner mennesker" showNames="1" showValues="1" rotateNames="1" showColumnShadow="1" animation="1" showAlternateHGridColor="1" AlternateHGridColor="ff5904" divLineColor="ff5904" divLineAlpha="20" alternateHGridAlpha="5" canvasBorderColor="666666" baseFontColor="666666" canvasBorderThickness="1" canvasBorderColor="000000">
    {section loop=$trend.data_map.data.content.rows.sequential}
      <set name="{$:item.columns.0}" value="{$:item.columns.1}"  /> 		 	
    {/section} 
  </graph>
{/let}

4. You need to specify the new pagelayout in "layout.ini.append.php":

[trend]
PageLayout=trend_pagelayout.tpl

Here you can see the result:
http://globalis.fn.no/jordens_tilstand/befolkningseksplosjonen
(under construction)

There is a cache bug when sending parameters to a pagelayout-file. I'm trying to find the bug. Turn of cache while testing.

Hope this helps!

http://blog.thematicmapping.org
http://www.globalis.no

laurent le cadet

Wednesday 30 March 2005 8:03:33 am

It seems to be quick way and easy to use.

Tahnks a lot.

Laurent.

PS : maybe I'll have more questions later ;)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.