NumberTickUnit and Gridlines of Domain and Range

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

NumberTickUnit and Gridlines of Domain and Range

Post by BO » Wed Mar 15, 2006 12:23 pm

Hello everybody

Image


In the above chart , I am using NumberTickUnit with codes:

Domaine X

Code: Select all

		NumberAxis rangeAxis = (NumberAxis) plot.getDomainAxis(); 
		rangeAxis.setRange(16, 71); 
		NumberTickUnit ntu = new NumberTickUnit( 4, new DecimalFormat("0"));
		rangeAxis.setTickUnit( ntu );
Range Y

Code: Select all

		rangeAxis = (NumberAxis) plot.getRangeAxis();
		rangeAxis.setRange(0, 100);
		ntu = new NumberTickUnit( 10.0, new DecimalFormat("0"));
		rangeAxis.setTickUnit( ntu );
how I set the gridlines between the NumberTickUnit:

Domain X : I want to plot the gridline at x's value 17, 18, 19, 21, 22, 23, and so all with the color BLUE (3 lines between 2 NumberTickUnits)

Range Y : I want to plot the gridline at y's value 2, 4, 6, 8, 12, 14, 16, 18 and so all with the color GREEN (4 lines between 2 NumberTickUnits)

I have a idea : using the marker But I think there is some option to do this

thanks a lot
best regards
BO

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 » Wed Mar 15, 2006 3:42 pm

There is currently no support for this, but it would be a nice feature to add.
David Gilbert
JFreeChart Project Leader

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

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Post by BO » Wed Mar 15, 2006 4:38 pm

ok, I am wating for that :D
thanks a lot
best regards
BO

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Post by BO » Fri Nov 24, 2006 3:10 pm

david.gilbert wrote:There is currently no support for this, but it would be a nice feature to add.
Hello David
I dont know if there is this feature in JFreeChart 1.0.3 or not ?
I didn't find the page who tells the all new features in JFreeChart 1.0.3?
thanks

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 » Fri Nov 24, 2006 4:39 pm

No, this feature isn't supported yet.

Here are the details of the changes in the latest release:

http://sourceforge.net/project/shownote ... _id=464426
David Gilbert
JFreeChart Project Leader

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

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Post by BO » Mon Jun 09, 2008 11:55 am

Hi David
this feature is supported now?
thanks for your anwser
best regards
BO

ndhai
Posts: 10
Joined: Thu Jun 05, 2008 2:00 pm

Post by ndhai » Wed Jun 25, 2008 10:16 am

hello all
I am finding somethings like that BO want
anybody know if it support now ?
thanks
ndhai

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 » Wed Jun 25, 2008 9:31 pm

It hasn't been done yet, although there is a patch in the queue at SourceForge (and I'd really like to go through it soon, so feedback on the patch is appreciated):

http://sourceforge.net/tracker/index.ph ... tid=315494
David Gilbert
JFreeChart Project Leader

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

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Post by paradoxoff » Thu Jun 26, 2008 4:04 pm

david.gilbert wrote:so feedback on the patch is appreciated
The patch in its present form uses the tickCount variable in a way that is inconsistent with the way LogAxis is using it (shame on me). "tickCount" for a LogAxis means "number of regions between two ticks" and thus needs to be > 0. "tickCount" as it is presently used by the patch means "number of tick lines" and thus could be zero (i.e. no minorTickLine).
In my local JFreeChart version I have changed that recently to make the handling of minorTickCounts consisted across the various ValueAxis subclasses. I haven´t uploaded the patches due to further changes that I have made since then.
It would propose to also integrate patch http://sourceforge.net/tracker/index.ph ... tid=315494 to draw not only minor grid lines but also minor tick lines.
Since I am a bit short of time that will probably take a couple of days, but it would be cool to have those features in jfreechart 1.0.11!
Regards, paradoxoff

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Post by paradoxoff » Tue Jul 01, 2008 10:31 pm

A new patch (against JFreeChart 1.0.10) has been uploaded.
It has been cleaned up a little. Most importantly, the redundant minorTickCount variable and the public setters/getters have been removed from the LogAxis class. The behaviour of NumberAxis, DateAxis and LogAxis is now the same as already used for LogAxis, i.e. "minorTickCount" refers to the number of "regions" between two major tick marks and thus needs to be > 0.
Patch ID 1870189 (http://sourceforge.net/tracker/index.ph ... tid=315494) has been integrated, i.e. minor tick marks are supported as well. The getters, setters and variables for minor tick marks were renamed ("minor" now precedes "tick", i e. "isMinorTickMarksVisible()" instead of "isTickMarksMinorVisible()".

getaceres
Posts: 3
Joined: Tue Sep 23, 2008 8:10 am

Post by getaceres » Tue Sep 23, 2008 8:15 am

JFreeChart 1.0.11 has been released and it has not included this patch.
Are you planning to update it?
I tried downloading the current patches but they reference files with absolute paths like

Code: Select all

C:/Programme/jfreechart-1.0.10/patch/Axis/Axis-org.java
which don't exist. I think that I can find most of them but even changing the diff files to reference the source files that I think they should reference, I get some errors.
Could you please make your diffs so they reference the files in the source distribution or the current version (svn or cvs or whatever) distribution?

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 Sep 23, 2008 9:15 am

I'm going to work through this patch so that hopefully it can be included in the 1.0.12 release.
David Gilbert
JFreeChart Project Leader

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

getaceres
Posts: 3
Joined: Tue Sep 23, 2008 8:10 am

Post by getaceres » Tue Sep 23, 2008 10:27 am

The problem is that I need this functionality now, so I'm trying to apply the patches to the sources but I only get errors. I tried the following:

1. Download the patches and unzip them to the jfreechart 1.0.10 base directory.

2. Change header in file Axis-minorGridTickPatch.diff from

Code: Select all

--- C:/Programme/jfreechart-1.0.10/patch/Axis/Axis-org.java	Mon Jun 09 11:05:00 2008
+++ C:/Programme/jfreechart-1.0.10/patch/Axis/Axis-minorGridTickPatch.java	Tue Jul 01 22:44:38 2008
to

Code: Select all

--- source/org/jfree/chart/axis/Axis.java	Mon Jun 09 11:05:00 2008
+++ source/org/jfree/chart/axis/Axis.java	Tue Jul 01 22:44:38 2008
and I try to apply the changes with:

Code: Select all

patch -p0 < Axis-minorGridTickPatch.diff
but I get the following output:

Code: Select all

patching file source/org/jfree/chart/axis/Axis.java                                                     
Hunk #1 FAILED at 161.
Hunk #2 FAILED at 176.
Hunk #3 FAILED at 225.
Hunk #4 FAILED at 290.
Hunk #5 FAILED at 714.
Hunk #6 FAILED at 742.
Hunk #7 FAILED at 807.
Hunk #8 FAILED at 1335.
8 out of 8 hunks FAILED -- saving rejects to file source/org/jfree/chart/axis/Axis.java.rej
Am I doing something wrong?

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Post by paradoxoff » Tue Sep 23, 2008 8:11 pm

Not sure whether you are doing something wrong or whether I have used the wrong way to create the patches. Here is a sample command line that I have used:

Code: Select all

C:\Programme\GnuWin32\bin\diff.exe -c C:\Programme\jfreechart-1.0.10\patch\MinorGridTickPatch\DateAxis-minorGridTickPatch.java  C:\Programme\jfreechart-1.0.10\patch\MinorGridTickPatch\DateAxis.java >> C:\Programme\jfreechart-1.0.10\patch\MinorGridTickPatch\DateAxis-minorGridTickPatch.diff
If somebody could comment on whether the usage of diff is correct, that would be most helpful. I went through the diffutil docs before I prepared the patches but found it quite complicated (it took almost longer to find out which program to use to prepare the patches, where to get it and how to get it to at least produce something reasonably looking than it took to produce the patches themselves! Maybe a use case could be mentioned in Q12 of the FAQ). To make the patches available w/o need to clarify these issues before, I have uploaded the patched source files.

matinh
Posts: 483
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Post by matinh » Wed Sep 24, 2008 9:26 am

Hi!

It looks you specified files to diff in the reverse order. I never used diff on windows but on Linux I usually do this

Code: Select all

diff -Nur jfreechart-1.0.11/sources jfreechart-modified/source >some.patch
hth,
- martin

Locked