Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » tooltip over x-Axis Label
tooltip over x-Axis Label [message #368540] Tue, 09 June 2009 06:13 Go to next message
christian is currently offline christianFriend
Messages: 5
Registered: July 2009
Junior Member
hello,

i have the following problem in my rcp app with a swt control using birt
2.1.2. The x series in my bar chart can contain very long strings. BIRT
displays these by compressing the chart area and extending the area for
the x series labels. they can also overlap the y-axis title (please have a
look at the picture). i tried to cut the x series values in the
beforeDrawAxisLabel()-function (to display "long_name...(1)" or
"long_name...(2)" instead of their full name). now i want to add tooltips
for the labels so that i can display the full string for the user. i tried
some stuff (adding triggers to the x-axis or the x series category) but
that didnt work. i also tried an ONMOUSEOVER_LITERAL and CALL_BACK_LITERAL
combination with the same result.


does anyone know how to add an onMouseOver event/trigger for series
labels? i only need some callback stuff so that i can get the display name
of a label which is hovered by the user. then i could draw a swt tooltip
as a workaround.


http://img150.imageshack.us/img150/1673/chartexample.gif


thanks Christian
Re: tooltip over x-Axis Label [message #368544 is a reply to message #368540] Tue, 09 June 2009 09:30 Go to previous message
Gernot Veith is currently offline Gernot VeithFriend
Messages: 24
Registered: July 2009
Junior Member
Hello Christian,

to enable tooltips you have to define an action and a trigger. Example:
ActionValue actionValue = TooltipValueImpl.create(500, "xx");
Action action = ActionImpl.create(ActionType.SHOW_TOOLTIP_LITERAL,
actionValue);
Trigger mouseOver =
TriggerImpl.create(TriggerCondition.ONMOUSEOVER_LITERAL,acti on);
xAxisPrimary.getTriggers().add(mouseOver);

Next you must implement IActionRenderer and set it to the RuntimeContext
of the GeneratedChartState when you build the chart.
The problem you will then have is to get the x axis value for the label as
IActionRednerer does not provide the index of the currently rendered label.
Here is an example the a renderer:

@Override
public void processAction(Action action, StructureSource source) {

if (action.getType() == ActionType.SHOW_TOOLTIP_LITERAL &&
source.getType() == StructureType.SERIES_DATA_POINT) {
DataPointHints dph = (DataPointHints)source.getSource();
String displayValue = dph.getDisplayValue() + "%";
TooltipValueImpl tooltip = (TooltipValueImpl)action.getValue();
tooltip.setText(displayValue);
}
}

You have to change the StructureType accordingly.
In your case the source object of the StructureSource is the x axis
instance.

Gernot
Previous Topic:Problem with word emitter
Next Topic:Problem With Report Parameter displayText In the BIRT Interactive Viewer Under Tomcat
Goto Forum:
  


Current Time: Fri Mar 29 10:41:49 GMT 2024

Powered by FUDForum. Page generated in 0.02441 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top