There are a lot of charting libraries for the web. Somehow, this one fills a niche that we think still exists. If nothing else, we find it useful, and will be using it ourselves! It's still super early in development, so expect lots of changes.
We're designing @carbonplan/charts with a few goals in mind:
built for modern react :arrow_upper_right:
fully responsive :left_right_arrow:
modular and composable :recycle:
easy to theme via theme-ui :sparkles:
plays great with MDX :tada:
It's also super light weight, depending only on react and theme-ui and some d3 utility packages. If there's interest we could probably factor out the theme-ui dependency so it's optional.
background
This package is most directly inspired by pancake, an experimental package build for svelte. The concept motivating pancake is that responsive charts that adapt fluidly to their containers without the need for redrawing can be built by carefully combining HTML for the chart and axes and SVG with viewBox for the graphical elements. It's like an SVG sandwich or pancake. Pick your favorite food metaphor. Rich Harris described the concept super clearly in a blog post. Without knowing about pancake, we started doing almost exactly the same thing a few months ago for our charts at CarbonPlan. There must be something to it.
However, to our knowledge, none of the existing charting libraries for JS help streamline this pattern. And pancake is built for svelte, whereas we're mainly using react. That's how we got here.
Also worth mentioning that we've used vega and vega-lite and d3 a lot. We love them, we're taking inspiration all over the place, and even using some d3 utilities under the hood. Incredibly grateful to the developers of those tools.
usage
Here's a super simple scatter chart just to give you the idea.
This creates the following chart, shown with the light and dark themes of @carbonplan/theme.
Many more examples and documentation coming soon.
development
To update a component and publish a new version, first make your changes, then follow these steps
Increase the version number in package.json
npm run build
npm publish
license
All the code in this repository is MIT-licensed, but we request that you please provide attribution if reusing any of our digital content (graphics, logo, articles, etc.).
about us
CarbonPlan is a nonprofit organization that uses data and science for climate action. We aim to improve the transparency and scientific integrity of climate solutions with open data and tools. Find out more at carbonplan.org or get in touch by opening an issue or sending us an email.
We found that @carbonplan/charts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 3 open source maintainers collaborating on the project.
Last updated on 13 Mar 2024
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
CISA launched a new project called Vulnrichment to enrich CVEs with details that help prioritize patching and mitigation efforts, as the NVD backlog of unenriched CVEs awaiting analysis surpasses 10,000.
Socket is joining forces with CISA and other industry leaders at the RSA Conference to sign the Secure by Design pledge, committing to uphold the highest security standards in our products.
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.