News for hackers. Stuff that matters.

Ask HN: What are the best charting / graphing JavaScript tools

There are so many options for javascript-based charting and graphing solutions.

For those looking to embed charts and graphs on a website for reporting, what are the best options around today?

Would love to find something as featured and as simple to use as Datatables, for example, that works really quickly and easily for tables and tabular data.

Best ideas?

( 20 comments | 17 points | on HN )
Re:Ask HN: What are the best charting / graphing JavaScript ... by kzzzznot on Wednesday December 23, 2020 @10:43AM (#25518712)
Highcharts is good, lots of demos with code on https://www.highcharts.com/demo

Easy enough to configure when you get used to it and powerful for complex data.

Re:Ask HN: What are the best charting / graphing JavaScript ... by rexreed on Tuesday December 29, 2020 @11:38PM (#25578614)
Some other options:

* Google Charts: https://developers.google.com/chart * Chart.js: https://www.chartjs.org/

Re:Ask HN: What are the best charting / graphing JavaScript ... by catacombs on Wednesday December 23, 2020 @12:47PM (#25520079)
D3 is the best, free option. However, its documentation is atrocious, especially for new users. If you plan to learn, you'll rely on other resources. Luckily, there are numerous free tutorials and book available online.
Re:Ask HN: What are the best charting / graphing JavaScript ... by legg0myegg0 on Wednesday December 23, 2020 @11:19AM (#25519151)
We use plotly.js! It is a layer built on top of D3 and has some great looking charts. It also has some statistical and 3D plots that come in handy for us.
Re:Ask HN: What are the best charting / graphing JavaScript ... by burnto on Wednesday December 23, 2020 @01:26PM (#25520472)
Check out Vega Lite. It wraps D3 to facilitate charting use cases. https://observablehq.com/collection/@observablehq/observable...
Re:Ask HN: What are the best charting / graphing JavaScript ... by rexreed on Wednesday December 23, 2020 @03:09PM (#25521611)
Cool! How does it differ better/worse than Plotly?
Re:Ask HN: What are the best charting / graphing JavaScript ... by jimbobbango on Wednesday December 23, 2020 @09:56AM (#25518177)
D3 js is well known, but it used to not work with React because of Reacts's virtual dom stuff, D3 works with the dom directly i beleive, i would assume there is an npm package that allows u to work with both,

React Charts library was nice if i remember correctly

Re:Ask HN: What are the best charting / graphing JavaScript ... by jbreckmckye on Wednesday December 23, 2020 @10:48AM (#25518785)
Get React to give you a DOM reference and then run the D3 code with it during a post render callback or effect.
Re:Ask HN: What are the best charting / graphing JavaScript ... by rhodysurf on Wednesday December 23, 2020 @11:04AM (#25518984)
You can just use D3 for the layout work and render with an SVG in react and it works really well.
Re:Ask HN: What are the best charting / graphing JavaScript ... by jimbobbango on Thursday December 24, 2020 @03:08AM (#25525855)
its been a few years since i tried, thanks for the tip
Re:Ask HN: What are the best charting / graphing JavaScript ... by koolk3ychain on Wednesday December 23, 2020 @10:04PM (#25524709)
At least for graph / DAG visualization Vis.JS is absolutely incredible. It also interfaces with React.JS almost effortlessly.
Re:Ask HN: What are the best charting / graphing JavaScript ... by joshxyz on Wednesday December 23, 2020 @11:39AM (#25519391)
Airbnb visx is coo coo coo coo coool check it out

Edit: also uplot by leoniya (did i spell it right) for timeseries

Re:Ask HN: What are the best charting / graphing JavaScript ... by leeoniya on Sunday December 27, 2020 @09:55PM (#25556271)
> did i spell it right

almost ;)

https://github.com/leeoniya/uPlot

Re:Ask HN: What are the best charting / graphing JavaScript ... by sheunl on Wednesday December 23, 2020 @09:56AM (#25518180)
Excel?
Re:Ask HN: What are the best charting / graphing JavaScript ... by rexreed on Wednesday December 23, 2020 @03:10PM (#25521626)
I'm looking for web-based real-time charting / graphing that uses Javascript. I don't think there's an excel rendering in Javascript that is embedable or free like DataTables if it does exist.
Re:Ask HN: What are the best charting / graphing JavaScript ... by jimbobbango on Wednesday December 23, 2020 @09:59AM (#25518219)
At work its Java Apache POI exporting Excel reports
Re:Ask HN: What are the best charting / graphing JavaScript ... by jbreckmckye on Wednesday December 23, 2020 @10:46AM (#25518749)
Graphing and charting are quite different things. Charts are things like bar and pie visualisations. Graphs are networks of connections, like family trees or sequence diagrams.

If you want to visualise graphs, I have had good experiences using d3-graphviz, which can consume GraphViz DOT files - DOT is an excellent and well supported DSL for this job.

DOT lets you specify nodes and their edges quite concisely, apply positioning and ranking hints, and the d3 visualiser does a great job usually of laying out the nodes with minimal path crossover. You can then hook into the d3 selections to render however you please, generally in SVG.

A nice thing about having an SVG render is that it's very easy to attach events, and inline SVGs can be styled with CSS. So you could plot e.g. a network of CI tasks and set up a click to take you to a job summary, just like the CircleCI UI. Or visualise step functions, sagas or state machines in similar wise.

There is an actual WASM build of GraphViz compiled from C++ (you can find it on NPM) but the bundle is enormous - over a megabyte of data.

I suspect, however, that what you are really looking for is a charting library. In that case my suggestion is to purchase a license for HiCharts or another commercial product, rather than assemble something yourself through D3.

Re:Ask HN: What are the best charting / graphing JavaScript ... by rapidlua on Wednesday December 23, 2020 @11:15AM (#25519103)
> but the bundle is enormous - over a megabyte of data

If only DOT layout engine and JSON output format is enabled at compile time it is about 600KiB, or less than 200KiB Gzipped. https://github.com/rapidlua/viz.js

> A nice thing about having an SVG render is that it's very easy to attach events, and inline SVGs can be styled with CSS.

Indeed it’s super handy! I’m using this approach in https://LuaJIT.me to produce an interactive visualisation of a graph of traces in a JIT compiler.

Re:Ask HN: What are the best charting / graphing JavaScript ... by rendang on Wednesday December 23, 2020 @12:10PM (#25519691)
While 'graph' can mean both 1) a synonym for 'chart' or 'plot' or 2) a graph as in graph theory, the word 'graphing' is far likelier to refer to the former definition.
Re:Ask HN: What are the best charting / graphing JavaScript ... by rexreed on Wednesday December 23, 2020 @02:46PM (#25521367)
Seeing as Plotly.js describes themselves as "Plotly JavaScript Open Source Graphing Library" #1 is what I was going for in my question.