BUG Report: VerticalSymbolicAxis Class

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
morpheus

BUG Report: VerticalSymbolicAxis Class

Post by morpheus » Fri Feb 14, 2003 1:44 pm

In the constructor of VerticalSymbolicAxis The symbolicValue variable is not initialized which raises a Null exception when autoAdjustRange() method is called. I think the foolwin line should be added in the constructor :

public VerticalSymbolicAxis(String label, String[] sv) {

super(label);

this.symbolicValue = Arrays.asList(sv); // TO ADD
}


I think it has been forgotten since that many lines of code (Constructors' Code ) are commented.

Regards

morpheus

Re: BUG Report: VerticalSymbolicAxis Class

Post by morpheus » Fri Feb 14, 2003 2:36 pm

Another one in same class:

symbolicGridPaint variable not initialized which raises a Null Exception if you call the method setSymbolicGridLinesVisible( true );

Regards
Morpheus

morpheus

Re: BUG Report: VerticalSymbolicAxis Class

Post by morpheus » Fri Feb 14, 2003 3:01 pm

Third one :o)

The Symbolic Values are never displayed When using VerticalSymbolicAxis Class because method valueToString( double value ) is never called. To fix this I defined same method in VerticalNumberAxis class :

public String valueToString( double value ) {
String tickLabel;

NumberFormat formatter = getNumberFormatOverride();

if (formatter != null) {
tickLabel = formatter.format(value);
}
else {
tickLabel = getTickUnit().valueToString(value);
}

return tickLabel;
}


And replaced in method public void refreshTicks(Graphics2D g2,
Rectangle2D plotArea, Rectangle2D dataArea,
int location) the following sequence with a call to tickLabel = valueToString( currentTickValue );


Sequence to delete in refreshTicks ( From line 519 ):

NumberFormat formatter = getNumberFormatOverride();

if (formatter != null) {
tickLabel = formatter.format(value);
}
else {
tickLabel = getTickUnit().valueToString(value);
}

I tested it, it works fine...

Regards
Morpheus

morpheus

Re: BUG Report: VerticalSymbolicAxis Class

Post by morpheus » Fri Feb 14, 2003 3:07 pm

Third one :o)

The Symbolic Values are never displayed When using VerticalSymbolicAxis Class because method valueToString( double value ) is never called. To fix this I defined same method in VerticalNumberAxis class :

public String valueToString( double value ) {
String tickLabel;

NumberFormat formatter = getNumberFormatOverride();

if (formatter != null) {
tickLabel = formatter.format(value);
}
else {
tickLabel = getTickUnit().valueToString(value);
}

return tickLabel;
}


And replaced in method public void refreshTicks(Graphics2D g2,
Rectangle2D plotArea, Rectangle2D dataArea,
int location) the following sequence with a call to tickLabel = valueToString( currentTickValue );


Sequence to delete in refreshTicks ( From line 519 ):

NumberFormat formatter = getNumberFormatOverride();

if (formatter != null) {
tickLabel = formatter.format(value);
}
else {
tickLabel = getTickUnit().valueToString(value);
}

I tested it, it works fine...

Regards
Morpheus

David Gilbert

Re: BUG Report: VerticalSymbolicAxis Class

Post by David Gilbert » Fri Feb 14, 2003 3:08 pm

The first two are already corrected in CVS. I will look at the third...

Regards,

Dave Gilbert

morpheus

Re: BUG Report: VerticalSymbolicAxis Class

Post by morpheus » Fri Feb 14, 2003 3:09 pm

Thanks for replying :o)

Sincere Respect

Morpheus

morpheus

Re: BUG Report: VerticalSymbolicAxis Class

Post by morpheus » Fri Feb 14, 2003 4:40 pm

I'm mapping an interval of values to a symbol label by implementing YisSymbolic interface. Everything is okay except that when rendering on the Range axis the symbol label is not in middle of the interval. Any idea how to overpass this?

Thanks

Morpheus

David Gilbert

Re: BUG Report: VerticalSymbolicAxis Class

Post by David Gilbert » Fri Feb 14, 2003 6:14 pm

I'm not sure I understand what you mean. Also, be aware that I'm not that knowledgeable about the symbol plots...they were contributed by another developer and I haven't looked that closely at them.

Bug 3 that you reported before is now fixed, it will go into CVS shortly for the 0.9.6 release.

Regards,

Dave Gilbert

Locked