Skip to main content



      Home
Home » Archived » BIRT » To fix bars width in the bar chart
To fix bars width in the bar chart [message #369107] Tue, 28 July 2009 12:04 Go to next message
Eclipse UserFriend
Hi,

Using the birt api,i am creating rptdesign file ,which contains only
bar chart.I have mapped the xaxis and yaxis of the bar chart to the data
set column.In my application,i dont know the number of items that will be
shown in the bar chart ,after i run the chart.Number of items to be shown
in the bar chart are random ,coming from my database.So if the item is
1,then the width of bar in the bar chart increases ,if the items are
10,then the width of bar in the bar chart decreases(I have made bar chart
width constant).i want to keep the bar width constant,also the bar chart
width constant,only the spacing between the bars should change,how can i
do it?

Please help.

Thanks in advance,
Haritha
Re: To fix bars width in the bar chart [message #369576 is a reply to message #369107] Tue, 28 July 2009 19:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.windstream.net

Haritha,

You may want to look at the bar.java class to see how the width is
calculated. You can set the unit spacing variable with is the space
between bars. So you may be able to try something like this in script:

function beforeDrawSeries( series, seriesRenderer, context )

{
if( seriesRenderer.getClass() == "class
org.eclipse.birt.chart.render.Bar"){
srh = seriesRenderer.getSeriesRenderingHints();
dph1 = srh.getDataPoints();
//size of precalced bar
var sz = dph1[0].getSize();
//number of points
var ln = dph1.length;
var nus = sz/3;
context.getChartInstance().setUnitSpacing(nus);
}
}

It want be exact but should get you in the ball park. Not the getSize
returns the points for the precalculated bar width before the unit
spacing is applied.

Jason

haritha wrote:
> Hi,
>
> Using the birt api,i am creating rptdesign file ,which contains only
> bar chart.I have mapped the xaxis and yaxis of the bar chart to the data
> set column.In my application,i dont know the number of items that will
> be shown in the bar chart ,after i run the chart.Number of items to be
> shown in the bar chart are random ,coming from my database.So if the
> item is 1,then the width of bar in the bar chart increases ,if the items
> are 10,then the width of bar in the bar chart decreases(I have made bar
> chart width constant).i want to keep the bar width constant,also the bar
> chart width constant,only the spacing between the bars should change,how
> can i do it?
>
> Please help.
>
> Thanks in advance,
> Haritha
>
Re: To fix bars width in the bar chart [message #375498 is a reply to message #369576] Wed, 29 July 2009 15:45 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Jason.It resolved my problem.
Re: To fix bars width in the bar chart [message #869626 is a reply to message #369576] Thu, 03 May 2012 14:19 Go to previous messageGo to next message
Eclipse UserFriend
Hi Harita - Can u please share the example. I am trying the same but not getting the right output

[Updated on: Thu, 03 May 2012 19:24] by Moderator

Re: To fix bars width in the bar chart [message #869858 is a reply to message #869626] Fri, 04 May 2012 10:43 Go to previous messageGo to next message
Eclipse UserFriend
Take a look at the attached report.

Jason

On 5/3/2012 2:19 PM, Amar Reddy wrote:
> Can u please share the example. I am trying the same but not getting the
> right output
  • Attachment: BarSpace.zip
    (Size: 10.42KB, Downloaded 455 times)
Re: To fix bars width in the bar chart [message #1703490 is a reply to message #369107] Sat, 01 August 2015 04:02 Go to previous message
Eclipse UserFriend



hi.
above file scripting is not working.please provide valid script
.and i am using birt 4.5



thanks & regards
raju











Previous Topic:BIRT DE with POJO and ODA (not a Scripted Source)
Next Topic:Access the report parameters as array
Goto Forum:
  


Current Time: Wed Jul 16 06:42:00 EDT 2025

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

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

Back to the top