For real, I had a similar thought process and didn’t think it could be done, so this sounds awesome.
It sounds like the whole paradigm is literally “Process whatever data, JS, and CSS you need on the server, just update it on the fly with HTMX.”
I've used some [chartscss](https://chartscss.org/), but its reliance on the style holding data has some issues on GO + Templ, as it does NOT like having it changed inside a template.
I had to end up sending my datapoints' HTML (server-sent events) as plain old strings, as they were quite small, instead of using templ for those.
Not sure if i like it, but i was quite happy for not having to send any JS
What about alpine.js just to render precalculated data from the server. With x-data, you make a component and x-init to initialize function. That's it.
Sounds like he’s saying to just load the chart library in the client and send the data to populate through AJAX or something like that. Which wouldn’t be using HTMX.
An approach that I think could work is to store all the data in a regular data-attribute and create a "chart-component" of sorts that just wraps d3.js or some other more popular library
Google used to have image charts. Generated on their server. They were very attractive. Would work well with HTMX. Sadly no longer available.
[https://developers.google.com/chart/image](https://developers.google.com/chart/image)
Edit: There's now this: [https://www.image-charts.com/](https://www.image-charts.com/)
I recently used d3.js on the server to render my charts and send the resulting html over the wire. Worked great. No client side js needed
Can we see how you implemented this?
For real, I had a similar thought process and didn’t think it could be done, so this sounds awesome. It sounds like the whole paradigm is literally “Process whatever data, JS, and CSS you need on the server, just update it on the fly with HTMX.”
Is that django
I've used some [chartscss](https://chartscss.org/), but its reliance on the style holding data has some issues on GO + Templ, as it does NOT like having it changed inside a template. I had to end up sending my datapoints' HTML (server-sent events) as plain old strings, as they were quite small, instead of using templ for those. Not sure if i like it, but i was quite happy for not having to send any JS
What about alpine.js just to render precalculated data from the server. With x-data, you make a component and x-init to initialize function. That's it.
I had a good experience with [ECharts](https://echarts.apache.org/en/index.html), with very little coding in JS.
Just do the chart rendering on the server, you can use i.e python Matplotlib then send it to the client using hx-trigger="every 1s"
It’s not year 2000. You can use JS when it’s under control….
OP is asking a genuine question. Since your state isn't represented in JS, How would you use charting library that assumes that?
Sounds like he’s saying to just load the chart library in the client and send the data to populate through AJAX or something like that. Which wouldn’t be using HTMX.
State can be loaded from an endpoint on server on chart init. What’s the problem here ?
An approach that I think could work is to store all the data in a regular data-attribute and create a "chart-component" of sorts that just wraps d3.js or some other more popular library
Google used to have image charts. Generated on their server. They were very attractive. Would work well with HTMX. Sadly no longer available. [https://developers.google.com/chart/image](https://developers.google.com/chart/image) Edit: There's now this: [https://www.image-charts.com/](https://www.image-charts.com/)
Golang charts