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.

eZ debug

Timing: Jan 19 2025 04:26:03
Script start
Timing: Jan 19 2025 04:26:03
Module start 'layout'
Timing: Jan 19 2025 04:26:03
Module start 'content'
Timing: Jan 19 2025 04:26:04
Module end 'content'
Timing: Jan 19 2025 04:26:04
Script end

Main resources:

Total runtime0.9943 sec
Peak memory usage4,096.0000 KB
Database Queries85

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 589.2734152.6406
Module start 'layout' 0.00740.0052 741.914139.4609
Module start 'content' 0.01260.9802 781.3750729.8125
Module end 'content' 0.99270.0015 1,511.187528.1563
Script end 0.9943  1,539.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.4231160.0003
Check MTime0.00170.1695160.0001
Mysql Total
Database connection0.00200.198810.0020
Mysqli_queries0.900290.5306850.0106
Looping result0.00090.0865830.0000
Template Total0.948495.420.4742
Template load0.00310.309420.0015
Template processing0.945395.068520.4726
Template load and register function0.00010.007910.0001
states
state_id_array0.00120.125110.0012
state_identifier_array0.00140.142820.0007
Override
Cache load0.00280.2819730.0000
Sytem overhead
Fetch class attribute can translate value0.00070.071940.0002
Fetch class attribute name0.00110.1063150.0001
XML
Image XML parsing0.00360.359440.0009
class_abstraction
Instantiating content class attribute0.00000.0036220.0000
General
dbfile0.00560.5674350.0002
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
11content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 45
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs