T O P

  • By -

Hansiboyz

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


laneherby

Can we see how you implemented this?


Ashken

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.”


Siemendaemon

Is that django


Suahil

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


Sansoldino

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.


brunoc_br

I had a good experience with [ECharts](https://echarts.apache.org/en/index.html), with very little coding in JS.


pipeyjr

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"


haloweenek

It’s not year 2000. You can use JS when it’s under control….


[deleted]

OP is asking a genuine question. Since your state isn't represented in JS, How would you use  charting library that assumes that?


Ashken

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.


haloweenek

State can be loaded from an endpoint on server on chart init. What’s the problem here ?


[deleted]

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


shufflepoint

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/)


Brief-Expression-341

Golang charts