svn commit: r945044 [1/3] - in /ofbiz/trunk: ./ framework/common/webcommon/WEB-INF/actions/includes/ framework/common/webcommon/includes/flotrCharts/ framework/common/widget/ framework/example/entitydef/ framework/example/webapp/example/WEB-INF/ framew...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r945044 [1/3] - in /ofbiz/trunk: ./ framework/common/webcommon/WEB-INF/actions/includes/ framework/common/webcommon/includes/flotrCharts/ framework/common/widget/ framework/example/entitydef/ framework/example/webapp/example/WEB-INF/ framew...

erwan
Author: erwan
Date: Mon May 17 09:29:38 2010
New Revision: 945044

URL: http://svn.apache.org/viewvc?rev=945044&view=rev
Log:
Adding the capacity to create charts in OFBiz. Examples are based on the example component, and examples must be created to show charts.
Charts are using the flotr library (http://code.google.com/p/flotr/) which is under a MIT license and is based on the Prototype Javascript Framework.

Added:
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy   (with props)
    ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/
    ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl   (with props)
    ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl   (with props)
    ofbiz/trunk/framework/common/widget/flotrScreens.xml   (with props)
    ofbiz/trunk/framework/example/webapp/example/flotr/
    ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl   (with props)
    ofbiz/trunk/framework/images/webapp/images/flotr/
    ofbiz/trunk/framework/images/webapp/images/flotr/flotr.js   (with props)
    ofbiz/trunk/framework/images/webapp/images/flotr/lib/
    ofbiz/trunk/framework/images/webapp/images/flotr/lib/base64.js   (with props)
    ofbiz/trunk/framework/images/webapp/images/flotr/lib/canvas2image.js   (with props)
    ofbiz/trunk/framework/images/webapp/images/flotr/lib/canvastext.js   (with props)
    ofbiz/trunk/framework/images/webapp/images/flotr/lib/excanvas.js   (with props)
    ofbiz/trunk/framework/images/webapp/images/flotr/license.txt   (with props)
    ofbiz/trunk/framework/images/webapp/images/flotr/readme.txt   (with props)
Modified:
    ofbiz/trunk/LICENSE
    ofbiz/trunk/framework/example/entitydef/entitymodel_view.xml
    ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml
    ofbiz/trunk/framework/example/widget/example/ExampleForms.xml
    ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml
    ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml

Modified: ofbiz/trunk/LICENSE
URL: http://svn.apache.org/viewvc/ofbiz/trunk/LICENSE?rev=945044&r1=945043&r2=945044&view=diff
==============================================================================
--- ofbiz/trunk/LICENSE (original)
+++ ofbiz/trunk/LICENSE Mon May 17 09:29:38 2010
@@ -2697,6 +2697,15 @@ ofbiz/trunk/framework/images/webapp/imag
 ofbiz/trunk/framework/images/webapp/images/prototype/unittest.js
 ofbiz/trunk/framework/images/webapp/images/prototype/builder.js
 ===================================================================================
+Apache Ofbiz includes flotr javascript lib from http://code.google.com/p/flotr/
+licensed under the terms of the MIT License
+ofbiz/trunk/framework/images/webapp/images/flotr/lib/excanvas.js
+ofbiz/trunk/framework/images/webapp/images/flotr/lib/base64.js
+ofbiz/trunk/framework/images/webapp/images/flotr/lib/canvas2image.js
+ofbiz/trunk/framework/images/webapp/images/flotr/lib/canvastext.js
+ofbiz/trunk/framework/images/webapp/images/flotr/flotr.debug-0.2.0-alpha.js
+ofbiz/trunk/framework/images/webapp/images/flotr/flotr-0.2.0-alpha.js
+===================================================================================
 Apache Ofbiz includes LivePipe Control Suite from http://livepipe.net/projects/control_suite/
 licensed under the terms of the MIT License
 ofbiz/trunk/framework/images/webapp/images/prototype/control.progress_bar.js
@@ -2786,6 +2795,6 @@ The DocBook XSL stylesheets are maintain
 The docbook schemas in the files docbook.xsd, docbook.dtd xlink.xsd
 and xml.xsd are distributed under the GNU Free Documentation License
 GNU Free Documentation License
-It was allowed by the author to use the docbook files within the
-Apache OFBiz system in an email to H.Bakker from N.Walsh dd    
-Tue, 25 Aug 2009 07:27:51 -0400 (18:27 ICT)
+It was allowed by the author to use the docbook files within the
+Apache OFBiz system in an email to H.Bakker from N.Walsh dd
+Tue, 25 Aug 2009 07:27:51 -0400 (18:27 ICT)

Added: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy?rev=945044&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy (added)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy Mon May 17 09:29:38 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.base.util.StringUtil;
+chartData = context.chartData;
+chartType = context.chartType;
+labelFieldName = context.labelFieldName;
+dataFieldName = context.dataFieldName;
+if("Pie" == chartType){
+    iter = chartData.iterator();
+    first = true;
+    dataText = "";
+    while(iter.hasNext()){
+        entry = iter.next();
+        if(!first){
+            dataText = dataText + ",";
+        }
+        first = false;
+        dataText = dataText + entry.get(labelFieldName) + "," + entry.get(dataFieldName);
+    }
+    context.dataText = dataText;
+}
+else if("Bars" == chartType){
+    iter = chartData.iterator();
+    i = 1;
+    dataText = "";
+    labels = "";
+    while(iter.hasNext()){
+        entry = iter.next();
+        if(i!=1){
+            dataText = dataText + ",";
+            labels = labels + ",";
+        }
+        dataText = dataText + i + "," + entry.get(dataFieldName);
+        labels = labels + entry.get(labelFieldName);
+        i++;
+    }
+    context.dataText = dataText;
+    context.labelsText = labels;
+}
\ No newline at end of file

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl?rev=945044&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl Mon May 17 09:29:38 2010
@@ -0,0 +1,75 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<!--[if IE]><script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr-0.2.0-alpha/flotr/lib/excanvas.js</@ofbizContentUrl>"></script><![endif]-->
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/prototypejs/prototype.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/lib/canvas2image.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/lib/canvastext.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/flotr.js</@ofbizContentUrl>"></script>
+
+
+<div id="${chartId}Div" style="width:600px;height:300px;"></div>
+
+<script type="text/javascript">
+  document.observe('dom:loaded', function(){
+  function markerFomatter(obj) {
+    var labelsAsText = "${labelsText}";
+                        var labels = [];
+                        labels = labelsAsText.split(",");
+                        var index = "" + Number(obj.x)-1
+                        var text = labels[index];
+                        if(text)
+                        return text;
+                        else
+                        return "";
+  }
+    var dataAsText = "${dataText}";
+    var chartData = [];
+    chartData = dataAsText.split(',');
+    var y = 1;
+    var point1,
+            d2 = [],
+            markers1 = {data:[], markers:{show: true, position: 'ct', labelFormatter: markerFomatter}, bars:{show: false}};
+
+    for(var i=0; i<chartData.length-1 ; i=i+2) {
+        point1 = [y, Number(chartData[i+1])];
+        y++;
+        d2.push(point1);
+        markers1.data.push(point1);
+    }
+    var labelsAsText = "${labelsText}";
+    var labels = [];
+    labels = labelsAsText.split(",");
+    
+    Flotr.draw(
+      $('${chartId}Div'),
+      [d2, markers1],
+      {
+        bars: {show:true, barWidth:0.5,lineWidth:labels.length},
+        mouse: {track:true, relative:true},
+        yaxis: {min: 0, autoscaleMargin: 1},
+        xaxis: {labelsAngle: 90, min: 0, max : labels.length,
+                        tickFormatter : function (val) {
+                        return "";
+                        }},
+        spreadsheet: {show: false},
+        legend:{show: true, backgroundColor: '#D2E8FF'}
+      }
+    );
+  });
+</script>

Propchange: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Bars.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl?rev=945044&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl (added)
+++ ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl Mon May 17 09:29:38 2010
@@ -0,0 +1,48 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<!--[if IE]><script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr-0.2.0-alpha/flotr/lib/excanvas.js</@ofbizContentUrl>"></script><![endif]-->
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/prototypejs/prototype.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/lib/canvas2image.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/lib/canvastext.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/flotr.js</@ofbizContentUrl>"></script>
+
+<div id="${chartId}Div" style="width:800px;height:300px;"></div>
+
+<script type="text/javascript">
+document.observe('dom:loaded', function(){
+    var dataAsText = '${dataText}';
+    var chartData = [];
+    chartData = dataAsText.split(',');
+    var allData = [];
+    var y = 0;
+    for(var i=0; i<chartData.length-1 ; i=i+2) {
+        var a = [[0, chartData[i+1]]];
+        allData[y] = {data:a, label:chartData[i]};
+        y++;
+    }
+    var f = Flotr.draw($('${chartId}Div'), allData, {
+        HtmlText: false,
+        grid: {verticalLines: false, horizontalLines: false},
+        xaxis: {showLabels: false},
+        yaxis: {showLabels: false},
+        pie: {show: true, explode: 6},
+        legend:{position: 'se', backgroundColor: '#D2E8FF'}
+    });
+});
+</script>
\ No newline at end of file

Propchange: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/common/webcommon/includes/flotrCharts/Pie.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/framework/common/widget/flotrScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/flotrScreens.xml?rev=945044&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/widget/flotrScreens.xml (added)
+++ ofbiz/trunk/framework/common/widget/flotrScreens.xml Mon May 17 09:29:38 2010
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
+    <screen name="FlotrChart">
+        <section>
+            <actions>
+                <script location="component://common/webcommon/WEB-INF/actions/includes/PrepareDataForFlotrGraph.groovy"/>
+            </actions>
+            <widgets>
+                <platform-specific>
+                     <html><html-template location="component://common/webcommon/includes/flotrCharts/${chartType}.ftl"/></html>
+                </platform-specific>
+            </widgets>
+        </section>
+    </screen>
+</screens>

Propchange: ofbiz/trunk/framework/common/widget/flotrScreens.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/widget/flotrScreens.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/common/widget/flotrScreens.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/framework/example/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/entitydef/entitymodel_view.xml?rev=945044&r1=945043&r2=945044&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/entitydef/entitymodel_view.xml (original)
+++ ofbiz/trunk/framework/example/entitydef/entitymodel_view.xml Mon May 17 09:29:38 2010
@@ -148,4 +148,10 @@ under the License.
             <order-by field-name="exampleName"/>
         </entity-condition>
     </view-entity>
+    <!--example view for creating charts -->
+    <view-entity entity-name="ExampleCountByType" package-name="org.ofbiz.example.example">
+        <member-entity entity-alias="EX" entity-name="Example"/>
+        <alias entity-alias="EX" name="total" field="exampleId" function="count-distinct"/>
+        <alias entity-alias="EX" name="exampleTypeId" group-by="true"/>
+    </view-entity>
 </entitymodel>

Modified: ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml?rev=945044&r1=945043&r2=945044&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/framework/example/webapp/example/WEB-INF/controller.xml Mon May 17 09:29:38 2010
@@ -238,6 +238,14 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ViewHandler"/>
     </request-map>
+    <request-map uri="BarChart">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="BarChart"/>
+    </request-map>
+    <request-map uri="PieChart">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="PieChart"/>
+    </request-map>
     <!-- end of request mappings -->
 
     <!-- View Mappings -->
@@ -277,6 +285,11 @@ under the License.
     <view-map name="Report" type="screen" page="component://example/widget/example/BirtScreens.xml#Report"/>
     <view-map name="Mail" type="screen" page="component://example/widget/example/BirtScreens.xml#EditMail"/>
     <view-map name="ViewHandler" type="birt" page="component://example/webapp/birt/report/product.rptdesign" content-type="application/pdf"/>
+
+    <!-- Flotr view mapping -->
+    <view-map name="BarChart" page="component://example/widget/example/ExampleScreens.xml#BarChart" type="screen"/>
+    <view-map name="PieChart" page="component://example/widget/example/ExampleScreens.xml#PieChart" type="screen"/>
+
     <!-- Supported Content Types -->
     <!--
         text/html

Added: ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl?rev=945044&view=auto
==============================================================================
--- ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl (added)
+++ ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl Mon May 17 09:29:38 2010
@@ -0,0 +1,107 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<!--[if IE]><script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr-0.2.0-alpha/flotr/lib/excanvas.js</@ofbizContentUrl>"></script><![endif]-->
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/prototypejs/prototype.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/lib/canvas2image.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/lib/canvastext.js</@ofbizContentUrl>"></script>
+<script language="javascript" type="text/javascript" src="<@ofbizContentUrl>/images/flotr/flotr.js</@ofbizContentUrl>"></script>
+
+<div id="container" style="width:600px;height:300px;"></div>
+
+<script type="text/javascript">
+  document.observe('dom:loaded', function(){
+    // Fill series.
+    var d1 = [[0, Math.ceil(Math.random()*40)]];
+    var d2 = [[0, Math.ceil(Math.random()*30)]];
+    var d3 = [[0, Math.ceil(Math.random()*20)]];
+    var d4 = [[0, Math.ceil(Math.random()*10)]];
+    var d5 = [[0, Math.ceil(Math.random()*10)]];
+
+    //Draw the graph.
+    var f = Flotr.draw($('container'), [
+        {data:d1, label: 'Comedy', pie:{explode: Math.ceil(Math.random()*10)}},
+        {data:d2, label: 'Action'},
+        {data:d3, label: 'Romance', pie:{explode: Math.ceil(Math.random()*10)} },
+        {data:d4, label: 'Drama'},
+        {data:d5, label: 'Other', pie:{explode: Math.ceil(Math.random()*10)} }
+    ], {
+        HtmlText: false,
+        grid: {
+          verticalLines: false,
+          horizontalLines: false
+        },
+        xaxis: {showLabels: false},
+        yaxis: {showLabels: false},
+        pie: {
+          show: true,
+          explode: 6
+        },
+        legend:{
+          position: 'se',
+          backgroundColor: '#D2E8FF'
+        }
+    });
+  });
+</script>
+
+<div id="containerb" style="width:600px;height:300px;"></div>
+
+<script type="text/javascript">
+  /**
+   * Wait till dom's finished loading.
+   */
+  document.observe('dom:loaded', function(){
+    function markerFomatter(obj) {
+      return obj.y+'%';
+    }
+
+    /**
+     * Fill series d1 and d2 width random values.
+     */
+    var point,
+            d1 = [],
+            d2 = [],
+            markers = {data:[], markers:{show: true, position: 'ct', labelFormatter: markerFomatter}, bars:{show: false}};
+
+    for(var i = 0; i < 4; i++ ){
+      point = [i, Math.ceil(Math.random()*10)];
+      d1.push(point);
+      markers.data.push(point);
+
+      point = [i+0.5, Math.ceil(Math.random()*10)];
+      d2.push(point);
+      markers.data.push(point);
+    }
+
+    /**
+     * Draw the graph in the first container.
+     */
+    Flotr.draw(
+      $('containerb'),
+      [d1, d2, markers],
+      {
+        bars: {show:true, barWidth:0.5},
+        mouse: {track:true, relative:true},
+        yaxis: {min: 0, autoscaleMargin: 1},
+        spreadsheet: {show: false}
+      }
+    );
+  });
+</script>
+

Propchange: ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/example/webapp/example/flotr/flotrPie.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/framework/example/widget/example/ExampleForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleForms.xml?rev=945044&r1=945043&r2=945044&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleForms.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleForms.xml Mon May 17 09:29:38 2010
@@ -270,4 +270,8 @@ under the License.
         </field>
         <field name="submitButton" title="${uiLabelMap.CommonAdd}"><submit button-type="button"/></field>
     </form>
+    <form name="ChartDataList" type="list" list-name="chartData">
+        <field name="exampleTypeId"><display/></field>
+        <field name="total"><display/></field>
+    </form>
 </forms>

Modified: ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml?rev=945044&r1=945043&r2=945044&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml Mon May 17 09:29:38 2010
@@ -34,6 +34,8 @@ under the License.
         </menu-item>
         <menu-item name="ExampleGeoLocation" title="${uiLabelMap.CommonGeoLocation}"><link target="ExampleGeoLocationPointSet1"/></menu-item>
         <menu-item name="Birt" title="${uiLabelMap.Birt}"><link target="BirtMain"/></menu-item>
+        <menu-item name="Barchart" title="Flotr : Bar Chart"><link target="BarChart"/></menu-item>
+        <menu-item name="Piechart" title="Flotr : Pie Chart"><link target="PieChart"/></menu-item>
     </menu>
 
     <menu name="EditExample" extends="CommonTabBarMenu" extends-resource="component://common/widget/CommonMenus.xml">

Modified: ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml?rev=945044&r1=945043&r2=945044&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleScreens.xml Mon May 17 09:29:38 2010
@@ -312,4 +312,63 @@ under the License.
         </section>
     </screen>
 
+    <screen name="ChartDataList">
+        <section>
+            <widgets>
+                <include-form name="ChartDataList" location="component://example/widget/example/ExampleForms.xml" />
+            </widgets>
+        </section>
+    </screen>
+    <screen name="PieChart">
+        <section>
+            <actions>
+                <set field="headerItem" value="Piecharts"/>
+                <entity-condition entity-name="ExampleCountByType" list="chartData">
+                    <order-by field-name="exampleTypeId"/>
+                </entity-condition>
+                <set field="chartType" value="Pie"/>
+                <set field="labelFieldName" value="exampleTypeId"/>
+                <set field="dataFieldName" value="total"/>
+                <set field="chartId" value="pieChartDiv"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="Chart Data">
+                            <include-screen name="ChartDataList"/>
+                        </screenlet>
+                        <screenlet title="Flotr Pie Chart representing above data">
+                            <include-screen name="FlotrChart" location="component://common/widget/flotrScreens.xml"/>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="BarChart">
+        <section>
+            <actions>
+                <set field="headerItem" value="Barcharts"/>
+                <entity-condition entity-name="ExampleCountByType" list="chartData">
+                    <order-by field-name="exampleTypeId"/>
+                </entity-condition>
+                <set field="chartType" value="Bars"/>
+                <set field="labelFieldName" value="exampleTypeId"/>
+                <set field="dataFieldName" value="total"/>
+                <set field="chartId" value="barChartDiv"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="Chart Data">
+                            <include-screen name="ChartDataList"/>
+                        </screenlet>
+                        <screenlet title="Flotr Bar Chart representing above data">
+                            <include-screen name="FlotrChart" location="component://common/widget/flotrScreens.xml"/>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>