Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Chart X Axis Labels inbetween data points?
Chart X Axis Labels inbetween data points? [message #1014879] Tue, 26 February 2013 16:23 Go to next message
Eclipse GuestFriend
Messages: 93
Registered: February 2013
Location: Vienna
Member
Hi,
I have a dataset with categories on x axis and numbers on y axis. But the categories (x axis) represent datetime values. I won't explain why I use the categories instead of a datetime axis, just accept that I have a reason for it Wink

So my problem now is that I want to display hours on the x axis labels. Since my datapoints represent hourly aggregates, it would be inappropriate to put the label "10:00" under a datapoint which actually represents the aggregate 10-11 o'clock. So I want the date/datetime/time to be displayed under the tick to the left of the category. That way, the datapoint for the aggregate 10-11 o'clock would be positioned in the middle of the label '10:00' and the label '11:00' which makes it easier for the user to understand that it's the aggregate of 10:00-11:00.

By the way: "Cross between categories" doesn't work because it moves both the label and the datapoint.

In the attached picture you will understand what I mean: I create the labels from a string (in beforeDrawAxisLabel) but they should appear under the ticks and not under the datapoints.

Any help is very much appreciated!

Thanks in advance for your input. Cheers, Jakob

[Updated on: Tue, 26 February 2013 16:28] by Moderator

Report message to a moderator

Re: Chart X Axis Labels inbetween data points? [message #1014941 is a reply to message #1014879] Tue, 26 February 2013 21:40 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

You could try adjusting the inset on your axis label either from the chart editor or by using something like the following in your chart script:

function beforeDrawAxisLabel( axis, label, icsc )
{
if(axis.isCategoryAxis())
{
label.getInsets().setRight(20);
}
}


Michael

Developer Evangelist, Silanis

[Updated on: Tue, 26 February 2013 21:41]

Report message to a moderator

Re: Chart X Axis Labels inbetween data points? [message #1014946 is a reply to message #1014941] Tue, 26 February 2013 22:07 Go to previous messageGo to next message
Eclipse GuestFriend
Messages: 93
Registered: February 2013
Location: Vienna
Member
Thanks for the idea. That may work, but it puts some constraints: no chart resize, no resizing of the font / changing the font etc. Otherwise it will mess everything up. Furthermore it would not be possible to create a label for the last tick (as I would need one tick more than I have categories.

So... thanks so far, but if anybody has another idea I would appreciate it very much!
Re: Chart X Axis Labels inbetween data points? [message #1014953 is a reply to message #1014946] Tue, 26 February 2013 22:45 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

I don't know that there will be another way. If you find one, please post it in here. I'll do the same.

Michael

Developer Evangelist, Silanis
Re: Chart X Axis Labels inbetween data points? [message #1022072 is a reply to message #1014879] Thu, 21 March 2013 08:34 Go to previous messageGo to next message
Tony Hsiao is currently offline Tony HsiaoFriend
Messages: 13
Registered: March 2013
Junior Member
Hi, have you found solutions to achieve your goal? I came across the same problem and just need some advice, thanks.

[Updated on: Thu, 21 March 2013 08:40]

Report message to a moderator

Re: Chart X Axis Labels inbetween data points? [message #1023091 is a reply to message #1022072] Sat, 23 March 2013 08:08 Go to previous messageGo to next message
Eclipse GuestFriend
Messages: 93
Registered: February 2013
Location: Vienna
Member
No, I didn't find a solution and just went with labels '8:00-9:59 o'clock' for example. Maybe something which would work but which I did not try: A colleague came up with the idea: If I have the category 8:00 which stands for 8-10 o'clock, I would programmatically create a date add one hour, so the date would be 9:00. Then, in the axis settings, set the interval to 2, so that only ticks for 8:00 and 10:00 would be displayed. And the same for an interval of 1 hour, there one would set the interval to 1 and set the artificial date to 8:30.
Re: Chart X Axis Labels inbetween data points? [message #1023745 is a reply to message #1023091] Mon, 25 March 2013 03:37 Go to previous message
Tony Hsiao is currently offline Tony HsiaoFriend
Messages: 13
Registered: March 2013
Junior Member
Well, thanks for your reply! I think I would go with your solution and just set the label text to a range such as "8-10".
Previous Topic:PDF export problem
Next Topic:Toggle between chart and table
Goto Forum:
  


Current Time: Tue Jul 23 09:01:34 GMT 2024

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

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

Back to the top