[HTML/CSS] pure css pie charts

using sass variables
master
Juan Massuelles 1 year ago
parent 15c79eed68
commit 5362b590d6

@ -1,33 +1,52 @@
$pie-size:300px;
$pie-bg:#3434AF;
$red:#ed3457;
$green:#248991;
$orange:#ed8724;
$line-color:#cecece;
$border-width:5px;
$segment-border-width:1px;
:root{ :root{
--pie-size:300; font-family: sans-serif;
--pie-bg:#3434AF;
--red:#ed3457;
--green:#248991;
--orange:#ed8724;
--line-color:#cecece;
} }
.pie,.target { .pie,.target {
border-radius: 100%; border-radius: 100%;
position: relative; position: relative;
} }
.pie { .pie {
height: calc( var(--pie-size,200) * 1px ); height: $pie-size;
width: calc( var(--pie-size,200) * 1px ); width: $pie-size;
background-color:var(--pie-bg,black); background-color:$pie-bg;
top:5px; top:$border-width;
left:5px; left:$border-width;
&-segment {
border: dotted $segment-border-width $line-color;
position: absolute;
height: 100%;
width:100%;
}
} }
.target { .target {
height: calc( (var(--pie-size,200) + 10) * 1px ); height: ($pie-size + $border-width * 2);
width: calc( (var(--pie-size,200) + 10) * 1px ); width: ($pie-size + $border-width * 2);
background-color:var(--line-color,grey); background-color:$line-color;
} }
.references { .references {
position:fixed; position:fixed;
bottom:0; bottom:5px;
left:0; right:5px;
right:0; border-radius:5px;
background-color:var(--line-color); padding:10px;
background-color:lightblue;
a {
&[href],&:link,&:hover,&:focus,&:active {
color:darkblue;
}
}
} }

@ -1,32 +1,35 @@
:root { :root {
--pie-size:300; font-family: sans-serif; }
--pie-bg:#3434AF;
--red:#ed3457;
--green:#248991;
--orange:#ed8724;
--line-color:#cecece; }
.pie, .target { .pie, .target {
border-radius: 100%; border-radius: 100%;
position: relative; } position: relative; }
.pie { .pie {
height: calc( var(--pie-size,200) * 1px ); height: 300px;
width: calc( var(--pie-size,200) * 1px ); width: 300px;
background-color: var(--pie-bg, black); background-color: #3434AF;
top: 5px; top: 5px;
left: 5px; } left: 5px; }
.pie-segment {
border: dotted 1px #cecece;
position: absolute;
height: 100%;
width: 100%; }
.target { .target {
height: calc( (var(--pie-size,200) + 10) * 1px ); height: 310px;
width: calc( (var(--pie-size,200) + 10) * 1px ); width: 310px;
background-color: var(--line-color, grey); } background-color: #cecece; }
.references { .references {
position: fixed; position: fixed;
bottom: 0; bottom: 5px;
left: 0; right: 5px;
right: 0; border-radius: 5px;
background-color: var(--line-color); } padding: 10px;
background-color: lightblue; }
.references a[href], .references a:link, .references a:hover, .references a:focus, .references a:active {
color: darkblue; }
/*# sourceMappingURL=pie-charts.css.map */ /*# sourceMappingURL=pie-charts.css.map */

@ -1,7 +1,7 @@
{ {
"version": 3, "version": 3,
"mappings": "AAAA,KAAK;EACH,UAAU,CAAC,GAAG;EACd,QAAQ,CAAC,OAAO;EAChB,KAAK,CAAC,OAAO;EACb,OAAO,CAAC,OAAO;EACf,QAAQ,CAAC,OAAO;EAChB,YAAY,CAAC,OAAO;;AAGtB,aAAa;EACX,aAAa,EAAE,IAAI;EACnB,QAAQ,EAAE,QAAQ;;AAEpB,IAAK;EACH,MAAM,EAAE,iCAAiC;EACzC,KAAK,EAAG,iCAAiC;EACzC,gBAAgB,EAAC,oBAAmB;EACpC,GAAG,EAAC,GAAG;EACP,IAAI,EAAC,GAAG;;AAEV,OAAQ;EACN,MAAM,EAAE,wCAAwC;EAChD,KAAK,EAAG,wCAAwC;EAChD,gBAAgB,EAAC,uBAAsB;;AAGzC,WAAY;EACV,QAAQ,EAAC,KAAK;EACd,MAAM,EAAC,CAAC;EACR,IAAI,EAAC,CAAC;EACN,KAAK,EAAC,CAAC;EACP,gBAAgB,EAAC,iBAAiB", "mappings": "AASA,KAAK;EACH,WAAW,EAAE,UAAU;;AAGzB,aAAa;EACX,aAAa,EAAE,IAAI;EACnB,QAAQ,EAAE,QAAQ;;AAGpB,IAAK;EACH,MAAM,EAnBE,KAAK;EAoBb,KAAK,EApBG,KAAK;EAqBb,gBAAgB,EApBV,OAAO;EAqBb,GAAG,EAhBS,GAAG;EAiBf,IAAI,EAjBQ,GAAG;EAkBf,YAAU;IACR,MAAM,EAAE,kBAAwC;IAChD,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,IAAI;IACZ,KAAK,EAAC,IAAI;;AAId,OAAQ;EACN,MAAM,EAAE,KAA+B;EACvC,KAAK,EAAG,KAA+B;EACvC,gBAAgB,EA9BN,OAAO;;AAiCnB,WAAY;EACV,QAAQ,EAAC,KAAK;EACd,MAAM,EAAC,GAAG;EACV,KAAK,EAAC,GAAG;EACT,aAAa,EAAC,GAAG;EACjB,OAAO,EAAC,IAAI;EACZ,gBAAgB,EAAC,SAAS;EAExB,uGAAwC;IACtC,KAAK,EAAC,QAAQ",
"sources": ["_pie-charts.scss"], "sources": ["_pie-charts.scss"],
"names": [], "names": [],
"file": "pie-charts.css" "file": "pie-charts.css"
} }
Loading…
Cancel
Save