Clearing XYInterval series

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
arwelbath
Posts: 24
Joined: Fri Aug 10, 2007 12:37 pm

Clearing XYInterval series

Post by arwelbath » Tue Nov 27, 2007 1:38 pm

Hi,
I have two charts in my project, one has error bars and the other does not. To update the plot without errorbars, I clear the series then re-do it, as in 'updateLines' below. But, this doesn't work for the XYIntervalSeries, since it tells me that 'clear() has protected access in org.jfree.data.ComparableObjectSeries'.
I'm assuming this is for a reason, so could someone tell me why I can't 'clear' the XYSeriesCollection, and how can I get around this?
Many thanks,
Arwel

Code: Select all

        public void updateLines(float data[][], XYSeriesCollection coll, int contrast, int points) {
            XYSeries thisSeries = coll.getSeries(contrast);
            thisSeries.clear();   //this works
            for (int i=0 ; i<points-1 ; i++) {
                thisSeries.add(data[i][0],data[i][1],false);
            };
            thisSeries.add(data[points][0],data[points][1]);
        }
        
        
        public void updateErrs(float data[][], XYIntervalSeriesCollection coll, int contrast, int points) {
            XYIntervalSeries thisSeries = coll.getSeries(contrast);
            thisSeries.clear();  //this does not work
            //ch.setNotify(false);
            for (int i=0 ; i<points-1 ; i++) {
                thisSeries.add(data[i][0],data[i][1],data[i][2],data[i][3],data[i][4],data[i][5]);
            };
            thisSeries.add(data[points][0],data[points][1],data[points][2],data[points][3],data[points][4],data[points][5]);
            //ch.setNotify(true);
        }

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Nov 27, 2007 10:23 pm

I'm not sure there's any good reason for this method being 'protected'...I'll look at it some more, but I think making it 'public' is probably fine.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

arwelbath
Posts: 24
Joined: Fri Aug 10, 2007 12:37 pm

Made the changes - now how to recompile?

Post by arwelbath » Mon Dec 10, 2007 1:12 pm

Hi,
Okay, I've made the necessary changes to ComparableObjectSeries, but I can't quite work out how to recompile the jars properly.
I'm using NetBeans, and am quite new to Java. Ive followed what i think should be the right steps to re-compiling using the ant script, and this seems to compile with no error messages, but then netbeans doesn't seem to register the changes (i.e. in my project, I still get the error even when I think I've changed the method from protected to public and recompiled). I've tried re-doing the JFreechart library in the library manager, but it still isn't working properly.
Any info about how I should re-compile in netbeans (or outside netbeans, I'm not fussy) would be greatly appreciated.
Many Thanks,
arwel

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Dec 10, 2007 2:23 pm

I use Ant at the command line: 'ant compile' will rebuild the jar file.

While it is pretty straightforward to *use* JFreeChart from NetBeans (that is, while developing an applications that uses JFreeChart), it looks to me as though I'll have to rewrite the Ant script in order to *develop* JFreeChart from within NetBeans. I'll do that eventually, but it isn't right at the top of my priority list for now.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

arwelbath
Posts: 24
Joined: Fri Aug 10, 2007 12:37 pm

Post by arwelbath » Mon Dec 10, 2007 3:07 pm

Hi David,
Er, I was just about to post that I think I figured it out!
I tried 'ant compile' from the command line, and this just gives an error message saying that 'ant' is not recognised or somesuch (I'm doing this under windows XP). So, I had a look at the ant homepage, and decided not to try to re-install ant in case this messed with the existing netbeans installation somehow.
So I tried something different. Within netbeans, I opened jfreechart as follows....

File menu --> new project
then choose 'Java Project with Existing Ant Script'.

Then follow the instructions (i.e. yoiu have to manually locate the directories for the ant script, sources etc).

Then, once this was open, in the file browser, locate the 'build.xml', right click on it, then select run target --> all

And then the output window gave me the following. I havent checked if the resulting files work, but it certainly seems to have done *something*!
Cheers,
arwel

Code: Select all

initialise:
compile:
Created dir: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build
Compiling 514 source files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build\org\jfree\chart
Copying 12 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build\org\jfree\chart
Copying 9 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build\org\jfree\chart\plot
Copying 10 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build\org\jfree\chart\editor
Building jar: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6.jar
Deleting directory C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build
compile-experimental:
Created dir: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build
Compiling 27 source files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build
Building jar: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6-experimental.jar
Deleting directory C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\build
javadoc:
Created dir: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\javadoc
Generating Javadoc
Javadoc execution
Loading source files for package org.jfree.chart...
Loading source files for package org.jfree.chart.annotations...
Loading source files for package org.jfree.chart.axis...
Loading source files for package org.jfree.chart.block...
Loading source files for package org.jfree.chart.demo...
Loading source files for package org.jfree.chart.editor...
Loading source files for package org.jfree.chart.encoders...
Loading source files for package org.jfree.chart.entity...
Loading source files for package org.jfree.chart.event...
Loading source files for package org.jfree.chart.imagemap...
Loading source files for package org.jfree.chart.labels...
Loading source files for package org.jfree.chart.needle...
Loading source files for package org.jfree.chart.plot...
Loading source files for package org.jfree.chart.renderer...
Loading source files for package org.jfree.chart.renderer.category...
Loading source files for package org.jfree.chart.renderer.xy...
Loading source files for package org.jfree.chart.resources...
Loading source files for package org.jfree.chart.servlet...
Loading source files for package org.jfree.chart.title...
Loading source files for package org.jfree.chart.urls...
Loading source files for package org.jfree.chart.util...
Loading source files for package org.jfree.data...
Loading source files for package org.jfree.data.category...
Loading source files for package org.jfree.data.contour...
Loading source files for package org.jfree.data.function...
Loading source files for package org.jfree.data.gantt...
Loading source files for package org.jfree.data.general...
Loading source files for package org.jfree.data.io...
Loading source files for package org.jfree.data.jdbc...
Loading source files for package org.jfree.data.resources...
Loading source files for package org.jfree.data.statistics...
Loading source files for package org.jfree.data.time...
Loading source files for package org.jfree.data.time.ohlc...
Loading source files for package org.jfree.data.xml...
Loading source files for package org.jfree.data.xy...
Constructing Javadoc information...
Standard Doclet version 1.5.0_06
Building tree for all the packages and classes...
Building index for all the packages and classes...
Building index for all classes...
zip-javadocs:
Building zip: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6-javadocs.zip
fill-distribution:
Deleting directory C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Created dir: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 583 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\source
Copying 39 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\experimental
Copying 345 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\tests
Copying 17 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\swt
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\lib
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\ant
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\ant
Copying 6 files to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution\checkstyle
zip:
Building zip: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6.zip
targz:
Building tar: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6.tar
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/annotations/junit/XYTitleAnnotationTests.java longer than 100 characters.
Resulting tar file can only be processed successfully by GNU compatible tar commands
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/plot/dial/junit/DialTextAnnotationTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/plot/dial/junit/DialValueIndicatorTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/plot/dial/junit/SimpleDialFrameTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/plot/dial/junit/StandardDialFrameTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/plot/dial/junit/StandardDialRangeTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/plot/dial/junit/StandardDialScaleTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/experimental/org/jfree/experimental/chart/renderer/xy/XYSmoothLineAndShapeRenderer.java longer than 100 characters.
Entry: jfreechart-1.0.6/tests/org/jfree/chart/renderer/category/junit/AbstractCategoryItemRendererTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/tests/org/jfree/chart/renderer/category/junit/DefaultCategoryItemRendererTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/tests/org/jfree/chart/renderer/category/junit/StatisticalLineAndShapeRendererTests.java longer than 100 characters.
Entry: jfreechart-1.0.6/tests/org/jfree/data/statistics/junit/DefaultBoxAndWhiskerCategoryDatasetTests.java longer than 100 characters.
Building: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6.tar.gz
Deleting: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6.tar
maven-bundle:
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Copying 1 file to C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
Building jar: C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\jfreechart-1.0.6-bundle.jar
Deleting directory C:\Gwaith2007\Java\jfreechart-1.0.6\jfreechart-1.0.6\distribution
all:
BUILD SUCCESSFUL (total time: 2 minutes 0 seconds)

Locked