Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » chart Zooming
chart Zooming [message #1008340] Tue, 12 February 2013 03:19 Go to next message
Savitha Sundaramoorthi is currently offline Savitha SundaramoorthiFriend
Messages: 18
Registered: November 2012
Junior Member
Hello all,

I am using the BIRT charting engine in an RCP application where the chart
is rendered in Swing . I would like to be able to zoom in to the chart by using the mouse to draw a rectangle
around the data of interest. Is there a way to add interactivity to the
chart that would return the corresponding label values of the xmin, ymin, xmax, ymax of the rectangle ?
I need those label values to fix the max and min scale value to zoom the plot.

Thanks,
Savitha
Re: chart Zooming [message #1008494 is a reply to message #1008340] Tue, 12 February 2013 17:52 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I do not have an example of doing this, but you could probably use a callback event and trap all the info you need. I modified an example from the source that prints out the mouse event and chart x,y values in a callback example. I am attaching it. It should get you started.

Jason
BIRT-Exchange
Re: chart Zooming [message #1008496 is a reply to message #1008494] Tue, 12 February 2013 18:00 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

btw when you run it make sure to select callback and then click update.

Jason
Re: chart Zooming [message #1008523 is a reply to message #1008496] Tue, 12 February 2013 20:30 Go to previous messageGo to next message
Savitha Sundaramoorthi is currently offline Savitha SundaramoorthiFriend
Messages: 18
Registered: November 2012
Junior Member
Hi Jason,

Thanks a lot for your reply.

I have the following idea for zoom capability for my custom java application which uses chart api :

1) Add trigger to the plot so that it could capture Mousedown and Mouseup event. From this I could get
minimum and maximum co-ordinate value for X-axis and Y-Axis.

2) From the datapointhints , I could find the nearest value to the min and max co-ordinate value
and find the corresponding axis labels.

3) Once, I have the axis labels, I could set the min and max scale of the X and Y-axis .

But I face the following problem:

When I add trigger to the plot, it doesn't seem to work.

Kindly tell me if the following approach would work out. And by the way, I'm using my own extended TimeSeries chart.

Thanks,
Savitha
Re: chart Zooming [message #1008538 is a reply to message #1008523] Tue, 12 February 2013 22:05 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

That sounds like it should work. Where are you adding the trigger?


Jason
BIRT-Exchange
Re: chart Zooming [message #1008539 is a reply to message #1008523] Tue, 12 February 2013 22:05 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

That sounds like it should work. Where did you put the trigger?


Jason
BIRT-Exchange
Re: chart Zooming [message #1008540 is a reply to message #1008523] Tue, 12 February 2013 22:07 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This sounds like it should work. Where did you put the trigger?

Jason
BIRT-Exchange
Re: chart Zooming [message #1008734 is a reply to message #1008540] Wed, 13 February 2013 18:41 Go to previous messageGo to next message
Savitha Sundaramoorthi is currently offline Savitha SundaramoorthiFriend
Messages: 18
Registered: November 2012
Junior Member
Hello Jason,

Am adding trigger to the plot(chart.getPlot().getTriggers().addTrigger(.....) ).
Looks like it is not working. If you could give suggestion on how to make this work, it would be great.

So, I added mouseListener to the JPanel and performing the necessary Logic in MousePressed and Released.
I got access to the datapointhints from GeneratedChartState object and is working fine so far, but if you could suggest a better way of doing this, it'll be helpful.

Finally, I want to draw the rectangle(rubber band zooming) on the plot while zooming. I saw your previous post
where you have implemented in javascript. If you could point me to some material on how to do it in swing, it would be great.

Thanks,
Savitha

[Updated on: Wed, 13 February 2013 19:18]

Report message to a moderator

Re: chart Zooming [message #1009204 is a reply to message #1008734] Thu, 14 February 2013 16:47 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

The plot does not support triggers. You can add them to the main chart block:
yourchart.getBlock().getTriggers( ) The issue is that you will not be able to get your data point values. You either have to add the trigger to the axis or the series to get some data values.
In the example I did in JavaScript I used x-axis and allowed the user to select a new range on the axis. I have not tried to do this in Swing but you may want to look at this post:
http://www.xtremevbtalk.com/showthread.php?t=238496

Jason
BIRT-Exchange
Re: chart Zooming [message #1009775 is a reply to message #1009204] Fri, 15 February 2013 17:25 Go to previous message
Savitha Sundaramoorthi is currently offline Savitha SundaramoorthiFriend
Messages: 18
Registered: November 2012
Junior Member
Thanks a lot Jason. That did work Smile
Previous Topic:Horizontal page breaks and consistent row height
Next Topic:Change BIRT Logging level for specific class/package
Goto Forum:
  


Current Time: Tue Apr 23 09:58:12 GMT 2024

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

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

Back to the top