• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamic Jfreechart

 
Ranch Hand
Posts: 77
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's my code -




This is the error im gettin -

BarExample.java:21: reference to setValue is ambiguous, both method setValue(jav
a.lang.Number,java.lang.Comparable,java.lang.Comparable) in org.jfree.data.categ
ory.DefaultCategoryDataset and method setValue(double,java.lang.Comparable,java.
lang.Comparable) in org.jfree.data.category.DefaultCategoryDataset match
dataset.setValue(rs.getInt(1), "Profit %", rs.getInt(2));
^
1 error


I don't understand. What's the deal here??
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's like the message says: the DefaultCategoryDataset class has two methods that would match the parameters that you're providing. Check out the javadocs of that class for details. You need to make it clear which of the two methods you want to invoke (although, actually, invoking either of them will have the same result). You can do this either by calling

dataset.setValue(new Integer(rs.getInt(1)), "Profit %", rs.getInt(2))

(which I'd prefer) or

dataset.setValue((double) rs.getInt(1), "Profit %", rs.getInt(2))
 
Nandita Tiwari
Ranch Hand
Posts: 77
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tried What you told me. Still the same error.

BarExample.java:21: reference to setValue is ambiguous, both method setValue(jav
a.lang.Number,java.lang.Comparable,java.lang.Comparable) in org.jfree.data.categ
ory.DefaultCategoryDataset and method setValue(double,java.lang.Comparable,java.
lang.Comparable) in org.jfree.data.category.DefaultCategoryDataset match
dataset.setValue(new Integer(rs.getInt(1)), "Profit %", rs.getInt(2));
^
1 error
 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You can try this


Regards,
Vishal
 
Nandita Tiwari
Ranch Hand
Posts: 77
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Resolved. Thank you, vishal.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic