4 Replies Latest reply: Jan 8, 2007 12:54 AM by 807607 RSS

    JFreeChart: Ambiguous method signatures in DefaultCategoryDataSet

      Any idea how to work around this? I understand the error since double is an instance of Number, but the source is all compiled in the .jar archive. I'm using Java5. Perhaps this code worked ok in 1.4 maybe.
      w3style:~/java/SunTracker d11wtq$ javac SunTracker.java 
      ./org/w3style/suntracker/grapher/AzimuthAltitudeGraph.java:14: reference to addValue is ambiguous, both method
      in org.jfree.data.category.DefaultCategoryDataset and method
      in org.jfree.data.category.DefaultCategoryDataset match
                      data.addValue(1.0, "Line 1", 1);
      1 error
      w3style:~/java/SunTracker d11wtq$
      The issue is with the jfree package but I'm probably using it wrongly:
      package org.w3style.suntracker.grapher;
      import java.awt.image.BufferedImage;
      import org.jfree.chart.ChartFactory;
      import org.jfree.chart.JFreeChart;
      import org.jfree.data.category.DefaultCategoryDataset;
      import org.jfree.chart.plot.PlotOrientation;
      public class AzimuthAltitudeGraph
           public BufferedImage getChartAsBufferedImage(int dimX, int dimY)
                DefaultCategoryDataset data = new DefaultCategoryDataset();
                data.addValue(1.0, "Line 1", 1);
                //etc etc (just testing now)
                JFreeChart chart = ChartFactory.createLineChart(
                     "My line chart",
                BufferedImage image = chart.createBufferedImage(dimX, dimY);
                return image;
      Relevant API notes:
      JFreeChart ChartFactory.createLineChart
      DefaultCategoryDataSet (where problem is)

      Still quite new to java so this probably has the most obvious of solutions. I tried casting 1.0 as (double) but got no joy from that :(

      Message was edited by: