Results 1 to 6 of 6
  1. #1
    Friqenstein is offline Member
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Default setShapesVisible: depreciated

    Hello once again all,

    I'm working with my little GUI ap, and I'm implementing a bit of JFreeChart into it. The charts seem to work fine and all, but I'm getting warnings about the following:
    Java Code:
    renderer.setShapesVisible(true);
    The app will run on my machine, but when I build/compile it, I get warnings about the setShapesVisible being depreciated.

    I've done a bit of searching and all I can seem to come up with is examples telling me to use setSeriesShapesVisible which doesn't seem to work. Even according to the JFreeChart dev pdf, it suggests using the pre_Series to fix the depreciation issues.

    If anyone has any insight on this It would be great.
    Thanks.

  2. #2
    Friqenstein is offline Member
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Default

    A new bit of info...

    I've discovered a few things regarding this particular piece of code.
    First being that the original (depreciated) version is much more simple and dynamic to use.
    Second being the newer bit seems to be limited to only a 5 series data input?... I'm not certain if this second bit is truly correct, but here is my new scenario:
    Java Code:
    ...
    code stuff
    ...
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    //renderer.setShapesVisible(true);
           //renderer.setShapesFilled(true);
           renderer.setSeriesShapesVisible(0,true);
           renderer.setSeriesShapesVisible(1,true);
           renderer.setSeriesShapesVisible(2,true);
           renderer.setSeriesShapesVisible(3,true);
           renderer.setSeriesShapesVisible(4,true);
           renderer.setSeriesShapesVisible(5,true);
           renderer.setSeriesShapesVisible(6,true);
           renderer.setSeriesShapesVisible(7,true);
           renderer.setSeriesShapesVisible(8,true);
           renderer.setSeriesShapesVisible(9,true);
           renderer.setSeriesShapesFilled(0,true);
           renderer.setSeriesShapesFilled(1,true);
           renderer.setSeriesShapesFilled(2,true);
           renderer.setSeriesShapesFilled(3,true);
           renderer.setSeriesShapesFilled(4,true);
           renderer.setSeriesShapesFilled(5,true);
           renderer.setSeriesShapesFilled(6,true);
           renderer.setSeriesShapesFilled(7,true);
           renderer.setSeriesShapesFilled(8,true);
           renderer.setSeriesShapesFilled(9,true);
    As you can see, the commented bit of code was what I was originally using, which is depreciated. Although it does work perfectly fine on my machine, I cannot get it to work on other machines after building the app.
    So, the alternative I've found is using the .setSeriesShapesVisible(int, boolean) however it seems that even though I have 10 data series to be plotted, it will only plot 5 of them.
    For example, I have 10 values that are being pulled from user input. It only plots the first 5. If I use the first 4 and then the 6th (still resulting in 5) it will plot those 5 (1 through 4 & 6).

    Does anyone have any insight on this? I cannot seem to find out why I'm limited to a certain amount unless it is hard coded in the plot.getRenderer() class.
    My original code using the commented bit up above would automatically generate the desired number of items to be graphed... meaning it would use as many as the values I passed to it... so all 10. I'm not sure why the original bit was depreciated as, IMHO, it seems to work much smoother and easier.

    Any help is greatly appreciated.
    Last edited by Friqenstein; 08-07-2010 at 01:13 AM. Reason: forgot a bit of info

  3. #3
    Friqenstein is offline Member
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Default

    Ok,
    So #1 rule of posting is don't post when coding while tired. :D

    Turns out that I needed twice the amount of calls to the setSeriesShapesVisible() because I have 2 bits of data for each series.
    I knew I had two bits for each series, I just assumed that each series would be accounted for according to the way the old renderer worked... folly me.

    At any rate, it does seem to work so far. I just have to re-build the project and see if it will work on other platforms now.

    I sure wish the old depreciated bit still worked because it was 38 less lines of code. :(
    Last edited by Friqenstein; 08-07-2010 at 02:26 AM.

  4. #4
    Friqenstein is offline Member
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Default ... more info ...

    Hello again all.
    I know I seem to be populating my own thread here, but I figured it's a good spot for not only me to keep track of my problems, but hopefully will help someone else too.

    At any rate, picking up where I left off in the last post, I still cannot get the app to run on any other machines. I'm getting the following error:
    Java Code:
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jfree/data/xy/XYDataset
            at OBSToolBox_MainMenu.<init>(OBSToolBox_MainMenu.java:91)
            at OBSToolBox_MainMenu$3.run(OBSToolBox_MainMenu.java:107)
            at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:226)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:602)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:275)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:200)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:185)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:177)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:138)
    Caused by: java.lang.ClassNotFoundException: org.jfree.data.xy.XYDataset
            at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
            ... 10 more
    That's what I get on CLI when running with
    Java Code:
    java -jar ./filename
    I'm wondering if my whole 'depreciated' issue could have been solved some other simple way, or am I just missing something altogether? I'm sure I included the libraries/java files for the JFreeChart bits that I used.
    When I built the project (using NetBeans) it compiled with no warnings or errors. However when I attempt to run it even on a usb drive on my own working machine, I get the above error. If I run the built app from my own harddisk, there is no problem and it runs perfectly fine.
    I can only assume that something from the JFreeChart libraries are not getting compiled into the final app?

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,234
    Rep Power
    19

    Default

    > I'm sure I included the libraries/java files for the JFreeChart bits that I used.
    > When I built the project (using NetBeans) it compiled with no warnings or errors. However when I attempt to run it even on a usb drive on my own working machine, I get the above error.

    Did you copy over the dist/lib folder? (Did you read the ReadMe.txt generated by NetBeans?)

    db
    Last edited by DarrylBurke; 08-07-2010 at 07:09 PM.

  6. #6
    Friqenstein is offline Member
    Join Date
    Aug 2010
    Posts
    7
    Rep Power
    0

    Default closed.

    Turns out I had copied the dist folder.
    However, I had made changes and rebuilt the app and apparently only copied the final Jar file instead of recopying the entire folder again.

    I also decided to go back to using the depreciated code as originally described. Seemed silly to have extra line in my app when it could just as easily be used with 2 lines.

    Thanks for the reply.
    /closed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •