flex - Making DateTimeAxis with weekly labels set ticks on an arbitrary day of the week -
i'm using cartesianchart datetimeaxis display weekly data in flex application. when set dataunits="weeks" , labelunits="weeks" on datetimeaxis, automatically places each major tick on sunday. however, provide users option of beginning week on sunday or monday. how can ask datetimeaxis instead place major ticks on monday (or other day of week)?
for example, if user looking @ total sum of on week, , requests weeks start on sunday, series data like:
x: date(july 11, 2010) y: 25 x: date(july 18, 2010) y: 30 x: date(july 25, 2010) y: 32 etc.
if weeks start on monday, series data instead like:
x: date(july 12, 2010) y: 22 x: date(july 19, 2010) y: 33 x: date(july 26, 2010) y: 29 etc.
with second data set, major ticks still on july 11, july 18, july 25, etc. bars shifted off-center major ticks.
thanks!
i looked @ code of datetimeaxis class , i'm sure can't want. if "alignlabelstounits" property set true (default) labels created rounding series data dates appropriate units. in case (weeks) looks this:
case "weeks": d[hoursp] = 0; d[minutesp] = 0; d[secondsp] = 0; d[millisecondsp] = 0; if (d[dayp] != 0) d[datep] = d[datep] + (7 - d[dayp]); break;
so can see, checks if processed date first day of week (hard-coded 0), , if not, it's changed such. achieve behavior seek, you'd have override function label creation , write 1 date rounding, default rounding function declared private.
Comments
Post a Comment