Conditional X Axis Labeling

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Conditional X Axis Labeling

Sean P. DeNigris
Administrator
http://stackoverflow.com/questions/25414857/roassal-conditional-x-axis-labeling

In my chart, the x axis represents the Date. I'd like to only label the first day of a month. Specifying a number of ticks is problematic because they can be fractional.

What I'm looking for is something like:

someRoassalObject
  if: [ :point | point date dayOfMonth = 1 ]
  label: [ :point | point date mmddyyyy ]
(where points are my domain objects that respond to #date)

I did the following quick and dirty hack in the mean time:

b axisConfiguration
        labelConvertion: [ :x | (Date julianDayNumber: x rounded) mmddyyyy ].
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Conditional X Axis Labeling

abergel
Hi Sean,

I have the same problem. However, I have no better solution than the one you propose (using the julianDay).

The problem is the following, if I want to have a set values ranging from A to B along a portion of 100 pixels. Each label for tick I is obtained with something like A +(B - A) * I.
Unfortunately, this kind of arithmetic works well with numbers, but not with dates. I therefore have no immediate solution. Charting is difficult. I am sure we will come with a reliable solution soon. Having date on the X-axis is important.

Alexandre


On Aug 23, 2014, at 7:57 AM, Sean P. DeNigris <[hidden email]> wrote:

> http://stackoverflow.com/questions/25414857/roassal-conditional-x-axis-labeling
>
> In my chart, the x axis represents the Date. I'd like to only label the
> first day of a month. Specifying a number of ticks is problematic because
> they can be fractional.
>
> What I'm looking for is something like:
>
> someRoassalObject
>  if: [ :point | point date dayOfMonth = 1 ]
>  label: [ :point | point date mmddyyyy ]
> (where points are my domain objects that respond to #date)
>
> I did the following quick and dirty hack in the mean time:
>
> b axisConfiguration
>        labelConvertion: [ :x | (Date julianDayNumber: x rounded) mmddyyyy
> ].
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Conditional-X-Axis-Labeling-tp4774245.html
> Sent from the Moose mailing list archive at Nabble.com.
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev