0 Replies Latest reply on Dec 7, 2007 2:33 PM by csaldanh

    Patch to upgrade jfreechart to v1.0.2

      Currently the JMX-console uses jfreechart v0.9.20. When upgrading to v1.0.2 it gave compilation errors in console. The following patch takes care of the upgrade:

      diff -Naur trunk/build/build-thirdparty.xml trunk_jfreechart_upgrade/build/build-thirdparty.xml
      --- trunk/build/build-thirdparty.xml 2007-12-06 16:05:21.000000000 -0500
      +++ trunk_jfreechart_upgrade/build/build-thirdparty.xml 2007-12-06 16:37:53.000000000 -0500
      @@ -113,7 +113,7 @@



      -
      +



      diff -Naur trunk/console/src/main/org/jboss/console/manager/interfaces/impl/GraphMBeanAttributeAction.java trunk_jfreechart_upgrade/console/src/main/org/jboss/console/manager/interfaces/impl/GraphMBeanAttributeAction.java
      --- trunk/console/src/main/org/jboss/console/manager/interfaces/impl/GraphMBeanAttributeAction.java 2007-12-06 16:05:38.000000000 -0500
      +++ trunk_jfreechart_upgrade/console/src/main/org/jboss/console/manager/interfaces/impl/GraphMBeanAttributeAction.java 2007-12-06 16:39:25.000000000 -0500
      @@ -28,8 +28,8 @@
      import org.jfree.chart.ChartFrame;
      import org.jfree.chart.JFreeChart;
      import org.jfree.chart.plot.PlotOrientation;
      -import org.jfree.data.AbstractXYDataset;
      -import org.jfree.data.DatasetChangeEvent;
      +import org.jfree.data.xy.AbstractXYDataset;
      +import org.jfree.data.general.DatasetChangeEvent;

      import javax.management.ObjectName;
      import java.util.ArrayList;
      @@ -84,7 +84,7 @@
      *
      * @return the x-value for the specified series and item.
      */
      - public Number getXValue(int series, int item)
      + public Number getX(int series, int item)
      {
      return new Integer(item);
      }
      @@ -97,12 +97,59 @@
      *
      * @return the y-value for the specified series and item.
      */
      - public Number getYValue(int series, int item)
      + public Number getY(int series, int item)
      {
      return (Number) data.get(item);
      }

      /**
      + * Returns the x-value for the specified series and item. Series are numbered 0, 1, ...
      + *
      + * @param series the index (zero-based) of the series.
      + * @param item the index (zero-based) of the required item.
      + *
      + * @return the x-value for the specified series and item.
      + */
      + public double getXValue(int series, int item)
      + {
      + return item;
      + }
      +
      + /**
      + * Returns the y-value for the specified series and item. Series are numbered 0, 1, ...
      + *
      + * @param series the index (zero-based) of the series.
      + * @param item the index (zero-based) of the required item.
      + *
      + * @return the y-value for the specified series and item.
      + */
      + public double getYValue(int series, int item)
      + {
      + double result = Double.NaN;
      + Number x = (Number)data.get(item);
      + if (x != null) {
      + result = x.doubleValue();
      + }
      + return result;
      + }
      +
      + /**
      + * Returns the key for a series.
      + *
      + * If series is not within the specified range, the
      + * implementing method should throw an {@link IndexOutOfBoundsException}
      + * (preferred) or an {@link IllegalArgumentException}.
      + *
      + * @param series the series index (in the range 0 to
      + * getSeriesCount() - 1).
      + *
      + * @return The series key.
      + */
      + public Comparable getSeriesKey(int series){
      + return null; //Switching to new jfreechart API so really don't use this.
      + }
      +
      + /**
      * Returns the number of series in the dataset.
      *
      * @return the number of series in the dataset.
      diff -Naur trunk/console/src/main/org/jboss/console/plugins/monitor/ManageSnapshotServlet.java trunk_jfreechart_upgrade/console/src/main/org/jboss/console/plugins/monitor/ManageSnapshotServlet.java
      --- trunk/console/src/main/org/jboss/console/plugins/monitor/ManageSnapshotServlet.java 2007-12-06 16:05:37.000000000 -0500
      +++ trunk_jfreechart_upgrade/console/src/main/org/jboss/console/plugins/monitor/ManageSnapshotServlet.java 2007-12-06 16:41:22.000000000 -0500
      @@ -38,8 +38,8 @@
      import org.jfree.chart.ChartUtilities;
      import org.jfree.chart.JFreeChart;
      import org.jfree.chart.plot.PlotOrientation;
      -import org.jfree.data.DefaultTableXYDataset;
      -import org.jfree.data.XYSeries;
      +import org.jfree.data.xy.DefaultTableXYDataset;
      +import org.jfree.data.xy.XYSeries;

      /**
      * @author Bill Burke