-
Notifications
You must be signed in to change notification settings - Fork 1
/
_c-chart.scss
102 lines (84 loc) · 1.83 KB
/
_c-chart.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
:root {
--value-abstentions: 0;
--value-opponents: 0;
--value-proponents: 0;
}
.c-chart {
display: flex;
gap: $au-unit;
margin-top: $au-unit;
align-items: center;
flex-direction: column;
@include mq(small) {
flex-direction: row;
}
}
.c-chart__pie {
margin: 0 auto;
transform: rotate(-90deg);
border-radius: 50%;
display: block;
height: auto;
flex-shrink: 0;
width: 200px;
circle {
width: 100%;
height: 100%;
}
}
.c-chart__legend {
@include au-font-size(var(--au-h6));
color: var(--au-gray-700);
flex-shrink: 0;
width: 200px;
@include mq(small) {
width: calc(100% - 200px);
}
}
.c-chart__legend-item {
list-style-type: none;
display: flex;
align-items: center;
}
.c-chart__legend-item::before {
content: "";
display: block;
width: $au-unit-small;
height: $au-unit-small;
background-color: var(--au-gray-500);
border-radius: 0.3rem;
margin-bottom: 0.1rem;
margin-right: $au-unit-small;
}
.c-chart__legend-item--proponents::before {
background-color: var(--au-green-500);
}
.c-chart__legend-item--opponents::before {
background-color: var(--au-red-600);
}
.c-chart__legend-item--abstentions::before {
background-color: var(--au-gray-400);
}
.c-pie {
fill: transparent;
stroke-width: 50;
stroke-dasharray: 0 158;
transform: rotate(var(--offset));
transform-origin: center center;
}
.c-pie--proponents {
stroke: var(--au-green-500);
stroke-dasharray: var(--value-proponents) 158;
}
.c-pie--opponents {
--offset: calc(((var(--value-proponents) / 158) * 360) * 1deg);
stroke: var(--au-red-600);
stroke-dasharray: var(--value-opponents) 158;
}
.c-pie--abstentions {
--offset: calc(
(((var(--value-proponents) + var(--value-opponents)) / 158) * 360) * 1deg
);
stroke: var(--au-gray-400);
stroke-dasharray: var(--value-abstentions) 158;
}