Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 16:04 Go to next message
haritha is currently offline harithaFriend
Messages: 33
Registered: July 2009
Member
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 23: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 19:45 Go to previous messageGo to next message
haritha is currently offline harithaFriend
Messages: 33
Registered: July 2009
Member
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 18:19 Go to previous messageGo to next message
A R is currently offline A RFriend
Messages: 104
Registered: April 2012
Senior Member
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 23:24]

Report message to a moderator

Re: To fix bars width in the bar chart [message #869858 is a reply to message #869626] Fri, 04 May 2012 14:43 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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 434 times)
Re: To fix bars width in the bar chart [message #1703490 is a reply to message #369107] Sat, 01 August 2015 08:02 Go to previous message
babburi raju is currently offline babburi rajuFriend
Messages: 2
Registered: August 2015
Junior Member



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: Thu Apr 18 07:18:59 GMT 2024

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

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

Back to the top