You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2006/09/28 18:07:59 UTC

svn commit: r450952 [1/6] - in /incubator/adffaces/trunk/trinidad: src/site/xdoc/devguide/ trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ trinidad-api/src/main/j...

Author: awiner
Date: Thu Sep 28 11:07:57 2006
New Revision: 450952

URL: http://svn.apache.org/viewvc?view=rev&rev=450952
Log:
Commiting ADFFACES-182: chart component from Venkata Guddanti

Added:
    incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/chart.xml
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownEvent.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownListener.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChartModel.java
    incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/Chart.xml
    incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreChart.xml
    incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/Chart.xml
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chart.jspx
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqData.txt
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqXData.txt
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/desktop/ChartRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ApacheChart.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/svg/
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/svg/chart.svg
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/svg/chartNoGradient.svg
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chart-minimal-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chart-minimalIE-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chart-minimalIERtl-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chart-minimalInacc-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chart-minimalPPC-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chart-minimalSaf-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/chart-minimalScrRdr-golden.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/chart.xml
Modified:
    incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/index.xml
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/SkinSelectors.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlConstants.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreRenderKitResourceLoader.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/resources/META-INF/adf/styles/base-desktop.xss
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/renderkit/core/resource/CoreBundle.xrts
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MVariableResolver.java

Added: incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/chart.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/chart.xml?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/chart.xml (added)
+++ incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/chart.xml Thu Sep 28 11:07:57 2006
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<document>
+  <properties>
+    <title>Using the Apache Trinidad Chart Component</title>
+  </properties>
+
+  <body>
+    <section name="Using the Apache Trinidad Chart Component">
+      <p>
+        <ul>
+          <li><a href="#Introduction">Introduction</a></li>
+          <li><a href="#The Chart Model">The Chart Model</a></li>
+          <li><a href="#Labeling">Labeling</a></li>
+          <li><a href="#Grid Lines">Grid Lines</a></li>
+          <li><a href="#Legend">Legend</a></li>
+          <li><a href="#Perspective">Perspecitve (2.5D)</a></li>
+          <li><a href="#Animation">Animation</a></li>
+          <li><a href="#Skinning">Skinning</a></li>
+          <li><a href="#Tooltips">Tooltips</a></li>
+          <li><a href="#Drilldown">Drilldown</a></li>
+        </ul>
+      </p>
+    </section>
+
+
+    <section name="Introduction">
+      <P>
+        The Apache Trinidad Chart component provides charting solution in a JSF environment.
+        It uses W3C standard Scalable Vector Graphics to display charts on the client browser.
+        Currently SVG is supported on the following browsers:
+        <ul>
+          <li>IE 6+ through Adobe SVG plugin. The Apache Trinidad Chart component automatically detects 
+          if the adobe plugin is not present and provides a link to download the plugin.</li>
+          <li>Firefox 1.5+</li>
+          <li>Opera 9.0+</li>
+        </ul>
+      </P>
+      <P>
+        The Apache Trinidad Chart supports the following chart types:
+        <ul>
+          <li><b>verticalBar</b> - A verticalBar chart uses a series of columns to compare values across groups. Groups are organized horizontally while values are displayed vertically in 
+              order to place more emphasis on comparing values and less emphasis on time. </li>
+          <li><b>horizontalBar</b> - A horizontalBar chart uses a series of bars to compare values across groups. Groups are organized vertically while values are displayed horizontally in 
+              order to place more emphasis on comparing values and less emphasis on time.</li>
+          <li><b>stackedVerticalBar</b> - A stacked vertical chart is used to compare the contribution of each value to a total across a series. </li>
+          <li><b>stackedHorizontalBar</b> - Simlar to stackedVerticalBar except that the series and the groups are flipped</li>
+          <li><b>pie</b> - One of the most widely used chart types, pie charts show how proportions of data contribute to a whole.</li>
+          <li><b>area</b> - Area charts emphasize the degree of change over time, and also shows the relationship of parts to a whole.</li>
+          <li><b>stackedArea</b> - A stacked area chart is an area chart that uses two or more data series and can be used to compare the degree of change to a total across a series</li>
+          <li><b>line</b> - A line chart illustrates trends in data with the passing of time. </li>
+          <li><b>barLine</b> - A barLine chart shows the combination of vertical bar and line chart. Each value from a series is alternated from a bar to a line, with the first series value displayed as a bar.</li>
+          <li><b>XYLine</b> - An XYLine chart illustrates trends in data with the passing of time. It diffentiates from a normal line chart by having the X Values dictate the display along the X Axis. </li>
+          <li><b>scatterPlot</b> - A scatterPlot chart uses value points to represent data. This chart needs both values along X and Y axis.</li>
+          <li><b>radar</b> - A radar chart is a circular graph on which data are displayed in terms of values and angles.It is a circular chart used primarily as a comparative tool.</li>
+          <li><b>radarArea</b> - This is similar to a radar chart except for the fact that the area enclosed by a series is filled.</li>
+          <li><b>funnel</b> - A funnel charts show how proportions of data contribute to a whole. It is similar to a pie chart but displays as a funnel.</li>
+          <li><b>circularGauge</b> - A circularGuage displays data in a gauge. It has a pivot point, around which a value is rotated so that it can be displayed in relation to maximum and a minimum.</li>
+          <li><b>semiCircularGauge</b> - Similar to a circularGauge except for the fact that the gauge is semiCircular in shape.</li>
+        </ul>
+      </P>
+    </section>
+
+    <section name="The Chart Model">
+      <P>
+        The Apache Trinidad chart component uses a model to access the data for displaying a chart.
+        The specific model class must extend the abstract class
+        <code>org.apache.myfaces.trinidad.model.ChartModel</code>.
+      </P>
+      <P>
+        The chart values are draw using yValues 2D array returned by the chart modal. 
+        Each element in this array must contain an array of doubles. These values in this array represent a 
+        series values with in a group. For XYLine and Scatter plots xValues 2D array are also required.
+      </P>
+      <P>
+        For Pie chart and Funnel chart if the yValues array length is more than one, multiple charts are shown.
+        Each array element in the yValues is used to draw one chart. 
+      </P>
+      <P>
+        For circular and semiCircular gauge charts only one series in the yValues is used.
+        Multiple charts are displayed if size of yValues array is greater than one. 
+        Each array element in the yValues is used to draw one chart.
+      </P>
+    </section>
+
+    <section name="Labeling">
+        <P>
+        The Apache Trinidad chart provides flexibility for labeling of chart data. The yValues and
+        group labels are the two types of labels used in a chart.
+        </P>
+        
+        <subsection name="YValue Labeling"> 
+        The yValues(y axis labels for verticalBar, area, line etc. and x axis labels for horizontalBar) are labeled based on the YMajorGridLineCount. The maximum and minimum values are
+        displayed for the yValues even if the YMajorGridLineCount=0.
+        </subsection>
+        
+        <subsection name="Group Labeling"> 
+        The group labels(x axis labels for verticalBar, area, line etc. and y axis labels for horizontalBar) are controlled by getGroupLabels method returned by the chart model.
+        Please note that the size of the groupLabels may not match the size of the yValues.  If the groupLabels size is larger than the yvalues size, the chart will display
+        blank after the missing values. This is sometimes useful to chart incomplete data. The groupLabels array may also contain blanks or nulls so that
+        label for an index is ignored. If the groupLabels size is less than the yValues, the axis is divided into portions equal to the size of groupLabels.
+        This feature is useful for labeling large data set.          
+        </subsection>
+    </section>
+
+    <section name="Grid Lines">
+      <P>
+        The Apache Trinidad chart component displays displays vertical and horizontal grid lines inside charts. 
+        
+        <subsection name="YValues Grid Lines">
+        <p>
+          The grid line for yValues(y axis for verticalBar, area, line etc. and x axis for horizontalBar) are controlled by YMajorGridLineCount.
+          The number of yValue labels displayed are also controlled by this attribute. The maximum and minimum values are displayed and then 
+          a value is displayed corresponding to each major grid line.
+        </p>
+        <p>
+          For gauge charts minor grid lines are displayed within a major grid section. YMinorGridLineCount attribute is used to control this feature.
+        </p>
+        </subsection>
+
+        <subsection name="X Grid Lines">
+        The attribute XMajorGridLineCount attribute controls the number of vertical major grid lines displayed in the chart.
+        The default value is -1, which implies that the vertical major grid lines are controlled by the groupLabels in the chart model.
+        </subsection>
+      </P>
+      <source><![CDATA[
+<tr:chart YMajorGridLineCount="3" XMajorGridLineCount="-1".../>
+<tr:chart type="circularGauge" YMajorGridLineCount="8" yMinorGridLineCount="3".../>]]>
+      </source>
+    </section>
+    
+    <section name="Legend">
+      <P>
+        The Apache Trinidad chart component displays the series labels as a legend. The legendPosition attribute of the chart component
+        controls the display of the legend. The legend can be turned off by setting this attribute to "none".
+        
+        Please note that legend is never displayed for circular and semicircular gauge chart since these charts display only one series.
+      </P>
+      <source><![CDATA[
+<tr:chart legendPosition="none|start|end|top|left" .../>]]>
+      </source>
+    </section>
+    
+    <section name="Perspective">
+      <P>
+        The Apache Trinidad chart component can be displayed in perspective(2.5D) or in 2D. The perspective is purely a visual representation and
+        does not provide any additional detail from a chart in 2D.
+        
+        Please note that perspective flag does not have any effect on radar and gauge charts.
+      </P>
+      <source><![CDATA[
+<tr:chart perspective="true|false" .../>]]>
+      </source>
+    </section>
+    
+    <section name="Animation">
+      <P>
+        The Apache Trinidad chart component provides support for animation during initial load. The animation is controlled by
+        animationDuration attribute. Setting this attribute to 0 will turn off animation.
+      </P>
+      <P>  
+        Please note that the animation should be used with caution, it should not be used at the expense of usability. For e.g. 
+        if a page is periodically updating charts using a poll component, animation will effect the usability of the chart.
+      </P>
+      <source><![CDATA[
+<tr:chart animationDuration="1000" .../>]]>
+      </source>
+    </section>
+
+    <section name="Skinning">
+      <P>
+        The Apache Trinidad chart component provides support for skinning of the chart elements. The chart elements are rendered by cloning elements
+        from a template document. The template document can be changed through templateSource source attribute. 
+      </P>
+      <P>  
+        The chart component chooses a default template if templateSource attribute is not specified. The default template is chosen based
+        on whether the gradientsUsed attribute is true or false.
+      </P>
+      <source><![CDATA[
+<tr:chart templateSource="/components/svg/myTemplate.svg" .../>]]>
+      </source>
+    </section>
+        
+    <section name="Tooltips">
+      <P>
+        The Apache Trinidad chart component displays tooltips in response to the user moving the mouse on the chart data. 
+        The chart component may display multiple tooltips for area and radarArea charts if the user moves the mouse inside an area
+        that is enclosed by multiple series. For line chart and area charts the tooltips display interpolated values.
+        The tooltips display can be turned off by setting tooltipsVisible attribute to "false".
+      </P>
+      <source><![CDATA[
+<tr:chart tooltipsVisible="true|false" .../>]]>
+      </source>
+    </section>
+
+    <section name="DrillDown">
+      <P>
+        The &lt;tr:chart&gt; component triggers ChartDrillDownEvent when
+        the user drills clicks on the chart data. Listeners for this event may be registered on the table
+        using the "chartDrillDownListener" attribute or by adding the listener to
+        the chart using the "addChartDrillDownListener" method. 
+        The listener must take a parameter of type <code>org.apache.myfaces.trinidad.event.ChartDrillDownEvent</code>
+      </P>
+      <source><![CDATA[
+<tr:chart chartDrillDownListener="#{myBean.drillDown}" .../>]]>
+      </source>
+    </section>
+    
+  </body>
+</document>

Modified: incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/index.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/index.xml?view=diff&rev=450952&r1=450951&r2=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/index.xml (original)
+++ incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/index.xml Thu Sep 28 11:07:57 2006
@@ -14,6 +14,7 @@
             <li><a href="fileUpload.html">File Upload</a></li>            
             <li><a href="table.html">Using Apache Trinidad Tables</a></li>     
             <li><a href="tree.html">Using Apache Trinidad Trees</a></li>       
+            <li><a href="chart.html">Using Apache Trinidad Chart</a></li>       
             <li><a href="navigation.html">Navigation</a></li>      
             <li><a href="clientValidation.html">Client-side Converters and Validators</a></li>     
         </ul>

Added: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXChartTemplate.java Thu Sep 28 11:07:57 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+package org.apache.myfaces.trinidad.component;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.el.MethodBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.apache.myfaces.trinidad.event.ChartDrillDownEvent;
+import org.apache.myfaces.trinidad.event.ChartDrillDownListener;
+
+/**
+ * Base class for the Table component. The behaviour supported by this base class
+ * include record navigation, sorting, selection and detail-disclosure.
+ * <p>
+ * @version $Name:  $ ($Revision: 431848 $) $Date: 2006-08-16 01:00:16 -0600 (Wed, 16 Aug 2006) $
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class UIXChartTemplate extends UIXComponentBase
+{
+
+  /**
+   * Delivers an event to the appropriate listeners.
+   * @param event
+   * @throws javax.faces.event.AbortProcessingException
+   */
+	@Override
+  public void broadcast(FacesEvent event)
+    throws AbortProcessingException
+  {
+
+    // Deliver to the default ChartDrillDownEvent
+    if (event instanceof ChartDrillDownEvent)
+    {
+      broadcastToMethodBinding(event, getChartDrillDownListener());
+    }
+    super.broadcast(event);
+  }
+
+  /**
+   * Adds a drilldown listener.
+   *
+   * @param listener  the selection listener to add
+   */
+  final public void addChartDrillDownListener(
+    ChartDrillDownListener listener)
+  {
+    addFacesListener(listener);
+  }
+
+  /**
+   * Removes a drilldown listener.
+   *
+   * @param listener  the selection listener to remove
+   */
+  final public void removeChartDrillDownListener(
+    ChartDrillDownListener listener)
+  {
+    removeFacesListener(listener);
+  }
+
+}

Added: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownEvent.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownEvent.java?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownEvent.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownEvent.java Thu Sep 28 11:07:57 2006
@@ -0,0 +1,117 @@
+/*
+* Copyright 2006 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.myfaces.trinidad.event;
+
+import java.util.List;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+import org.apache.myfaces.trinidad.model.SortCriterion;
+
+/**
+ * The Event generated when a Collection is to be sorted.
+ * @author The Oracle ADF Faces Team
+ */
+public final class ChartDrillDownEvent extends FacesEvent
+{
+  public ChartDrillDownEvent(
+    UIComponent source, 
+    int[] seriesIndices, 
+    int[] yValueIndices, 
+    double[] yValues, 
+    double[] xValues)
+  {
+    super(source);
+    _seriesIndices = seriesIndices;
+    _yValueIndices = yValueIndices;
+    _yValues = yValues;
+    _xValues = xValues;
+  }
+
+
+  @Override
+  public boolean isAppropriateListener(FacesListener listener)
+  {
+    return (listener instanceof ChartDrillDownListener);
+  }
+
+  @Override
+  public void processListener(FacesListener listener)
+  {
+    ((ChartDrillDownListener) listener).processChartDrillDown(this);
+  }
+  
+  /**
+   * returns an array of series indices where the user clicked.
+   * In most cases only index 0 is applicable. Currently multiple indices
+   * are applicable only to areaChart and radarArea chart types.
+   * 
+   * @return the array of series indices as an int array
+   */
+  public int[] getSeriesIndices()
+  {
+    return _seriesIndices;
+  }
+
+  /**
+   * returns an array of yvalue indices where the user clicked.
+   * In most cases only index 0 is applicable. Currently multiple indices
+   * are applicable only to areaChart and radarArea chart types.
+   * This parameter might be null for charts where the interpolated value is
+   * computed(for e.g. area, line etc.)
+   * 
+   * @return the array of yvalue indices as an int array
+   */
+  public int[] getYValueIndices()
+  {
+    return _yValueIndices;
+  }
+
+  /**
+   * returns an array of yvalues where the user clicked.
+   * The values in this event might be different from the
+   * data set used for displaying the chart since it might represent
+   * interpolated values (for e.g. area, line etc.)
+   * 
+   * @return the array of yvalues as a float array
+   */
+  public double[] getYValues()
+  {
+    return _yValues;
+  }
+
+  /**
+   * returns an array of xvalues where the user clicked. This is currently 
+   * only applicable to XYLine and scatterPlot
+   * The values in this event might be different from the
+   * data set used for displaying the chart since it might represent
+   * interpolated values (XYLine)
+   * 
+   * @return the array of xvalues as a float array
+   */
+  public double[] getXValues()
+  {
+    return _xValues;
+  }
+  
+  private final int[] _seriesIndices;
+  private final int[] _yValueIndices; 
+  private final double[] _yValues; 
+  private final double[] _xValues;
+
+}

Added: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownListener.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownListener.java?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownListener.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/event/ChartDrillDownListener.java Thu Sep 28 11:07:57 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright  2003-2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+package org.apache.myfaces.trinidad.event;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+
+/**
+ * Listener for ChartDrillDownEvents.
+ * <p>
+ * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/event/ChartDrillDownListener.java#0 $) $Date: 17-sep-2006.19:09:08 $
+ * @author The Oracle ADF Faces Team
+ */
+public interface ChartDrillDownListener extends FacesListener
+{
+  public void processChartDrillDown(ChartDrillDownEvent event)
+    throws AbortProcessingException;
+}

Added: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChartModel.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChartModel.java?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChartModel.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/model/ChartModel.java Thu Sep 28 11:07:57 2006
@@ -0,0 +1,111 @@
+/*
+ * Copyright  2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ */
+package org.apache.myfaces.trinidad.model;
+
+import java.awt.Color;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * The data model used by chart components.
+ * The chart is draw using values from the yValues 2D array. The yValues are returned by
+ * {@link #getYValues} method. The maximum and the minimum are controlled by 
+ * {@link #getMaxYValue} method and {@link #getMinYValue} method. The default maximum value
+ * is 120% of the maximum of the yValues if no value is specified. The default minimum value 
+ * is 0. For XYLine and Scatter plots xValues are also required. The xValues are controlled by
+ * {@link #getXValues} method, {@link #getMaxXValue} method and {@link #getMinXValue} method.
+ * 
+ * The labels on y-axis of the graph are calculated from the yValues. However the labels on the
+ * x-axis are controlled by the group labels array returned by  {@link #getGroupLabels} method.
+ * 
+ * Each group of values in the chart may contain multiple series. The number of series in a
+ * group are controlled by {@link #getSeriesLabels} method. 
+ * 
+ * The colors of the series are controlled by {@link #getSeriesColors} method.
+ * 
+ * The chart title, sub-title and the footnote can be specified using 
+ * {@link #getTitle} method, {@link #getSubTitle} method and {@link #getFootNote} method
+ * @author Venkata Guddanti
+ */
+public abstract class ChartModel
+{
+  public abstract List<String> getSeriesLabels();
+  
+  public abstract List<String> getGroupLabels();
+  
+  public List<Color> getSeriesColors()
+  {
+    return _defaultColors;
+  }
+  
+  public List<List<Double>> getXValues()
+  {
+    return null; 
+  }
+
+  public abstract List<List<Double>> getYValues();
+
+  public Double getMaxYValue()
+  {
+    return null; 
+  }
+
+
+  public Double getMinYValue()
+  {
+    return null; 
+  }
+
+
+  public Double getMaxXValue()
+  {
+    return null; 
+  }
+
+
+  public Double getMinXValue()
+  {
+    return null; 
+  }
+
+
+  public String getTitle()
+  {
+    return null; 
+  }
+
+  public String getSubTitle()
+  {
+    return null; 
+  }
+
+
+  public String getFootNote()
+  {
+    return null; 
+  }
+  
+  
+  private static final List<Color> _defaultColors = new ArrayList<Color>();  
+  static
+  {
+    _defaultColors.addAll(
+      Arrays.asList(new Color[]{new Color(231,109,72,0),new Color(110,166,243,0),new Color(157,206,110,0),new Color(252,196,111,0),new Color(114,126,142,0),new Color(109,44,145,0)}));
+  }  
+}

Added: incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/Chart.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/Chart.xml?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/Chart.xml (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/Chart.xml Thu Sep 28 11:07:57 2006
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation.
+
+  Licensed 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.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+              xmlns:tr="http://myfaces.apache.org/trinidad"
+              xmlns:xi="http://www.w3.org/2001/XInclude"
+              xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"
+              xmlns:mafp="http://myfaces.apache.org/maven-trinidad-plugin"
+              xmlns:xhtml="http://www.w3.org/1999/xhtml">
+  <component>
+    <description><![CDATA[The ADF Chart is used to diplay data in a chart format.]]>
+    </description>
+    <icon>
+      <small-icon>/org/apache/myfaces/trinidad/metadata/icons/basechart.png</small-icon>
+    </icon>
+    <component-type>org.apache.myfaces.trinidad.Chart</component-type>
+    <component-class>org.apache.myfaces.trinidad.component.UIXChart</component-class>
+    <property>
+      <description><![CDATA[the data model being used by this component.The specific model class must be derived from 
+        <code>org.apache.myfaces.trinidad.model.ChartModel</code>. 
+        The derived class must override the abstract methods to provide the required values for chart display.]]>
+      </description>
+      <property-name>value</property-name>
+      <property-class>java.lang.Object</property-class>
+      <property-extension>
+        <mfp:property-metadata>
+          <mfp:preferred>true</mfp:preferred>
+        </mfp:property-metadata>
+        <mfp:required>true</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[a method reference to a drill down listener that
+         will be called when the user drills down into the chart data.The method must take a parameter of type <code>org.apache.myfaces.trinidad.event.ChartDrillDownEvent</code>.]]>
+      </description>
+      <property-name>chartDrillDownListener</property-name>
+      <property-class>javax.faces.el.MethodBinding</property-class>
+      <property-extension>
+        <mfp:method-binding-signature>
+          <mfp:parameter-type>org.apache.myfaces.trinidad.event.ChartDrillDownEvent</mfp:parameter-type>
+          <mfp:return-type>void</mfp:return-type>
+        </mfp:method-binding-signature>
+        <mfp:property-metadata>
+          <mfp:preferred>true</mfp:preferred>
+        </mfp:property-metadata>
+        <mfp:state-holder>yes</mfp:state-holder>
+      </property-extension>
+    </property>
+    <component-extension>
+      <mfp:component-family>org.apache.myfaces.trinidad.Chart</mfp:component-family>
+      <mfp:component-supertype>org.apache.myfaces.trinidad.ComponentBase</mfp:component-supertype>
+      <mfp:renderer-type>org.apache.myfaces.trinidad.Chart</mfp:renderer-type>
+      <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.UIXChartTag</mfp:tag-class>
+      <mfp:long-description><![CDATA[<html:p>
+          The ADF Chart is used to display data in a Chart Format.
+        </html:p>]]>
+      </mfp:long-description>
+      <mfp:author>Venkata Guddanti</mfp:author>
+      <mfp:component-metadata>
+        <mfp:favorite-property>id</mfp:favorite-property>
+        <mfp:group>${md:getTranslatedString("PALETTE_DATA")}</mfp:group>
+      </mfp:component-metadata>
+      <mfp:tag-class-modifier>abstract</mfp:tag-class-modifier>
+      <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
+    </component-extension>
+  </component>
+</faces-config>
+

Added: incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreChart.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreChart.xml?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreChart.xml (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/components/trinidad/core/CoreChart.xml Thu Sep 28 11:07:57 2006
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="utf-8" ?> <!--
+  Copyright 2006 The Apache Software Foundation.
+
+  Licensed 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.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:tr="http://myfaces.apache.org/trinidad"
+  xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml">
+  <component>
+    <description><![CDATA[The ADF Chart is used to diplay data in a chart format.]]>
+    </description>
+    <icon>
+      <small-icon>/org/apache/myfaces/trinidad/metadata/icons/chart.png</small-icon>
+    </icon>
+    <component-type>org.apache.myfaces.trinidad.CoreChart</component-type>
+    <component-class>org.apache.myfaces.trinidad.component.core.data.CoreChart</component-class>
+    <xi:include href="includes/CommonAttrs.xml" xpointer="/faces-config/component/*" />
+    <property>
+      <description><![CDATA[The type of chart. Possible Values are: verticalBar horizontalBar stackedVerticalBar stackedHorizontalBar pie area stackedArea line barLine XYLine scatterPlot radar radarArea funnel circularGauge semiCircularGauge.]]></description>
+      <property-name>type</property-name>
+      <property-class>java.lang.String</property-class>
+      <default-value>verticalBar</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+        <mfp:property-values>
+          verticalBar horizontalBar stackedVerticalBar stackedHorizontalBar pie area stackedArea line barLine XYLine scatterPlot radar radarArea funnel circularGauge semiCircularGauge
+      </mfp:property-values>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[Specifies URI for the template document from which the chart elements are cloned.
+        If this attribute is null, the chart component uses a default template. The default template is chosen based
+        on whether the useGradient attribute is true or false.
+        The template document is useful for changing the Look and Feel of the chart. 
+        Some examples include:1)A developer may want to skin the chart to match its corporate Look and Feel.
+        2)A developer may want to put water marks/background images inside the chart.
+        3)A developer may want to change the template for the gauges used in the gauge charts.
+        4)A developer may want to turn off gradients and instead use filters to set some interesting effects on the chart elements. 
+        ]]></description>
+      <property-name>templateSource</property-name>
+      <property-class>java.lang.String</property-class>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[Specifies if the chart is drawn with a perspective (2.5D). 
+      By default the chart is draw with a perspective.]]></description>
+      <property-name>perspective</property-name>
+      <property-class>boolean</property-class>
+      <default-value>true</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[Specified the location of the legend. The legend can be turned off by setting this attribute to none.
+      Otherwise it can be drawn at top, start, end or bottom.]]></description>
+      <property-name>legendPosition</property-name>
+      <property-class>java.lang.String</property-class>
+      <default-value>bottom</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+        <mfp:property-values>
+          none bottom end top start
+        </mfp:property-values>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[The duration of the animation for the chart components in milliseconds.
+      Animation can be turned off if the animationDuration is set to 0. The default value is 1000ms.]]></description>
+      <property-name>animationDuration</property-name>
+      <property-class>int</property-class>
+      <default-value>1000</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[This attribute controls the number of horizontal major grid lines displayed in the chart.
+      For horizontal charts(horizontalBar, stackedHorizontalBar) this attribute controls the horizontal major grid lines.
+      The default is 3.]]></description>
+      <property-name>YMajorGridLineCount</property-name>
+      <property-class>int</property-class>
+      <default-value>3</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[This attribute controls the number of minor grid lines displayed within a major grid section.
+      The default value is -1, which means it varies per chart type. Currently it is used only for gauge charts 
+      with a default of 3.]]></description>
+      <property-name>YMinorGridLineCount</property-name>
+      <property-class>int</property-class>
+      <default-value>-1</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[This attribute controls the number of vertical major grid lines displayed in the chart.
+      The default value is -1, which implies that the vertical major grid lines are controlled by the groupLabels 
+      in the chart model. This parameter along with the groupLabels provide flexibility in labeling the
+      groups. For e.g. one can display a vertical bar chart with 2 years data. Only quarters may be labeled and XMajorGridLineCount can 
+      be 1 for splitting the data into two sections.]]></description>
+      <property-name>XMajorGridLineCount</property-name>
+      <property-class>int</property-class>
+      <default-value>-1</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[The maximum precision of the numbers displayed on the yAxis(xAxis for horizontal charts). 
+      The default is 0.]]></description>
+      <property-name>maxPrecision</property-name>
+      <property-class>int</property-class>
+      <default-value>0</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[Specifies if gradients are used to display chart elements. 
+      By default the chart elements use gradients.]]></description>
+      <property-name>gradientsUsed</property-name>
+      <property-class>boolean</property-class>
+      <default-value>true</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[Specifies if tooltips are displayed or not.]]></description>
+      <property-name>tooltipsVisible</property-name>
+      <property-class>boolean</property-class>
+      <default-value>true</default-value>
+      <property-extension>
+        <mfp:required>false</mfp:required>
+      </property-extension>
+    </property>
+    <component-extension>
+      <mfp:component-supertype>org.apache.myfaces.trinidad.Chart</mfp:component-supertype>
+      <mfp:renderer-type>org.apache.myfaces.trinidad.Chart</mfp:renderer-type>
+      <mfp:tag-name>tr:chart</mfp:tag-name>
+      <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.core.data.CoreChartTag</mfp:tag-class>
+      <mfp:long-description><![CDATA[<html:p>
+          The ADF Chart is used to display data as a chart.
+        </html:p>]]>
+      </mfp:long-description>
+      <mfp:example>
+        <xhtml:p></xhtml:p>
+        <mfp:source-code><![CDATA[<tr:chart id="chart" verticalMajorSections="8" value="#{chartBean.value}" inlineStyle="width:680px; height:400px;"/>]]>
+        </mfp:source-code>
+      </mfp:example>
+      <mfp:author>Venkata Guddanti</mfp:author>
+      <mfp:component-metadata>
+        <mfp:favorite-property>id</mfp:favorite-property>
+        <mfp:group>${md:getTranslatedString("PALETTE_DATA")}</mfp:group>
+      </mfp:component-metadata>
+      <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
+    </component-extension>
+  </component>
+</faces-config>

Added: incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/Chart.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/Chart.xml?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/Chart.xml (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/renderers/trinidad/Chart.xml Thu Sep 28 11:07:57 2006
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 2006 The Apache Software Foundation.
+
+  Licensed 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.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+              xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
+  <render-kit>
+    <render-kit-id>org.apache.myfaces.trinidadinternal.core</render-kit-id>
+    <renderer>
+      <component-family>org.apache.myfaces.trinidad.Chart</component-family>
+      <renderer-type>org.apache.myfaces.trinidad.Chart</renderer-type>
+      <renderer-class>org.apache.myfaces.trinidadinternal.renderkit.core.desktop.ChartRenderer</renderer-class>
+      <renderer-extension>
+        <mfp:component-type>org.apache.myfaces.trinidad.CoreChart</mfp:component-type>
+        <mfp:unsupported-agents>pda phone voice</mfp:unsupported-agents>
+      </renderer-extension>
+    </renderer>
+  </render-kit>
+</faces-config>

Added: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/ChartBean.java Thu Sep 28 11:07:57 2006
@@ -0,0 +1,360 @@
+/*
+* Copyright 2006 The Apache Software Foundation.
+*
+* Licensed 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.
+*/
+package org.apache.myfaces.trinidaddemo;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidad.component.core.data.CoreChart;
+import org.apache.myfaces.trinidad.context.RequestContext;
+import org.apache.myfaces.trinidad.event.ChartDrillDownEvent;
+import org.apache.myfaces.trinidad.model.ChartModel;
+import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
+import org.apache.myfaces.trinidad.util.Service;
+
+
+/**
+ * Managed bean for chat component demos.
+ * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-demo/src/main/java/oracle/adfdemo/view/faces/ChartBean.java#1 $) $Date: 16-aug-2005.15:12:27 $
+ */
+public class ChartBean implements java.io.Serializable
+{
+  public ChartModel getValue()
+  {
+    return _chartModel;
+  }
+  
+  public ComponentEditorHandler getEditor()
+  {
+    return _editorBean;
+  }
+  
+  public String updatePartial()
+  {
+    _editorBean.update();
+    RequestContext afContext = RequestContext.getCurrentInstance();
+    afContext.addPartialTarget(_editorBean.getComponent());
+    return null;
+  }
+  
+  public boolean isLargerDataSet()
+  {
+    return _largerDataSet;
+  }
+
+  public void setLargerDataSet(boolean b)
+  {
+    _largerDataSet = b;
+    CoreChart chart = (CoreChart)_editorBean.getComponent();
+    if(_largerDataSet)
+      chart.setXMajorGridLineCount(1);
+    else
+      chart.setXMajorGridLineCount(-1);
+  }
+  
+  public void drillDown(ChartDrillDownEvent event)
+  {
+    FacesContext context = FacesContext.getCurrentInstance();
+
+    String message =  "seriesIndices : " + _getEventIntsAsString(event.getSeriesIndices()) +
+        " yValueIndices : " + _getEventIntsAsString(event.getYValueIndices()) +
+        " yValues :" + _getEventDoublesAsString(event.getYValues()) +
+        " xValues :" + _getEventDoublesAsString(event.getXValues());
+    ExtendedRenderKitService erks = 
+      Service.getRenderKitService(context,
+                                  ExtendedRenderKitService.class);
+    erks.addScript(context,
+                   "alert('Confirmation from ChartBean: " + 
+                   message +
+                   "');");
+  }
+  
+  private String _getEventIntsAsString(int[] intArray)
+  {
+    if(intArray!=null)
+    {
+      StringWriter sw = new StringWriter();
+      for(int i=0; i<intArray.length; ++i)
+      {
+        if(i!=0)
+          sw.append(',');
+        sw.append(String.valueOf(intArray[i]));
+      }
+      return sw.toString();
+    }
+    else
+      return null;
+  }
+  
+  private String _getEventDoublesAsString(double[] intArray)
+  {
+    if(intArray!=null)
+    {
+      StringWriter sw = new StringWriter();
+      for(int i=0; i<intArray.length; ++i)
+      {
+        if(i!=0)
+          sw.append(',');
+        sw.append(String.valueOf(intArray[i]));
+      }
+      return sw.toString();
+    }
+    else
+      return null;
+  }
+
+
+  private class MyChartModel extends ChartModel
+  {
+    public List<String> getSeriesLabels()
+    {
+      if(_largerDataSet)
+        return _largeSeriesLabels;
+      else
+        return _seriesLabels;
+    }
+
+    public List<String> getGroupLabels()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if("circularGauge".equals(chart.getType()) || 
+         "semiCircularGauge".equals(chart.getType()) || 
+         !_largerDataSet)
+        return _groupLabels;
+      else
+        return _largeGroupLabels;
+    }
+        
+    public List<List<Double>> getXValues()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if("XYLine".equals(chart.getType()) || "scatterPlot".equals(chart.getType()))
+      {
+        if(_largerDataSet)
+        {
+          if(_largerXValues == null)
+          {
+            _largerXValues = new ArrayList<List<Double>>();
+            _loadLargerValues(_largerXValues, "/components/chartData/NasdaqXData.txt");
+          }
+          return _largerXValues;
+        }
+        return _chartXValues;
+      }
+      else
+        return null;
+    }
+  
+    public List<List<Double>> getYValues()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if("circularGauge".equals(chart.getType()) || 
+         "semiCircularGauge".equals(chart.getType()))
+        return _dialchartYValues;
+      else
+      {
+        if(_largerDataSet)
+        {
+          if(_largerYValues == null)
+          {
+            _largerYValues = new ArrayList<List<Double>>();
+            _loadLargerValues(_largerYValues, "/components/chartData/NasdaqData.txt");
+          }
+          return _largerYValues;
+        }
+        return _chartYValues;
+      }
+    }
+  
+    private void _loadLargerValues(ArrayList<List<Double>> valuesList, String file)
+    {
+      FacesContext context = FacesContext.getCurrentInstance();
+      InputStream in = context.getExternalContext().getResourceAsStream(file);
+      if(in != null)
+      {
+        
+        BufferedReader rd
+                  = new BufferedReader(new InputStreamReader(in));
+        
+        String line;
+        try
+        {
+          while((line = rd.readLine())!=null)
+          {
+            String[] strings = line.split("\t");
+            ArrayList<Double> values = new ArrayList<Double>(strings.length);
+            for(String s:strings)
+            {
+              values.add(Double.parseDouble(s));
+            }
+            valuesList.add(values);
+          }         
+        }
+        catch(IOException ioe)
+        {
+          System.out.println("error reading chart data");
+        }
+      }
+    }
+
+
+    public Double getMaxYValue()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if("circularGauge".equals(chart.getType()) || 
+         "semiCircularGauge".equals(chart.getType()))
+        return 200.0;
+      else if("stackedVerticalBar".equals(chart.getType()) || 
+         "stackedHorizontalBar".equals(chart.getType()) ||
+         "stackedArea".equals(chart.getType()))
+      {
+        if(_largerDataSet)
+          return 7500.0;
+        else
+          return 500000.0;
+      }
+      else
+      {
+        if(_largerDataSet)
+          return 2500.0;
+        else
+          return 200000.0;
+      }  
+    }
+  
+  
+    public Double getMinYValue()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if(!"circularGauge".equals(chart.getType()) && 
+         !"semiCircularGauge".equals(chart.getType()) &&
+         !"stackedVerticalBar".equals(chart.getType()) && 
+         !"stackedHorizontalBar".equals(chart.getType()) &&
+         !"stackedArea".equals(chart.getType()) &&
+         _largerDataSet)
+      {
+          return 2000.0;
+      }
+      return 0.0; 
+    }
+  
+  
+    public Double getMaxXValue()
+    {
+      if(_largerDataSet)
+        return 54.0;
+      else
+        return 10.0; 
+    }
+  
+  
+    public Double getMinXValue()
+    {
+      if(_largerDataSet)
+        return 0.0;
+      else
+        return 6.0; 
+    }
+  
+  
+    public String getTitle()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if("circularGauge".equals(chart.getType()) || 
+         "semiCircularGauge".equals(chart.getType()))
+        return "Values in 1000s";
+      else
+      {
+        if(_largerDataSet)
+          return "NASDAQ Q4 2005 - Q3 2006";
+        else
+          return "Title";
+      }
+    }
+  
+    public String getSubTitle()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if("circularGauge".equals(chart.getType()) || 
+         "semiCircularGauge".equals(chart.getType()) || _largerDataSet)
+        return null;
+      else
+        return "SubTitle"; 
+    }
+  
+  
+    public String getFootNote()
+    {
+      CoreChart chart = (CoreChart)_editorBean.getComponent();
+      if("circularGauge".equals(chart.getType()) || 
+         "semiCircularGauge".equals(chart.getType()) || _largerDataSet)
+        return null;
+      else
+        return "FootNote"; 
+    }
+    
+    private final List<String> _groupLabels = 
+      Arrays.asList(new String[]{"June", "July", "August", "September","October"});
+
+    private final List<String> _largeGroupLabels = 
+      Arrays.asList(new String[]{"Q4-2005", "Q1-2006", "Q2-2006", "Q3-2006"});
+  
+    private final List<String> _seriesLabels = 
+      Arrays.asList(new String[]{"Previous", "Target", "Actual"});
+    
+    private final List<String> _largeSeriesLabels = 
+      Arrays.asList(new String[]{"Opening", "Low", "High"});
+      
+    private final ArrayList<List<Double>> _chartYValues;
+    private final ArrayList<List<Double>> _chartXValues; 
+    private final ArrayList<List<Double>> _dialchartYValues;
+    private ArrayList<List<Double>> _largerYValues;
+    private ArrayList<List<Double>> _largerXValues;
+    {
+      _chartYValues = new ArrayList<List<Double>>();
+      _chartYValues.add(Arrays.asList(new Double[]{135235.0, 155535.0, 141725.0}));
+      _chartYValues.add(Arrays.asList(new Double[]{106765., 131725., 127868.}));
+      _chartYValues.add(Arrays.asList(new Double[]{108456., 119326., 139326.}));
+      _chartYValues.add(Arrays.asList(new Double[]{136765., 147265., 184349.})); 
+      _chartYValues.add(Arrays.asList(new Double[]{107868., 113968., 174349.}));
+
+      _dialchartYValues = new ArrayList<List<Double>>();
+      _dialchartYValues.add(Arrays.asList(new Double[]{135.}));
+      _dialchartYValues.add(Arrays.asList(new Double[]{106.}));
+    
+      _chartXValues = new ArrayList<List<Double>>();
+      _chartXValues.add(Arrays.asList(new Double[]{6.1, 6.3, 6.5}));
+      _chartXValues.add(Arrays.asList(new Double[]{6.8, 7.1, 7.3}));
+      _chartXValues.add(Arrays.asList(new Double[]{7.6, 7.8, 8.0}));
+      _chartXValues.add(Arrays.asList(new Double[]{8.25, 8.55, 8.78}));
+      _chartXValues.add(Arrays.asList(new Double[]{9.23, 9.48, 9.88}));
+    }
+    
+  } 
+  
+  private boolean _largerDataSet = false;
+  private final ChartModel _chartModel = new MyChartModel(); 
+  private final ComponentEditorHandler _editorBean = new ComponentEditorHandler();
+}

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=450952&r1=450951&r2=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/WEB-INF/faces-config.xml Thu Sep 28 11:07:57 2006
@@ -598,6 +598,12 @@
     <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>
 
+    <managed-bean>
+     <managed-bean-name>chart</managed-bean-name>
+     <managed-bean-class>org.apache.myfaces.trinidaddemo.ChartBean</managed-bean-class>
+     <managed-bean-scope>session</managed-bean-scope>
+   </managed-bean>
+
   <managed-bean>
     <managed-bean-name>toggle</managed-bean-name>
     <managed-bean-class>org.apache.myfaces.trinidaddemo.ToggleBean</managed-bean-class>
@@ -747,6 +753,7 @@
       <property-name>fileList</property-name>
       <list-entries>
         <value-class>java.lang.String</value-class>
+        <value>chart.jspx</value>
         <value>chooseColor.jspx</value>
         <value>chooseDate.jspx</value>
         <value>column.jspx</value>
@@ -1912,6 +1919,13 @@
       <to-view-id>/components/html/cellFormat.jspx</to-view-id>
       <redirect/>
     </navigation-case>
+
+     <navigation-case>
+       <from-outcome>guide.chart</from-outcome>
+       <to-view-id>/components/chart.jspx</to-view-id>
+       <redirect/>
+     </navigation-case>
+
 
     <navigation-case>
       <from-outcome>guide.chooseColor</from-outcome>

Added: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chart.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chart.jspx?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chart.jspx (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chart.jspx Thu Sep 28 11:07:57 2006
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+<!--
+  Copyright 2006 The Apache Software Foundation.
+
+  Licensed 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.
+-->
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
+          xmlns:f="http://java.sun.com/jsf/core"
+          xmlns:h="http://java.sun.com/jsf/html"
+          xmlns:trh="http://myfaces.apache.org/trinidad/html"
+          xmlns:tr="http://myfaces.apache.org/trinidad">
+  <jsp:directive.page contentType="text/html;charset=utf-8"/>
+  <f:view>
+    <tr:document title="Chart Demo">
+      <tr:form>
+        <tr:panelGroupLayout layout="vertical">
+          <f:facet name="separator">
+            <tr:separator />
+          </f:facet>
+          <tr:commandLink immediate="true" text="Component Guide"
+              action="guide"/>
+          <tr:outputFormatted styleUsage="instruction" value="&lt;b>Chart&lt;/b>"/>
+          <tr:chart chartDrillDownListener="#{chart.drillDown}" id="chart" YMajorGridLineCount="7" value="#{chart.value}" inlineStyle="width:680px; height:400px;" 
+            binding="#{chart.editor.component}"/>
+          <tr:panelGroupLayout layout="horizontal">
+            <tr:commandButton  text="Update"
+                              action="#{chart.editor.update}"/>
+            <tr:commandButton id="partialButton" partialSubmit="true" text="Update Partial"
+                              action="#{chart.updatePartial}"/>
+            
+            <tr:selectBooleanCheckbox immediate="true" label="Larger Data Set"
+                value="#{chart.largerDataSet}"/>
+
+          </tr:panelGroupLayout>
+          <tr:table var="row" rows="100" value="#{chart.editor.attributes}" 
+                    summary="Attributes">
+            <tr:column>
+              <f:facet name="header">
+                <tr:outputText value="Name"/>
+              </f:facet>
+              <tr:outputText value="#{row.name}"/>
+            </tr:column>
+            <tr:column>
+              <f:facet name="header">
+                <tr:outputText value="Value"/>
+              </f:facet>
+              <tr:inputText immediate="true"
+                             readOnly="#{row.name == 'value' ||
+                                         row.name == 'var' ||
+                                         row.name == 'currencyKey' ||
+                                         row.name == 'currencyString' ||
+                                         row.name == 'rowKey' ||
+                                         row.name == 'id' ||
+                                         row.name == 'rendererType' ||
+                                         row.name == 'submittedValue'}"
+                             rendered="#{row.type == 'string'}"
+                             value="#{row.value}"
+                             shortDesc="Type to change '#{row.name}'"/>
+              <tr:inputText immediate="true"
+                             readOnly="#{row.name == 'rowIndex'}"
+                             rendered="#{row.type == 'integer'}"
+                             value="#{row.value}"
+                             shortDesc="Type to change '#{row.name}'">
+                <f:converter converterId="javax.faces.Integer"/>
+              </tr:inputText>
+              <tr:inputText immediate="true"
+                            rendered="#{row.type == 'date'}"
+                            value="#{row.value}"
+                            shortDesc="Type to change '#{row.name}'">
+                <f:facet name="help">
+                  <tr:outputText value="Sample format: 2004-07-15"/>
+                </f:facet>
+                <f:convertDateTime pattern="yyyy-MM-dd"/>
+              </tr:inputText>
+              <tr:selectBooleanCheckbox rendered="#{row.type == 'boolean'}"
+                                         readOnly="#{row.name == 'localValueSet' ||
+                                                     row.name == 'valid' ||
+                                                     row.name == 'transient'}"
+                                         immediate="true" value="#{row.value}"
+                                         shortDesc="Click to change '#{row.name}'"/>
+            </tr:column>
+          </tr:table>
+        </tr:panelGroupLayout>
+      </tr:form>
+    </tr:document>
+  </f:view>
+</jsp:root>

Added: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqData.txt
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqData.txt?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqData.txt (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqData.txt Thu Sep 28 11:07:57 2006
@@ -0,0 +1,53 @@
+2176.47	2142.73	2186.83
+2157.37	2093.06	2162.14
+2127.9	2107.7	2151.69
+2152.7	2069.04	2167
+2091.68	2025.58	2093.23
+2065.54	2042.03	2096.43
+2089.51	2063.81	2121.36
+2094.37	2094.37	2172.68
+2174.25	2162.65	2205.36
+2203.79	2176.54	2234.3
+2226.62	2219.25	2269.3
+2263.55	2230.19	2273.61
+2269.07	2233.74	2278.16
+2263.97	2247.32	2271.85
+2254.64	2213.52	2256.03
+2253.05	2200.51	2259.68
+2216.53	2189.91	2306.72
+2306.18	2303.13	2332.92
+2302.56	2245.2	2311.71
+2255.31	2241.02	2314.36
+2306.24	2255.99	2313.98
+2263.12	2235.41	2284.52
+2252.04	2232.68	2294.63
+2283.52	2256.75	2293.74
+2291.48	2276.74	2324.92
+2306.66	2239.54	2309.51
+2269.44	2263.68	2323.79
+2311.93	2282.38	2332.95
+2312.47	2299.56	2353.14
+2352.24	2332.67	2375.45
+2340.39	2302.19	2343.59
+2325.56	2299.42	2375.54
+2338.78	2315.12	2361.89
+2329.79	2295.03	2344.37
+2342.41	2243.32	2352.56
+2234.01	2164.54	2245.18
+2178.15	2135.81	2210.49
+2202.57	2164.74	2233.88
+2212.35	2100.43	2219.41
+2137.47	2065.11	2147.91
+2136.6	2103.77	2152.56
+2126.46	2090.78	2183.48
+2177.91	2126.64	2190.44
+2135.96	2027.11	2142.36
+2034.76	2012.78	2086.07
+2030.49	2030.49	2094.95
+2087.86	2052.75	2119.01
+2079.45	2048.22	2097.76
+2073.01	2067.69	2168.11
+2151.91	2122.65	2162.68
+2140.52	2139.57	2198.58
+2192.94	2149.36	2207.55
+2152.12	2147.44	2247.16

Added: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqXData.txt
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqXData.txt?view=auto&rev=450952
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqXData.txt (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/components/chartData/NasdaqXData.txt Thu Sep 28 11:07:57 2006
@@ -0,0 +1,53 @@
+1	1	1
+2	2	2
+3	3	3
+4	4	4
+5	5	5
+6	6	6
+7	7	7
+8	8	8
+9	9	9
+10	10	10
+11	11	11
+12	12	12
+13	13	13
+14	14	14
+15	15	15
+16	16	16
+17	17	17
+18	18	18
+19	19	19
+20	20	20
+21	21	21
+22	22	22
+23	23	23
+24	24	24
+25	25	25
+26	26	26
+27	27	27
+28	28	28
+29	29	29
+30	30	30
+31	31	31
+32	32	32
+33	33	33
+34	34	34
+35	35	35
+36	36	36
+37	37	37
+38	38	38
+39	39	39
+40	40	40
+41	41	41
+42	42	42
+43	43	43
+44	44	44
+45	45	45
+46	46	46
+47	47	47
+48	48	48
+49	49	49
+50	50	50
+51	51	51
+52	52	52
+53	53	53