To fix bars width in the bar chart [message #369107] |
Tue, 28 July 2009 16:04 |
haritha 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 |
Eclipse User |
|
|
|
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
>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02414 seconds