@cdc/chart 1.3.3 → 4.22.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdcchart.js +6 -6
- package/examples/cutoff-example-config.json +2 -0
- package/examples/cutoff-example-data.json +1 -1
- package/examples/dynamic-legends.json +125 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart-with-numbers-on-bar.json +198 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-bar-chart.json +241 -0
- package/examples/gallery/bar-chart-horizontal/horizontal-stacked.json +248 -0
- package/examples/gallery/bar-chart-vertical/combo-line-chart.json +137 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-categorical.json +80 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-stacked.json +81 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart-with-confidence.json +68 -0
- package/examples/gallery/bar-chart-vertical/vertical-bar-chart.json +111 -0
- package/examples/gallery/lollipop/lollipop-style-horizontal.json +220 -0
- package/examples/gallery/paired-bar/paired-bar-chart.json +196 -0
- package/examples/horizontal-chart.json +3 -0
- package/examples/paired-bar-data.json +1 -1
- package/examples/paired-bar-example.json +2 -0
- package/examples/planet-combo-example-config.json +2 -0
- package/examples/planet-example-config.json +2 -2
- package/examples/planet-example-data.json +1 -1
- package/examples/planet-pie-example-config.json +2 -0
- package/examples/private/line-test-data.json +22 -0
- package/examples/private/line-test-two.json +216 -0
- package/examples/private/line-test.json +102 -0
- package/examples/private/shawn.json +1296 -0
- package/examples/private/yaxis-test.json +132 -0
- package/examples/private/yaxis-testing.csv +27 -0
- package/examples/private/yaxis.json +28 -0
- package/examples/stacked-vertical-bar-example.json +228 -0
- package/package.json +3 -3
- package/src/CdcChart.tsx +121 -168
- package/src/components/BarChart.tsx +92 -40
- package/src/components/DataTable.tsx +28 -13
- package/src/components/EditorPanel.js +286 -182
- package/src/components/Legend.js +334 -0
- package/src/components/LineChart.tsx +57 -17
- package/src/components/LinearChart.tsx +171 -77
- package/src/components/PairedBarChart.tsx +139 -42
- package/src/components/PieChart.tsx +33 -6
- package/src/components/SparkLine.js +28 -27
- package/src/components/useIntersectionObserver.tsx +30 -0
- package/src/data/initial-state.js +23 -7
- package/src/hooks/useChartClasses.js +35 -0
- package/src/hooks/useLegendClasses.js +20 -0
- package/src/hooks/useReduceData.ts +72 -24
- package/src/index.html +29 -30
- package/src/scss/editor-panel.scss +34 -4
- package/src/scss/main.scss +201 -5
- package/src/components/BarStackVertical.js +0 -0
package/src/scss/main.scss
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@import '~@cdc/core/styles/v2/themes/color-definitions';
|
|
6
6
|
|
|
7
7
|
.form-container {
|
|
8
|
-
overflow:
|
|
8
|
+
overflow-y: auto;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.d-flex { display: flex; }
|
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
|
|
20
20
|
border-radius: 3px;
|
|
21
21
|
|
|
22
|
+
.checkbox-group {
|
|
23
|
+
padding: 16px;
|
|
24
|
+
border: 1px solid #c4c4c4;
|
|
25
|
+
border-radius: 8px;
|
|
26
|
+
margin-top: 8px;
|
|
27
|
+
margin-bottom: 24px;
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
.visually-hidden {
|
|
23
31
|
position: fixed;
|
|
24
32
|
left: -10000px;
|
|
@@ -96,6 +104,10 @@
|
|
|
96
104
|
margin-bottom: 20px;
|
|
97
105
|
}
|
|
98
106
|
|
|
107
|
+
.section-subtext {
|
|
108
|
+
padding: 15px;
|
|
109
|
+
}
|
|
110
|
+
|
|
99
111
|
.legend-container {
|
|
100
112
|
background: #fff;
|
|
101
113
|
width: 100%;
|
|
@@ -118,6 +130,13 @@
|
|
|
118
130
|
top: 1em;
|
|
119
131
|
border-radius: 3px;
|
|
120
132
|
|
|
133
|
+
|
|
134
|
+
&--dynamic {
|
|
135
|
+
position: relative;
|
|
136
|
+
float: right;
|
|
137
|
+
right: unset;
|
|
138
|
+
}
|
|
139
|
+
|
|
121
140
|
&:hover {
|
|
122
141
|
background: rgba(0, 0, 0, .15);
|
|
123
142
|
transition: .3s all;
|
|
@@ -152,6 +171,29 @@
|
|
|
152
171
|
}
|
|
153
172
|
}
|
|
154
173
|
|
|
174
|
+
.dynamic-legend-list {
|
|
175
|
+
|
|
176
|
+
// overide traditional legend item that uses !important
|
|
177
|
+
.legend-item {
|
|
178
|
+
align-items: flex-end !important;
|
|
179
|
+
justify-content: space-between;
|
|
180
|
+
|
|
181
|
+
.btn-wrapper {
|
|
182
|
+
background: transparent;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.visx-legend-label {
|
|
187
|
+
width: auto !important;
|
|
188
|
+
display: inline-block !important;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
button {
|
|
192
|
+
width: auto;
|
|
193
|
+
display: inline-block;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
155
197
|
.tooltip {
|
|
156
198
|
background-color: #fff;
|
|
157
199
|
border: rgba(0, 0, 0, 0.3) 1px solid !important;
|
|
@@ -205,6 +247,32 @@
|
|
|
205
247
|
> svg circle {
|
|
206
248
|
opacity: 1;
|
|
207
249
|
}
|
|
250
|
+
|
|
251
|
+
// Animations for line chart and data points
|
|
252
|
+
> svg.animated {
|
|
253
|
+
circle {
|
|
254
|
+
opacity: 0;
|
|
255
|
+
animation: revealLolly 0.25s linear forwards;
|
|
256
|
+
animation-delay: 0.75s;
|
|
257
|
+
animation-play-state: paused;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
&.animate {
|
|
261
|
+
circle {
|
|
262
|
+
animation-play-state: running;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
@keyframes revealLolly {
|
|
269
|
+
from {
|
|
270
|
+
opacity: 0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
to {
|
|
274
|
+
opacity: 1;
|
|
275
|
+
}
|
|
208
276
|
}
|
|
209
277
|
|
|
210
278
|
&.chart-bar--no-border {
|
|
@@ -215,7 +283,10 @@
|
|
|
215
283
|
}
|
|
216
284
|
|
|
217
285
|
.filters-section {
|
|
218
|
-
|
|
286
|
+
@include breakpoint(md) {
|
|
287
|
+
display: flex;
|
|
288
|
+
gap: 30px;
|
|
289
|
+
}
|
|
219
290
|
|
|
220
291
|
label:not(:empty) {
|
|
221
292
|
margin-right: .4em;
|
|
@@ -225,8 +296,8 @@
|
|
|
225
296
|
font-size: 1em;
|
|
226
297
|
}
|
|
227
298
|
|
|
228
|
-
.single-filter
|
|
229
|
-
margin-
|
|
299
|
+
.single-filter {
|
|
300
|
+
margin-bottom: .5em;
|
|
230
301
|
}
|
|
231
302
|
}
|
|
232
303
|
|
|
@@ -331,9 +402,135 @@
|
|
|
331
402
|
}
|
|
332
403
|
}
|
|
333
404
|
}
|
|
405
|
+
|
|
334
406
|
[tabindex]:focus-visible {
|
|
335
407
|
outline: 2px solid rgb(0, 95, 204) !important;
|
|
336
408
|
}
|
|
409
|
+
|
|
410
|
+
// ANIMATIONS
|
|
411
|
+
// Pie Chart Animations
|
|
412
|
+
.animated-pie {
|
|
413
|
+
transition: all .4s ease-in-out;
|
|
414
|
+
opacity: 0;
|
|
415
|
+
transform-origin: center;
|
|
416
|
+
transform: scale(0, 0);
|
|
417
|
+
|
|
418
|
+
&.animated {
|
|
419
|
+
opacity: 1;
|
|
420
|
+
transform-origin: center;
|
|
421
|
+
transform: scale(1, 1);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
path,
|
|
425
|
+
text {
|
|
426
|
+
border: rgba(0,0,0,.3) 1px solid !important;
|
|
427
|
+
box-shadow: rgba(0,0,0,.1) 3px 3px 7px;
|
|
428
|
+
opacity: 1;
|
|
429
|
+
line-height: 1.4em;
|
|
430
|
+
font-size: 1em;
|
|
431
|
+
border-radius: 4px;
|
|
432
|
+
padding: 8px 12px;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.animated-pie-text {
|
|
436
|
+
opacity: 0;
|
|
437
|
+
transition: opacity .5s ease-in-out;
|
|
438
|
+
transition-delay: .4s;
|
|
439
|
+
|
|
440
|
+
&.animated {
|
|
441
|
+
opacity: 1;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Line/Combo Chart Animations
|
|
447
|
+
.linear,
|
|
448
|
+
.Line,
|
|
449
|
+
.Combo {
|
|
450
|
+
&.animated path {
|
|
451
|
+
opacity: 0;
|
|
452
|
+
}
|
|
453
|
+
&.animate {
|
|
454
|
+
path {
|
|
455
|
+
opacity: 1;
|
|
456
|
+
stroke-dasharray: 2000;
|
|
457
|
+
stroke-dashoffset: 2000;
|
|
458
|
+
animation: dash 2s ease-in-out forwards;
|
|
459
|
+
}
|
|
460
|
+
@keyframes dash {
|
|
461
|
+
to {
|
|
462
|
+
stroke-dashoffset: 0;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Bar/Combo Chart Animations
|
|
469
|
+
.linear,
|
|
470
|
+
.Bar,
|
|
471
|
+
.Combo {
|
|
472
|
+
.visx-group {
|
|
473
|
+
position: relative;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
&.animated {
|
|
477
|
+
.vertical rect ,
|
|
478
|
+
.vertical foreignObject {
|
|
479
|
+
opacity: 0;
|
|
480
|
+
animation: growBar 0.5s linear forwards;
|
|
481
|
+
animation-play-state: paused;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.horizontal rect,
|
|
485
|
+
.horizontal foreignObject {
|
|
486
|
+
animation: growBarH 0.5s linear forwards;
|
|
487
|
+
animation-play-state: paused;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
&.animate {
|
|
491
|
+
rect,
|
|
492
|
+
foreignObject {
|
|
493
|
+
animation-play-state: running;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.group-1,
|
|
498
|
+
.group-2 {
|
|
499
|
+
transform-origin: center;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
@keyframes growBar {
|
|
506
|
+
from {
|
|
507
|
+
opacity: 1;
|
|
508
|
+
transform: scale(1, 0) ;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
to {
|
|
512
|
+
opacity: 1;
|
|
513
|
+
transform: scale(1) ;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
@keyframes growBarH {
|
|
518
|
+
from {
|
|
519
|
+
transform: scale(0, 1) ;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
to {
|
|
523
|
+
transform: scale(1) ;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.cdc-visualization__paired-bar-chart {
|
|
529
|
+
text-align: center;
|
|
530
|
+
transform: scale(1);
|
|
531
|
+
> .visx-group[style] {
|
|
532
|
+
transform: scale(1);
|
|
533
|
+
}
|
|
337
534
|
}
|
|
338
535
|
|
|
339
536
|
#paired-bar-legend {
|
|
@@ -353,7 +550,6 @@
|
|
|
353
550
|
}
|
|
354
551
|
}
|
|
355
552
|
|
|
356
|
-
|
|
357
553
|
.isEditor.type-sparkline .cdc-chart-inner-container {
|
|
358
554
|
margin: 3em auto 0;
|
|
359
555
|
max-width: 60%;
|
|
File without changes
|