| author | Raphael Feng | 2012-04-01 02:51:30 (EDT) |
|---|---|---|
| committer | Heng Li | 2012-04-01 02:51:30 (EDT) |
| commit | bcdd1b869a6c2e37bb856fcb355ba684fedb1148 (patch) (side-by-side diff) | |
| tree | 9a9c4cca5d113f2f8d3b009a6d060ae326dc6d10 | |
| parent | 2bb32463e554181e6c4de71a10b9207b2e1f28cb (diff) | |
| download | org.eclipse.birt-bcdd1b869a6c2e37bb856fcb355ba684fedb1148.zip org.eclipse.birt-bcdd1b869a6c2e37bb856fcb355ba684fedb1148.tar.gz org.eclipse.birt-bcdd1b869a6c2e37bb856fcb355ba684fedb1148.tar.bz2 | |
Summary: Fix the problem "Cannot show tool tip for stock chart with bat
stick sub type."
Description: For stock chart with bar stick as subtype, it's values are
drawn
as lines so that the tooltip hotspots are not correctly generated.
The fix is for bar stick sub type, use topmost, bottommost, rightmost
and leftmost
points as the hotspots boundaries. Use a cap width in case the
stick length
is too small so that it's easier for user to show the tooltip.
| -rw-r--r-- | chart/org.eclipse.birt.chart.engine.extension/src/org/eclipse/birt/chart/extension/render/Stock.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/chart/org.eclipse.birt.chart.engine.extension/src/org/eclipse/birt/chart/extension/render/Stock.java b/chart/org.eclipse.birt.chart.engine.extension/src/org/eclipse/birt/chart/extension/render/Stock.java index 31cdbfc..7c0e000 100644 --- a/chart/org.eclipse.birt.chart.engine.extension/src/org/eclipse/birt/chart/extension/render/Stock.java +++ b/chart/org.eclipse.birt.chart.engine.extension/src/org/eclipse/birt/chart/extension/render/Stock.java @@ -60,7 +60,8 @@ public final class Stock extends AxesRenderer { private static ILogger logger = Logger.getLogger( "org.eclipse.birt.chart.engine.extension/render" ); //$NON-NLS-1$ - + private final static int MIN_HOTSPOT_WIDTH = 12; + /** * The constructor. */ @@ -308,6 +309,21 @@ public final class Stock extends AxesRenderer if ( ss.isShowAsBarStick( ) ) { int stickLength = ss.getStickLength( ); + + // For stick sub type, the front face is used to create the hotspot + // of the tooltip. To make it easier for user to show the tooltip, just + // use topmost, bottommost, rightmost and leftmost point as the hotspot + // boundaries. Use a cap width in case the stick length is too small. + // #41900 + + int hotspotHalfWidth = Math.min(stickLength, MIN_HOTSPOT_WIDTH / 2); + double hotspotHigh = Math.max( dHigh, dLow); + double hotspotLow = Math.min(dHigh, dLow); + + loaFrontFace[0].set( dX - hotspotHalfWidth, hotspotHigh ); + loaFrontFace[1].set( dX - hotspotHalfWidth, hotspotLow ); + loaFrontFace[2].set( dX + hotspotHalfWidth, hotspotLow ); + loaFrontFace[3].set( dX + hotspotHalfWidth, hotspotHigh ); Location loStart2 = goFactory.createLocation( 0, 0 ), loEnd2 = goFactory.createLocation( 0, 0 ); |

