Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to get a chart image to use in flow? #1600

Closed
ortegafernando opened this issue Jan 29, 2025 · 2 comments
Closed

Is there any way to get a chart image to use in flow? #1600

ortegafernando opened this issue Jan 29, 2025 · 2 comments
Labels
feature-request New feature or request that needs to be turned into Epic/Story details needs-triage Needs looking at to decide what to do

Comments

@ortegafernando
Copy link

ortegafernando commented Jan 29, 2025

Description

Hi, I am not speaking about getting a chart image for the dashboard. This is already every well done.

I am speaking about, for example, a second output in the chart node where you can get the rendered IMAGE of the chart and then use any other node in the flow to send that image (teelgrambot, email, .... ).

Does anyone know a solution ? Thanks.

Something like this but updated:
node-red-contrib-chart-image

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

@ortegafernando ortegafernando added feature-request New feature or request that needs to be turned into Epic/Story details needs-triage Needs looking at to decide what to do labels Jan 29, 2025
@bartbutenaers
Copy link
Contributor

Hi @ortegafernando,

Your question sounds very logical, but there is a bit of a technical problem to implement such a feature inside a dashboard. The problem is that the charting library runs in the frontend client.

I will try to explain it with a simple drawing:

Image

  1. You inject an input message into the ui-chart node to tell the node to create a snapshot image of the chart.
  2. Since the chart library runs on the client-side (i.e. in the browser where you frontend dashboard is displayed), the ui-chart node will have to push that request to the N clients that are open at that time.
  3. The N clients take a snapshot of the image, and return the snapshot image back to the backend ui-chart node running on your server.
  4. The ui-chart node returns N output messages, containing a snapshot image.

As a result you will get N snapshot images, where N is the number of dashboards open at that time. So while the expected behaviour will be to get 1 single snapshot images, you might get:

  • Multiple duplicate images
  • Zero images (when no clients are open at that time).
  • Multiple different images (if the clients show the charts differently e.g. zoomed or whatever)

I had similar issues in the past with my ui-svg and ui-heatmap nodes. The only decent solution is to handle all of this in the server-side of the ui node, however that is not possible here since the chart library runs in the frontend.

The author of that node-red-contrib-chart-image node has worked around that problem, by running the chartjs library on the server-side in his node (via the chartjs-node-canvas library). That is a very clever way to do it, but it is obviously not related to any dashboard technologies (for the reasons I explained above).

So that node is the most optimal solution for your use case. Hopefully it is still maintained...

Good luck with your project,
Bart

@ortegafernando
Copy link
Author

Thanks a lot @bartbutenaers I can close this comment.

@github-project-automation github-project-automation bot moved this from Backlog to Done in Dashboard Backlog Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request that needs to be turned into Epic/Story details needs-triage Needs looking at to decide what to do
Projects
Status: Done
Development

No branches or pull requests

2 participants