New answers tagged

0

Using @Mr.Wizard's answer to this question works quite well: textchunk[text_String, len_Integer, size_Integer] := Text[Style[Module[{aa, bb}, aa = Accumulate[Join[{0}, Length@# & /@ Module[{t = 0}, Split[StringLength@# & /@ StringSplit[text, " "], (t += #) <= len || (t = 0) &]]]]; bb = {#[[1]], #[[2]]} & /@ ...


2

If your working hours are stored in the list time according to the format you provided, then your total overtime can be calculated like this time = {{"13/9", "7:00"}, {"14/9", "3:30"}}; overtime = TimeObject@DateList@{#[[2]], {"Hour", ":", "Minute"}} - TimeObject@DateList@{"5:00", {"Hour", ":", "Minute"}} & /@ time; Total@overtime


4

You could use DateList to work out the date. For example, (naïvely assuming week 1 begins on January 1st). {year, week} = {2014, 26}; date = DateList[{year, 1, (week - 1)*7 + 1}] {2014, 6, 25, 0, 0, 0.} For example: dates = {{2014, 2}, {2014, 8}, {2014, 16}, {2014, 26}}; values = {4, 6, 3, 8}; newdates = DateList[{#1, 1, (#2 - 1)*7 + 1}] & @@@ ...


5

Note This answer exposed a bug in DateList's handling of the "Week" (or "WeekShort") element for week one when it begins in the previous year. This was spotted by @ChrisDegnen (see the comments) and has been acknowledged by Wolfram who suggested the workaround. I don't believe DateObject has a concept of a week as a period of time in the same way that it ...


3

It looks like DataListPlot does not understand TimeObjects. You can convert them to Quantity "Hours" and plot this instead. data = {{DateObject[{2016, 1, 1}], TimeObject[{6, 0, 0}]}, {DateObject[{2016, 1, 2}], TimeObject[{8, 0, 0}]}}; hrData = MapAt[UnitConvert[Total@DateValue[#, {"Hour", "Minute", "Second"}, Quantity], "Hours"] &, {All, ...


4

I can't seem to find a built-in way so I propose an extension of my old axisFlip routine: axisFlip = # /. {x_Line | x_GraphicsComplex :> MapAt[# ~Reverse~ 2 &, x, 1], x : ((PlotRange | FrameTicks) -> _) :> x ~Reverse~ 2} &; DateListPlot[{1, 1, 2, 3, 5, 8, 11}, {2000, 8}] // axisFlip This should work with TimeObject as well; let ...



Top 50 recent answers are included