nadavrot / layout

Layout is a rust library and a tool that renders Graphviz dot files.
MIT License
626 stars 35 forks source link

[Feature Request] Color Gradient support #23

Open vpochapuis opened 4 months ago

vpochapuis commented 4 months ago

Hello! Thank you for this crate! I needed a quick way to draw graph in the browser and update it in real-time (I am using Yew as the frontend Framework), and it works great!

It would be nice to have a way to support something similar to the ColorList feature of graphivz: https://graphviz.org/docs/attr-types/colorList/

In my specific use case I would like to represent the State of Charge of a battery as the fill color gradient. A bit like so as showed in the previous link: image

If there is already another existing way to do so please let me know! Thank you for your time

nadavrot commented 4 months ago

Thanks for the feedback. It should be easy to implement this feature, but I am not sure if I have time in the near future. I am curious about your use of the library. Do you have a demo that I can look at?

vpochapuis commented 4 months ago

Thanks for the feedback. It should be easy to implement this feature, but I am not sure if I have time in the near future. I am curious about your use of the library. Do you have a demo that I can look at?

Thanks for the quick reply! I will ask whether its ok or not for me to show the actual usage of it as for now, and in the worst case i will try to make a small POC to reproduce a similar use case using yew and some dummy data.

I also use plotters extensively for things like charts. (on a Canvas backend though).

vpochapuis commented 4 months ago

I have asked.

So here is 2 little video demo of how it works.

The first one shows an update of a graph generated using the library, based on the location of the cursor on a plotters chart.

https://github.com/nadavrot/layout/assets/75721408/75969892-f619-41d4-8572-475230a9bb96

The second one shows an automatic update of the generated graph based on the latest data received by the UI State.

https://github.com/nadavrot/layout/assets/75721408/c7516949-d519-4d77-9a99-324e05ea2f12

The graph is a representation of the prototype battery system that we are developing.

(All visuals are under development).

Notes

nadavrot commented 4 months ago

Very cool!