Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Chart Engine and zooming
Chart Engine and zooming [message #367710] Thu, 02 April 2009 08:12 Go to next message
Marius Cetateanu is currently offline Marius CetateanuFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

Could anyone please provide me an example on how to use the zooming/drill
through(down) functionality from the BIRT chart engine?
I'm trying to display some graphs (scatter graphs, bar graphs) in my RCP
application inside a view using the BIRT chart engine. I have a large
amount of data to display and i would like to be able to zoom into my
Scatter graph. I found no example of this functionality in the examples
that come with the BIRT chart engine. I saw some post in this newsgroup
about using AutoScale to zoom in zoom out, but it did not have all the
details and i did not understand it.

Thanks
Re: Chart Engine and zooming [message #367729 is a reply to message #367710] Mon, 06 April 2009 10:11 Go to previous messageGo to next message
Marius Cetateanu is currently offline Marius CetateanuFriend
Messages: 3
Registered: July 2009
Junior Member
Anyone?

I don't need a full example, just a hint or someone to point me in the
right direction (where in the charts engine sources should i look?). Is it
even possible to zoom in/zoom out (or drill through)?

Thanks
Re: Chart Engine and zooming [message #367751 is a reply to message #367729] Mon, 06 April 2009 18:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Marius,

The SVG viewer comes with Zoom capabilites but this does not change the
dataset. I assume you want to alter the grouping unit/min max and step
an re-render the chart?

If this is what, David posted some code that modifies the model. You
should be able to changes these values and just rebuild the chart.

public Chart zoom(Chart cm, String zoomValue){
ChartWithAxes chart = (ChartWithAxes)cm;
Axis xAxis = (Axis) chart.getAxes( ).get( 0 );
Scale xScale = xAxis.getScale( );
SeriesDefinition xSeriesDef =
(SeriesDefinition)xAxis.getSeriesDefinitions( ).get( 0 );
SeriesGrouping xGrouping = xSeriesDef.getGrouping( );
Calendar today = Calendar.getInstance( );
today.setTimeZone( TimeZone.getTimeZone( "GMT+2" ) );

today.set( Calendar.MONTH, Calendar.AUGUST );
today.set( Calendar.DATE, 6 );
today.set (Calendar.HOUR, 16);
today.set( Calendar.MINUTE, 0 );
today.set( Calendar.SECOND, 0 );

xScale.setMax( DateTimeDataElementImpl.create( today ) );
Calendar start = (Calendar)today.clone( );
start.set( Calendar.HOUR, 9 );
start.set( Calendar.MINUTE, 30 );
start.set( Calendar.SECOND, 0 );
int groupingInterval = 1;
GroupingUnitType groupingUnit = GroupingUnitType.DAYS_LITERAL;
ScaleUnitType scaleUnit = ScaleUnitType.DAYS_LITERAL ;
double step = 1;
if ( zoomValue.equals( "1d" ) )
{
groupingInterval = 2;
groupingUnit = GroupingUnitType.MINUTES_LITERAL ;
scaleUnit = ScaleUnitType.HOURS_LITERAL ;
step = 2;
}
else if ( zoomValue.equals( "5d" ) )
{
start.add( Calendar.DATE, -5 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.HOURS_LITERAL ;
scaleUnit = ScaleUnitType.DAYS_LITERAL ;
step = 1;
}
else if ( zoomValue.equals( "1m" ) )
{
start.add( Calendar.MONTH, -1 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.HOURS_LITERAL ;
scaleUnit = ScaleUnitType.DAYS_LITERAL ;
step = 1;
}
else if ( zoomValue.equals( "3m" ) )
{
start.add( Calendar.MONTH, -3 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.DAYS_LITERAL ;
scaleUnit = ScaleUnitType.WEEKS_LITERAL ;
step = 1;
}
else if ( zoomValue.equals( "6m" ) )
{
start.add( Calendar.MONTH, -6 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.DAYS_LITERAL ;
scaleUnit = ScaleUnitType.MONTHS_LITERAL ;
step = 1;
}
else if ( zoomValue.equals( "YTD" ) )
{
start.set( Calendar.MONTH, 0 );
groupingInterval = 2;
groupingUnit = GroupingUnitType.DAYS_LITERAL ;
scaleUnit = ScaleUnitType.MONTHS_LITERAL ;
step = 1;
}
else if ( zoomValue.equals( "1y" ) )
{
start.add( Calendar.YEAR, -1 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.WEEKS_LITERAL ;
scaleUnit = ScaleUnitType.MONTHS_LITERAL ;
step = 1;
}
else if ( zoomValue.equals( "5y" ) )
{
start.add( Calendar.YEAR, -5 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.MONTHS_LITERAL ;
scaleUnit = ScaleUnitType.YEARS_LITERAL ;
step = 1;
}
else if ( zoomValue.equals( "10y" ) )

{
start.add( Calendar.YEAR, -10 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.MONTHS_LITERAL ;
scaleUnit = ScaleUnitType.YEARS_LITERAL ;
step = 1;

}
else if ( zoomValue.equals( "All" ) )
{
start.add( Calendar.YEAR, -10 );
groupingInterval = 1;
groupingUnit = GroupingUnitType.MONTHS_LITERAL ;
scaleUnit = ScaleUnitType.YEARS_LITERAL ;
step = 1;
}

xGrouping.setGroupingInterval( groupingInterval );
xGrouping.setGroupingUnit( groupingUnit );
xScale.setUnit( scaleUnit );
xScale.setStep( step );
xScale.setMin( DateTimeDataElementImpl.create( start ) );
xScale.setShowOutside( false );
return cm;
}


Jason

Marius Cetateanu wrote:
> Anyone?
>
> I don't need a full example, just a hint or someone to point me in the
> right direction (where in the charts engine sources should i look?). Is
> it even possible to zoom in/zoom out (or drill through)?
>
> Thanks
>
Re: Chart Engine and zooming [message #502772 is a reply to message #367729] Wed, 09 December 2009 16:39 Go to previous messageGo to next message
samir  is currently offline samir Friend
Messages: 1
Registered: November 2009
Junior Member
Hi, I have the same problem; but I need more details about zoom In/zoom out of selected area in the chart ! Could you give me a complete java class to complete my works ! I'm completely bloqued ... It's too urgent please ! Confused

Thanks a lot
Re: Chart Engine and zooming [message #502850 is a reply to message #502772] Wed, 09 December 2009 22:47 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Samir,

In this same thread is an example David posted that modifies a chart
model. Will that example not work for you or are you wanting something
in JavaScript?

Jason

samir wrote:
> Hi, I have the same problem; but I need more details about zoom In/zoom
> out of selected area in the chart ! Could you give me a complete java
> class to complete my works ! I'm completely bloqued ... It's too urgent
> please ! :?
> Thanks a lot
Previous Topic:Pie Chart with depth legend
Next Topic:Install conflicts?
Goto Forum:
  


Current Time: Fri Apr 26 06:45:15 GMT 2024

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

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

Back to the top