Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Timeseries node cannot be plotted with LINE node #96

Open
Ben-Epstein opened this issue Jun 10, 2023 · 1 comment
Open

Timeseries node cannot be plotted with LINE node #96

Ben-Epstein opened this issue Jun 10, 2023 · 1 comment

Comments

@Ben-Epstein
Copy link
Collaborator

Ben-Epstein commented Jun 10, 2023

Given this flow

flojoy.txt

After being executed, the timeseries plot won't load.
image

I took the dc_input from the LINE node of the timeseries, and saved it to disk. I loaded it in jupyter and the plot rendered just fine, both using px.express and px.graph_object

image image

Not sure why the UI can't render the timeseries plot, but it has something to do with the x being timeseries data. If I replace it with None or np.random.rand in the TIMESERIES node code, it renders as expected

@jackparmer
Copy link
Contributor

Hmm, yeah, TIMESERIES and LINE are both early era nodes that haven't been updated in a while.

The solution that I would recommend:

  1. The TIMESERIES generator is updated to output a DataContainer of type timeseries, which we define as a Pandas dataframe with an index of type DatetimeIndex (see, https://jakevdp.github.io/PythonDataScienceHandbook/03.11-working-with-time-series.html)

https://github.com/flojoy-io/nodes/blob/main/GENERATORS/SIMULATIONS/TIMESERIES/TIMESERIES.py

  1. LINE is updated to recognize the timeseries DataContainer type, and make sure that the DatetimeIndex is correctly converted to plotly's preferred string format for dates (' YYYY-MM-DD hh:mm:ss '). IIRC both pandas and plotly should be capable of nanosecond precision but worth testing: https://pandas.pydata.org/docs/reference/api/pandas.DatetimeIndex.nanosecond.html

https://github.com/flojoy-io/nodes/blob/main/VISUALIZERS/PLOTLY/LINE/LINE.py#L16

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants