# Pie Charts

Published articles for Pie Charts.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Simple pie charts with fallback, today

DevFeed: [Simple pie charts with fallback, today](<https://devfeed.tech/articles/simple-pie-charts-with-fallback-today-52125.md>)

Original publisher: [Read original article](<https://lea.verou.me/2020/11/simple-pie-charts-with-fallback-today/>)

Author: Lea Verou

Published: 2020-11-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Lea Verou's blog](<https://devfeed.tech/sources/lea-verou-s-blog.md>)

Topics: [Data visualization](<https://devfeed.tech/topics/data-visualization.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [web graphics](<https://devfeed.tech/topics/web-graphics.md>), [browser](<https://devfeed.tech/topics/browser.md>), [polyfill](<https://devfeed.tech/topics/polyfill.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [charts](<https://devfeed.tech/tags/charts.md>), [conic-gradient](<https://devfeed.tech/tags/conic-gradient.md>), [css](<https://devfeed.tech/tags/css.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [fallback](<https://devfeed.tech/tags/fallback.md>), [firefox](<https://devfeed.tech/tags/firefox.md>), [graceful-degradation](<https://devfeed.tech/tags/graceful-degradation.md>), [gradient](<https://devfeed.tech/tags/gradient.md>), [pie](<https://devfeed.tech/tags/pie.md>), [pie-charts](<https://devfeed.tech/tags/pie-charts.md>), [polyfill](<https://devfeed.tech/tags/polyfill.md>), [prefix-free](<https://devfeed.tech/tags/prefix-free.md>), [tips](<https://devfeed.tech/tags/tips.md>)

### AI overview

For IE11 support, use a linear-gradient progress bar as a graceful fallback and switch to a conic-gradient pie with `@supports` in capable browsers. The excerpt's example uses matching color stops; CSS variables can avoid duplicating the percentage in relatively modern browsers. A square fallback keeps chart dimensions consistent, though it is not a pie. The older conic-gradient polyfill is discouraged for production unless `-prefix-free` is already in use, because it adds a heavy dependency that reprocesses CSS and loses sourcemaps. Radial-gradient circles are a poor substitute: naive radius scaling misrepresents area, and getting the desired proportions requires a square-root calculation.

### Source excerpt

Five years ago, I had written this extensive Smashing Magazine article detailing multiple different methods for creating simple pie charts, either with clever use of transforms and pseudo-elements, or with SVG stroke-dasharray. In the end, I mentioned creating pie charts with conic gradients, as a future technique. It was actually a writeup of my "The Missing Slice" talk, and an excerpt of my CSS Secrets book, which had just been published. I was reminded of this article today by someone on Twitter: https://twitter.com/sam\_kent\_/status/1326805431390531584 I suggested conic gradients, since they are now supported in >87% of users' browsers, but he needed to support IE11. He suggested using my polyfill from back then, but this is not a very good idea today. https://twitter.com/fcorradini/status/1326880827825905665 Indeed, unless you really need to display conic gradients, even I would not recommend using the polyfill on a production facing site. It requires -prefix-free, which re-fetches (albeit from cache) your entire CSS and sticks it in a <style> element, with no sourcemaps since those were not a thing back when -prefix-free was written. If you're already using -prefix-free, the polyfill is great, but if not, it's way too heavy a dependency. Pie charts with fallback (modern browsers) Instead, what I would recommend is graceful degradation, i.e. to use the same color stops, but in a linear gradient. We can use @supports and have quite an elaborate progress bar fallback. For example, take a look at this 40% pie chart: .pie { height: 20px; background: linear-gradient(to right, deeppink 40%, transparent 0); background-color: gold; } @supports (background: conic-gradient(white, black)) { .pie { width: 200px; height: 200px; background-image: conic-gradient(deeppink 40%, transparent 0); border-radius: 50%; } } This is what it looks like in Firefox 82 (conic gradients are scheduled to ship unflagged in Firefox 83) or IE11: Note that because @supports is only used for the

## Conical gradients, today!

DevFeed: [Conical gradients, today!](<https://devfeed.tech/articles/conical-gradients-today-52087.md>)

Original publisher: [Read original article](<https://lea.verou.me/2015/06/conical-gradients-today/>)

Author: Lea Verou

Published: 2015-06-18T00:00:00Z

Content type: release

Language: en

Sources: [Lea Verou's blog](<https://devfeed.tech/sources/lea-verou-s-blog.md>)

Topics: [web graphics](<https://devfeed.tech/topics/web-graphics.md>), [polyfill](<https://devfeed.tech/topics/polyfill.md>), [browser](<https://devfeed.tech/topics/browser.md>), [SVG](<https://devfeed.tech/topics/svg.md>), [Google Chrome](<https://devfeed.tech/topics/google-chrome.md>)

Tags: [blog](<https://devfeed.tech/tags/blog.md>), [browsers](<https://devfeed.tech/tags/browsers.md>), [conic-gradient](<https://devfeed.tech/tags/conic-gradient.md>), [css](<https://devfeed.tech/tags/css.md>), [css-wg](<https://devfeed.tech/tags/css-wg.md>), [developers](<https://devfeed.tech/tags/developers.md>), [implementing](<https://devfeed.tech/tags/implementing.md>), [original](<https://devfeed.tech/tags/original.md>), [pie-charts](<https://devfeed.tech/tags/pie-charts.md>), [polyfill](<https://devfeed.tech/tags/polyfill.md>), [releases](<https://devfeed.tech/tags/releases.md>)

### AI overview

The author argues that conical gradients remained unimplemented partly because developers rarely requested them and because Cairo lacked support; Cairo's later mesh-gradient support removed that drawing limitation. A conical gradient can create a round pie chart with one background declaration, as in `conic-gradient(gold 40%, #f06 0)`. The author released a polyfill and urges developers to submit or vote on browser bug reports, concentrate requests where browser teams will see them, and explain practical use cases. The excerpt presents developer demand as influential, not as a guarantee of implementation.

### Source excerpt

It's no secret that I like conical gradients. In as early as 2011, I wrote a draft for conical-gradient() in CSS, that Tab later said helped him when he added them in CSS Image Values Level 4 in 2012. However, almost three years later, no progress has been made in implementing them. Sure, the spec is still relatively incomplete, but that's not the reason conical gradients have gotten no traction. Far more underspecified features have gotten experimental implementations in the past. The reason conical gradients are still unimplemented, is because very few developers know they exist, so browsers see no demand. Another reason was that Cairo, the graphics library used in Chrome and Firefox had no way of drawing a conical gradient. However, this changed a while ago, when they supported mesh gradients, of which conical gradients are a mere special case. Recently, I was giving a talk on creating pie charts with CSS on a few conferences, and yet again, I was reminded of how useful conical gradients can be. While every CSS or SVG solution is several lines of code with varying levels of hackiness, conical gradients can give us a pie chart with a straightforward, DRY, one liner. For example, this is how to create a pie chart that shows 40% in gold and 60% in #f06: padding: 5em; /* size */ background: conic-gradient(gold 40%, #f06 0); border-radius: 50%; /* make it round */ So, I decided to take matters in my own hands. I wrote a polyfill, which I also used in my talk to demonstrate how awesome conical gradients can be and what cool things they can do. Today, during my CSSConf talk, I released it publicly. In addition, I mention to developers how important speaking up is for getting their favorite features implemented. Browsers prioritize which features to implement based on what developers ask for. It's a pity that so few of us realize how much of a say we collectively have in this. This is more obvious with Microsoft and their Uservoice forum where developers can vote on whic