Skip to content
Dashboard

Curve fitting for charts: better visualizations for Vercel Analytics

Software Engineer

Link to headingBefore and after

It is difficult to find trends in a graph with a lot of noise.It is difficult to find trends in a graph with a lot of noise.
It is difficult to find trends in a graph with a lot of noise.
A best fit line shows the graph's trend at a glance.A best fit line shows the graph's trend at a glance.
A best fit line shows the graph's trend at a glance.

Link to headingThe challenge

The first and final points of the graph don't tell an accurate story for the whole dataset.
The first and final points of the graph don't tell an accurate story for the whole dataset.

Link to headingA better way

The palmerspenguins dataset is quite random and trends may not be obvious at first glance.

View data on Observable

A linear regression can give a quick and naive trend for a chart.

Interact with this chart on Observable

A quadratic dataset with an order of 2.

Interact with this chart on Observable

Link to headingThe "good" fit

Finding "best fit" using a training set and a test set.

Interact with this chart on Observable

A chart showing "best fit" gives us a value of 2.

View data on Observable

Link to headingTry it out