[jfreechart-dev] [ jfreechart-Bugs-1277726 ] CategoryAxis Error

Bugs item #1277726, was opened at 2005-08-31 20:23
Message generated for change (Settings changed) made by mungady
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1277726&group_id=15494
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: None
Status: Open
Resolution: None
>Priority: 9
Submitted By: agustin_ane (agustin_ane)
>Assigned to: David Gilbert (mungady)
Summary: CategoryAxis Error
Initial Comment:
I found a bug in CategoryAxis
When set CategoryLabelPositions a rotated angle,
CategoryAxis draw the labels smaller than the space
reserved, this is notorious if the label is long or
have a multiple lines.
I found and fix this bag, fixed sources are attached.
I don't know if this is a better solution, but it's
works.
PD.
Sorry , my english is too bad :(
----------------------------------------------------------------------
Comment By: Joubie (adriaanjoubert)
Date: 2006-05-24 11:19
Message:
Logged In: YES
user_id=864842
The problem is due to the fact that in the initial call to
CategoryAxis.reserveSpace() the full plot area is used as
argument for the call to refreshTicks() to calculate the
space needed for the labels. When the labels are actually
written, the plotArea has had the space for the axis+labels
subtracted, so that the second calculation of the space for
the labels comes up with a much smaller value (stored in
state.max in the call to refreshTicks). My solution was to
add the dataArea as an argument to drawCategoryLabels, so
that the same height is calculated. This breaks the
description of how CategoryLabelPositions should work
(fraction of the plot area rather than the full data area).
See attached diff - needs changes to the 3D category axis
and SubCategoryAxis. Not pretty and probably not the
solution you want. Would be good if this could be fixed though!
Cheers,
Adriaan
*** CategoryAxis.java 2006-05-24 12:15:53.000000000 +0300
--- CategoryAxis.java- 2006-05-24 11:56:01.000000000 +0300
***************
*** 761,767 ****
// draw the category labels and axis label
AxisState state = new AxisState(cursor);
! state = drawCategoryLabels(g2, plotArea, dataArea,
edge, state, plotSt ate);
state = drawLabel(getLabel(), g2, plotArea,
dataArea, edge, state);
return state;
--- 761,767 ----
// draw the category labels and axis label
AxisState state = new AxisState(cursor);
! state = drawCategoryLabels(g2, dataArea, edge,
state, plotState);
state = drawLabel(getLabel(), g2, plotArea,
dataArea, edge, state);
return state;
***************
*** 782,788 ****
* @return The updated axis state (never
<code>null</code>).
*/
protected AxisState drawCategoryLabels(Graphics2D g2,
- Rectangle2D
plotArea,
Rectangle2D
dataArea,
RectangleEdge edge,
AxisState state,
--- 782,787 ----
***************
*** 793,799 ****
}
if (isTickLabelsVisible()) {
! List ticks = refreshTicks(g2, state, plotArea,
edge);
state.setTicks(ticks);
int categoryIndex = 0;
--- 792,798 ----
}
if (isTickLabelsVisible()) {
! List ticks = refreshTicks(g2, state, dataArea,
edge);
state.setTicks(ticks);
int categoryIndex = 0;
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1277726&group_id=15494

Thread view

Bugs item #1277726, was opened at 2005-08-31 20:23
Message generated for change (Settings changed) made by mungady
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1277726&group_id=15494
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: None
Status: Open
Resolution: None
>Priority: 9
Submitted By: agustin_ane (agustin_ane)
>Assigned to: David Gilbert (mungady)
Summary: CategoryAxis Error
Initial Comment:
I found a bug in CategoryAxis
When set CategoryLabelPositions a rotated angle,
CategoryAxis draw the labels smaller than the space
reserved, this is notorious if the label is long or
have a multiple lines.
I found and fix this bag, fixed sources are attached.
I don't know if this is a better solution, but it's
works.
PD.
Sorry , my english is too bad :(
----------------------------------------------------------------------
Comment By: Joubie (adriaanjoubert)
Date: 2006-05-24 11:19
Message:
Logged In: YES
user_id=864842
The problem is due to the fact that in the initial call to
CategoryAxis.reserveSpace() the full plot area is used as
argument for the call to refreshTicks() to calculate the
space needed for the labels. When the labels are actually
written, the plotArea has had the space for the axis+labels
subtracted, so that the second calculation of the space for
the labels comes up with a much smaller value (stored in
state.max in the call to refreshTicks). My solution was to
add the dataArea as an argument to drawCategoryLabels, so
that the same height is calculated. This breaks the
description of how CategoryLabelPositions should work
(fraction of the plot area rather than the full data area).
See attached diff - needs changes to the 3D category axis
and SubCategoryAxis. Not pretty and probably not the
solution you want. Would be good if this could be fixed though!
Cheers,
Adriaan
*** CategoryAxis.java 2006-05-24 12:15:53.000000000 +0300
--- CategoryAxis.java- 2006-05-24 11:56:01.000000000 +0300
***************
*** 761,767 ****
// draw the category labels and axis label
AxisState state = new AxisState(cursor);
! state = drawCategoryLabels(g2, plotArea, dataArea,
edge, state, plotSt ate);
state = drawLabel(getLabel(), g2, plotArea,
dataArea, edge, state);
return state;
--- 761,767 ----
// draw the category labels and axis label
AxisState state = new AxisState(cursor);
! state = drawCategoryLabels(g2, dataArea, edge,
state, plotState);
state = drawLabel(getLabel(), g2, plotArea,
dataArea, edge, state);
return state;
***************
*** 782,788 ****
* @return The updated axis state (never
<code>null</code>).
*/
protected AxisState drawCategoryLabels(Graphics2D g2,
- Rectangle2D
plotArea,
Rectangle2D
dataArea,
RectangleEdge edge,
AxisState state,
--- 782,787 ----
***************
*** 793,799 ****
}
if (isTickLabelsVisible()) {
! List ticks = refreshTicks(g2, state, plotArea,
edge);
state.setTicks(ticks);
int categoryIndex = 0;
--- 792,798 ----
}
if (isTickLabelsVisible()) {
! List ticks = refreshTicks(g2, state, dataArea,
edge);
state.setTicks(ticks);
int categoryIndex = 0;
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1277726&group_id=15494

Bugs item #1277726, was opened at 2005-08-31 20:23
Message generated for change (Comment added) made by mungady
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1277726&group_id=15494
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 9
Submitted By: agustin_ane (agustin_ane)
Assigned to: David Gilbert (mungady)
Summary: CategoryAxis Error
Initial Comment:
I found a bug in CategoryAxis
When set CategoryLabelPositions a rotated angle,
CategoryAxis draw the labels smaller than the space
reserved, this is notorious if the label is long or
have a multiple lines.
I found and fix this bag, fixed sources are attached.
I don't know if this is a better solution, but it's
works.
PD.
Sorry , my english is too bad :(
----------------------------------------------------------------------
>Comment By: David Gilbert (mungady)
Date: 2006-08-18 14:52
Message:
Logged In: YES
user_id=112975
Thanks Adriaan...I've applied the fix to CVS ready for the
upcoming 1.0.2 release.
Regards,
Dave Gilbert
JFreeChart Project Leader
----------------------------------------------------------------------
Comment By: Joubie (adriaanjoubert)
Date: 2006-05-24 11:19
Message:
Logged In: YES
user_id=864842
The problem is due to the fact that in the initial call to
CategoryAxis.reserveSpace() the full plot area is used as
argument for the call to refreshTicks() to calculate the
space needed for the labels. When the labels are actually
written, the plotArea has had the space for the axis+labels
subtracted, so that the second calculation of the space for
the labels comes up with a much smaller value (stored in
state.max in the call to refreshTicks). My solution was to
add the dataArea as an argument to drawCategoryLabels, so
that the same height is calculated. This breaks the
description of how CategoryLabelPositions should work
(fraction of the plot area rather than the full data area).
See attached diff - needs changes to the 3D category axis
and SubCategoryAxis. Not pretty and probably not the
solution you want. Would be good if this could be fixed though!
Cheers,
Adriaan
*** CategoryAxis.java 2006-05-24 12:15:53.000000000 +0300
--- CategoryAxis.java- 2006-05-24 11:56:01.000000000 +0300
***************
*** 761,767 ****
// draw the category labels and axis label
AxisState state = new AxisState(cursor);
! state = drawCategoryLabels(g2, plotArea, dataArea,
edge, state, plotSt ate);
state = drawLabel(getLabel(), g2, plotArea,
dataArea, edge, state);
return state;
--- 761,767 ----
// draw the category labels and axis label
AxisState state = new AxisState(cursor);
! state = drawCategoryLabels(g2, dataArea, edge,
state, plotState);
state = drawLabel(getLabel(), g2, plotArea,
dataArea, edge, state);
return state;
***************
*** 782,788 ****
* @return The updated axis state (never
<code>null</code>).
*/
protected AxisState drawCategoryLabels(Graphics2D g2,
- Rectangle2D
plotArea,
Rectangle2D
dataArea,
RectangleEdge edge,
AxisState state,
--- 782,787 ----
***************
*** 793,799 ****
}
if (isTickLabelsVisible()) {
! List ticks = refreshTicks(g2, state, plotArea,
edge);
state.setTicks(ticks);
int categoryIndex = 0;
--- 792,798 ----
}
if (isTickLabelsVisible()) {
! List ticks = refreshTicks(g2, state, dataArea,
edge);
state.setTicks(ticks);
int categoryIndex = 0;
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1277726&group_id=15494