Help Setting Serial Chart From and To
-
I have a watch list serial chart in a dashboard. I do not want the From and To to be populated by datebar.To and datebar.From instead I want it to always be the trailing 7 days and still enable the user to zoom if desired.
So ideally it would be like:
to: datetime.datetime.now()
from: datetime.datetime.now() - timedelta(days=7)Any thoughts on how to achieve this are much appreciated.
Thanks
-
Hi chio,
You could achieve this with an ma-date-range-picker that was hidden on the page. Something like,
<ma-date-range-picker style="display: none" preset="LAST_1_WEEKS" to="toTimestamp" from="fromTimestamp"></ma-date-range-picker>
and then use the toTimestamp and fromTimestamp in the chart's markup.
-
@phildunlap thanks this worked great
-
Glad to hear it, I mostly took it from this thread: https://forum.infiniteautomation.com/topic/3590/ma-date-range-picker