@cdc/waffle-chart 1.0.2 → 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/LICENSE +201 -0
- package/dist/cdcwafflechart.js +2 -2
- package/examples/gallery/avg-to-max.json +3162 -0
- package/examples/gallery/count.json +3162 -0
- package/package.json +3 -3
- package/src/CdcWaffleChart.tsx +67 -54
- package/src/components/EditorPanel.js +290 -111
- package/src/data/initial-state.js +1 -1
- package/src/index.html +21 -0
- package/src/scss/waffle-chart.scss +36 -25
|
@@ -72,14 +72,9 @@ const EditorPanel = memo((props) => {
|
|
|
72
72
|
|
|
73
73
|
useEffect(() => {
|
|
74
74
|
|
|
75
|
-
console.log('updating parent')
|
|
76
|
-
console.log(setParentConfig)
|
|
77
75
|
// Pass up to Editor if needed
|
|
78
76
|
if (setParentConfig) {
|
|
79
77
|
const newConfig = convertStateToConfig()
|
|
80
|
-
|
|
81
|
-
console.log('newConfig', newConfig)
|
|
82
|
-
|
|
83
78
|
setParentConfig(newConfig)
|
|
84
79
|
}
|
|
85
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -198,218 +193,402 @@ const EditorPanel = memo((props) => {
|
|
|
198
193
|
}
|
|
199
194
|
|
|
200
195
|
const editorContent = (
|
|
201
|
-
|
|
202
196
|
<Accordion>
|
|
203
197
|
<Accordion.Section title="General">
|
|
204
|
-
<InputText
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
198
|
+
<InputText
|
|
199
|
+
value={config.title}
|
|
200
|
+
fieldName="title"
|
|
201
|
+
label="Title"
|
|
202
|
+
placeholder="Waffle Chart Title"
|
|
203
|
+
updateField={updateField}
|
|
204
|
+
/>
|
|
205
|
+
|
|
206
|
+
<InputText
|
|
207
|
+
type="textarea"
|
|
208
|
+
value={config.content}
|
|
209
|
+
fieldName="content"
|
|
210
|
+
label="Message"
|
|
211
|
+
updateField={updateField}
|
|
212
|
+
tooltip={
|
|
213
|
+
<Tooltip style={{ textTransform: "none" }}>
|
|
214
|
+
<Tooltip.Target>
|
|
215
|
+
<Icon display="question" style={{ marginLeft: "0.5rem" }} />
|
|
216
|
+
</Tooltip.Target>
|
|
217
|
+
<Tooltip.Content>
|
|
218
|
+
<p>
|
|
219
|
+
Enter the message text for the visualization. The following
|
|
220
|
+
HTML tags are supported: strong, em, sup, and sub.
|
|
221
|
+
</p>
|
|
222
|
+
</Tooltip.Content>
|
|
223
|
+
</Tooltip>
|
|
224
|
+
}
|
|
225
|
+
/>
|
|
226
|
+
|
|
227
|
+
<InputText
|
|
228
|
+
value={config.subtext}
|
|
229
|
+
fieldName="subtext"
|
|
230
|
+
label="Subtext/Citation"
|
|
231
|
+
placeholder="Waffle Chart Subtext or Citation"
|
|
232
|
+
updateField={updateField}
|
|
233
|
+
tooltip={
|
|
234
|
+
<Tooltip style={{ textTransform: "none" }}>
|
|
235
|
+
<Tooltip.Target>
|
|
236
|
+
<Icon display="question" style={{ marginLeft: "0.5rem" }} />
|
|
237
|
+
</Tooltip.Target>
|
|
238
|
+
<Tooltip.Content>
|
|
239
|
+
<p>
|
|
240
|
+
Enter supporting text to display below the data visualization,
|
|
241
|
+
if applicable. The following HTML tags are supported: strong,
|
|
242
|
+
em, sup, and sub.
|
|
243
|
+
</p>
|
|
244
|
+
</Tooltip.Content>
|
|
245
|
+
</Tooltip>
|
|
246
|
+
}
|
|
247
|
+
/>
|
|
223
248
|
</Accordion.Section>
|
|
224
249
|
<Accordion.Section title="Data">
|
|
225
|
-
<h4 style={{ fontWeight:
|
|
250
|
+
<h4 style={{ fontWeight: "600" }}>Numerator</h4>
|
|
226
251
|
<div className="cove-accordion__panel-section">
|
|
227
252
|
<div className="cove-input-group">
|
|
228
|
-
<InputSelect
|
|
229
|
-
|
|
253
|
+
<InputSelect
|
|
254
|
+
value={config.dataColumn || ""}
|
|
255
|
+
fieldName="dataColumn"
|
|
256
|
+
label="Data Column"
|
|
257
|
+
updateField={updateField}
|
|
258
|
+
initial="Select"
|
|
259
|
+
options={getColumns()}
|
|
260
|
+
className="cove-input"
|
|
261
|
+
/>
|
|
230
262
|
</div>
|
|
231
263
|
|
|
232
264
|
<div className="cove-input-group">
|
|
233
|
-
<InputSelect
|
|
234
|
-
|
|
265
|
+
<InputSelect
|
|
266
|
+
value={config.dataFunction || ""}
|
|
267
|
+
fieldName="dataFunction"
|
|
268
|
+
label="Data Function"
|
|
269
|
+
updateField={updateField}
|
|
270
|
+
initial="Select"
|
|
271
|
+
options={DATA_FUNCTIONS}
|
|
272
|
+
className="cove-input"
|
|
273
|
+
/>
|
|
235
274
|
</div>
|
|
236
275
|
|
|
237
276
|
<div className="cove-input-group">
|
|
238
|
-
<label
|
|
277
|
+
<label>
|
|
278
|
+
<span className="edit-label cove-input__label">Data Conditional</span>
|
|
279
|
+
</label>
|
|
239
280
|
<div className="cove-accordion__panel-row cove-accordion__small-inputs">
|
|
240
281
|
<div className="cove-accordion__panel-col">
|
|
241
|
-
<InputSelect
|
|
242
|
-
|
|
282
|
+
<InputSelect
|
|
283
|
+
value={config.dataConditionalColumn || ""}
|
|
284
|
+
fieldName="dataConditionalColumn"
|
|
285
|
+
updateField={updateField}
|
|
286
|
+
initial="Select"
|
|
287
|
+
options={getColumns()}
|
|
288
|
+
className="cove-input"
|
|
289
|
+
/>
|
|
243
290
|
</div>
|
|
244
291
|
<div className="cove-accordion__panel-col">
|
|
245
|
-
<InputSelect
|
|
246
|
-
|
|
292
|
+
<InputSelect
|
|
293
|
+
value={config.dataConditionalOperator || ""}
|
|
294
|
+
fieldName="dataConditionalOperator"
|
|
295
|
+
updateField={updateField}
|
|
296
|
+
initial="Select"
|
|
297
|
+
options={DATA_OPERATORS}
|
|
298
|
+
className="cove-input"
|
|
299
|
+
/>
|
|
247
300
|
</div>
|
|
248
301
|
<div className="cove-accordion__panel-col">
|
|
249
|
-
<InputText
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
302
|
+
<InputText
|
|
303
|
+
value={config.dataConditionalComparate}
|
|
304
|
+
fieldName={"dataConditionalComparate"}
|
|
305
|
+
updateField={updateField}
|
|
306
|
+
className={
|
|
307
|
+
config.invalidComparate ? "cove-accordion__input-error" : ""
|
|
308
|
+
}
|
|
309
|
+
style={{ minHeight: "2rem" }}
|
|
253
310
|
/>
|
|
254
311
|
</div>
|
|
255
312
|
</div>
|
|
256
313
|
</div>
|
|
257
314
|
|
|
258
|
-
{config.invalidComparate &&
|
|
315
|
+
{config.invalidComparate && (
|
|
259
316
|
<div className="cove-accordion__panel-error">
|
|
260
317
|
Non-numerical comparate values can only be used with = or ≠.
|
|
261
318
|
</div>
|
|
262
|
-
}
|
|
319
|
+
)}
|
|
263
320
|
</div>
|
|
264
321
|
<div className="cove-accordion__panel-row align-center">
|
|
265
322
|
<div className="cove-accordion__panel-col">
|
|
266
|
-
<h4 style={{ fontWeight:
|
|
323
|
+
<h4 style={{ fontWeight: "600" }}>Denominator</h4>
|
|
267
324
|
</div>
|
|
268
325
|
<div className="cove-accordion__panel-col">
|
|
269
|
-
<div style={{display:
|
|
270
|
-
<label className="cove-accordion__panel-label--inline">
|
|
271
|
-
|
|
326
|
+
<div style={{ display: "flex", justifyContent: "flex-end" }}>
|
|
327
|
+
<label className="cove-accordion__panel-label--inline">
|
|
328
|
+
Select from data
|
|
329
|
+
</label>
|
|
330
|
+
<InputCheckbox
|
|
331
|
+
size="small"
|
|
332
|
+
value={config.customDenom}
|
|
333
|
+
fieldName="customDenom"
|
|
334
|
+
updateField={updateField}
|
|
335
|
+
/>
|
|
272
336
|
</div>
|
|
273
337
|
</div>
|
|
274
338
|
</div>
|
|
275
339
|
<div className="cove-accordion__panel-section">
|
|
276
|
-
{!config.customDenom &&
|
|
340
|
+
{!config.customDenom && (
|
|
277
341
|
<div className="cove-accordion__panel-row align-center">
|
|
278
342
|
<div className="cove-accordion__panel-col">
|
|
279
|
-
<InputText
|
|
343
|
+
<InputText
|
|
344
|
+
value={config.dataDenom}
|
|
345
|
+
fieldName="dataDenom"
|
|
346
|
+
updateField={updateField}
|
|
347
|
+
/>
|
|
280
348
|
</div>
|
|
281
|
-
<div
|
|
282
|
-
|
|
349
|
+
<div
|
|
350
|
+
className="cove-accordion__panel-col"
|
|
351
|
+
style={{ display: "flex", alignItems: "center" }}
|
|
352
|
+
>
|
|
353
|
+
<label className="cove-accordion__panel-label--muted">
|
|
354
|
+
default (100)
|
|
355
|
+
</label>
|
|
283
356
|
</div>
|
|
284
357
|
</div>
|
|
285
|
-
}
|
|
286
|
-
{config.customDenom &&
|
|
358
|
+
)}
|
|
359
|
+
{config.customDenom && (
|
|
287
360
|
<>
|
|
288
|
-
<InputSelect
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
361
|
+
<InputSelect
|
|
362
|
+
value={config.dataDenomColumn || ""}
|
|
363
|
+
fieldName="dataDenomColumn"
|
|
364
|
+
label="Data Column"
|
|
365
|
+
updateField={updateField}
|
|
366
|
+
initial="Select"
|
|
367
|
+
options={getColumns()}
|
|
368
|
+
/>
|
|
369
|
+
<InputSelect
|
|
370
|
+
value={config.dataDenomFunction || ""}
|
|
371
|
+
fieldName="dataDenomFunction"
|
|
372
|
+
label="Data Function"
|
|
373
|
+
updateField={updateField}
|
|
374
|
+
initial="Select"
|
|
375
|
+
options={DATA_FUNCTIONS}
|
|
376
|
+
/>
|
|
292
377
|
</>
|
|
293
|
-
}
|
|
378
|
+
)}
|
|
294
379
|
</div>
|
|
295
380
|
<ul className="column-edit">
|
|
296
381
|
<li className="three-col">
|
|
297
|
-
<div style={{marginRight:
|
|
298
|
-
<InputText
|
|
382
|
+
<div style={{ marginRight: "1rem" }}>
|
|
383
|
+
<InputText
|
|
384
|
+
value={config.prefix}
|
|
385
|
+
fieldName="prefix"
|
|
386
|
+
label="Prefix"
|
|
387
|
+
updateField={updateField}
|
|
388
|
+
/>
|
|
299
389
|
</div>
|
|
300
|
-
<div style={{marginRight:
|
|
301
|
-
<InputText
|
|
390
|
+
<div style={{ marginRight: "1rem" }}>
|
|
391
|
+
<InputText
|
|
392
|
+
value={config.suffix}
|
|
393
|
+
fieldName="suffix"
|
|
394
|
+
label="Suffix"
|
|
395
|
+
updateField={updateField}
|
|
396
|
+
/>
|
|
302
397
|
</div>
|
|
303
398
|
<div>
|
|
304
|
-
<InputText
|
|
399
|
+
<InputText
|
|
400
|
+
type="number"
|
|
401
|
+
value={config.roundToPlace}
|
|
402
|
+
fieldName="roundToPlace"
|
|
403
|
+
label="Round"
|
|
404
|
+
updateField={updateField}
|
|
405
|
+
/>
|
|
305
406
|
</div>
|
|
306
407
|
</li>
|
|
307
408
|
</ul>
|
|
308
409
|
|
|
309
410
|
<hr className="cove-accordion__divider" />
|
|
310
411
|
|
|
311
|
-
<label style={{marginBottom:
|
|
412
|
+
<label style={{ marginBottom: "1rem" }}>
|
|
312
413
|
<span className="edit-label">Data Point Filters</span>
|
|
313
|
-
<Tooltip style={{ textTransform:
|
|
314
|
-
<Tooltip.Target
|
|
414
|
+
<Tooltip style={{ textTransform: "none" }}>
|
|
415
|
+
<Tooltip.Target>
|
|
416
|
+
<Icon display="question" style={{ marginLeft: "0.5rem" }} />
|
|
417
|
+
</Tooltip.Target>
|
|
315
418
|
<Tooltip.Content>
|
|
316
|
-
<p>
|
|
317
|
-
|
|
419
|
+
<p>
|
|
420
|
+
To refine the highlighted data point, specify one or more
|
|
421
|
+
filters (e.g., "Male" and "Female" for a column called "Sex").
|
|
422
|
+
</p>
|
|
318
423
|
</Tooltip.Content>
|
|
319
424
|
</Tooltip>
|
|
320
425
|
</label>
|
|
321
|
-
{config.filters &&
|
|
322
|
-
<ul
|
|
426
|
+
{config.filters && (
|
|
427
|
+
<ul
|
|
428
|
+
className="filters-list"
|
|
429
|
+
style={{ paddingLeft: 0, marginBottom: "1rem" }}
|
|
430
|
+
>
|
|
323
431
|
{config.filters.map((filter, index) => (
|
|
324
432
|
<fieldset className="edit-block" key={index}>
|
|
325
|
-
<button
|
|
326
|
-
|
|
327
|
-
|
|
433
|
+
<button
|
|
434
|
+
type="button"
|
|
435
|
+
className="remove-column"
|
|
436
|
+
onClick={() => {
|
|
437
|
+
removeFilter(index);
|
|
438
|
+
}}
|
|
439
|
+
>
|
|
440
|
+
Remove
|
|
328
441
|
</button>
|
|
329
442
|
<label>
|
|
330
443
|
<span className="edit-label column-heading">Column</span>
|
|
331
|
-
<select
|
|
332
|
-
|
|
333
|
-
|
|
444
|
+
<select
|
|
445
|
+
value={filter.columnName}
|
|
446
|
+
onChange={(e) => {
|
|
447
|
+
updateFilterProp("columnName", index, e.target.value);
|
|
448
|
+
}}
|
|
449
|
+
>
|
|
334
450
|
<option value="">- Select Option -</option>
|
|
335
451
|
{getColumns().map((dataKey, index) => (
|
|
336
|
-
<option value={dataKey} key={index}>
|
|
452
|
+
<option value={dataKey} key={index}>
|
|
453
|
+
{dataKey}
|
|
454
|
+
</option>
|
|
337
455
|
))}
|
|
338
456
|
</select>
|
|
339
457
|
</label>
|
|
340
458
|
<label>
|
|
341
|
-
<span className="edit-label column-heading">
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
459
|
+
<span className="edit-label column-heading">
|
|
460
|
+
Column Value
|
|
461
|
+
</span>
|
|
462
|
+
<select
|
|
463
|
+
value={filter.columnValue}
|
|
464
|
+
onChange={(e) => {
|
|
465
|
+
updateFilterProp("columnValue", index, e.target.value);
|
|
466
|
+
}}
|
|
467
|
+
>
|
|
345
468
|
<option value="">- Select Option -</option>
|
|
346
469
|
{getFilterColumnValues(index).map((dataKey, index) => (
|
|
347
|
-
<option value={dataKey} key={index}>
|
|
470
|
+
<option value={dataKey} key={index}>
|
|
471
|
+
{dataKey}
|
|
472
|
+
</option>
|
|
348
473
|
))}
|
|
349
474
|
</select>
|
|
350
475
|
</label>
|
|
351
476
|
</fieldset>
|
|
352
477
|
))}
|
|
353
478
|
</ul>
|
|
354
|
-
}
|
|
355
|
-
<Button onClick={addNewFilter} fluid>
|
|
479
|
+
)}
|
|
480
|
+
<Button onClick={addNewFilter} fluid>
|
|
481
|
+
Add Filter
|
|
482
|
+
</Button>
|
|
356
483
|
</Accordion.Section>
|
|
357
484
|
<Accordion.Section title="Visual">
|
|
358
|
-
<InputSelect
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
485
|
+
<InputSelect
|
|
486
|
+
value={config.shape}
|
|
487
|
+
fieldName="shape"
|
|
488
|
+
label="Shape"
|
|
489
|
+
updateField={updateField}
|
|
490
|
+
options={["circle", "square", "person"]}
|
|
491
|
+
className="cove-input"
|
|
492
|
+
/>
|
|
493
|
+
|
|
494
|
+
<div
|
|
495
|
+
className="cove-accordion__panel-row cove-accordion__small-inputs"
|
|
496
|
+
style={{ marginTop: "1rem", marginBottom: "1rem" }}
|
|
497
|
+
>
|
|
362
498
|
<div className="cove-accordion__panel-col">
|
|
363
|
-
<InputText
|
|
499
|
+
<InputText
|
|
500
|
+
type="number"
|
|
501
|
+
value={config.nodeWidth}
|
|
502
|
+
fieldName="nodeWidth"
|
|
503
|
+
label="Width"
|
|
504
|
+
updateField={updateField}
|
|
505
|
+
/>
|
|
364
506
|
</div>
|
|
365
507
|
<div className="cove-accordion__panel-col">
|
|
366
|
-
<InputText
|
|
508
|
+
<InputText
|
|
509
|
+
type="number"
|
|
510
|
+
value={config.nodeSpacer}
|
|
511
|
+
fieldName="nodeSpacer"
|
|
512
|
+
label="Spacer"
|
|
513
|
+
updateField={updateField}
|
|
514
|
+
/>
|
|
367
515
|
</div>
|
|
368
516
|
</div>
|
|
369
517
|
|
|
370
518
|
<div className="cove-input-group">
|
|
371
|
-
<InputSelect
|
|
372
|
-
|
|
519
|
+
<InputSelect
|
|
520
|
+
value={config.orientation}
|
|
521
|
+
fieldName="orientation"
|
|
522
|
+
label="Layout"
|
|
523
|
+
updateField={updateField}
|
|
524
|
+
className="cove-input"
|
|
525
|
+
options={["horizontal", "vertical"]}
|
|
526
|
+
/>
|
|
373
527
|
</div>
|
|
374
528
|
|
|
375
529
|
<div className="cove-input-group">
|
|
376
|
-
<label
|
|
530
|
+
<label>
|
|
531
|
+
<span className="edit-label column-heading cove-input__label">
|
|
532
|
+
Data Point Font Size
|
|
533
|
+
</span>
|
|
534
|
+
</label>
|
|
377
535
|
<div className="cove-accordion__panel-row cove-accordion__small-inputs align-center">
|
|
378
536
|
<div className="cove-accordion__panel-col">
|
|
379
|
-
<InputText
|
|
537
|
+
<InputText
|
|
538
|
+
type="number"
|
|
539
|
+
value={config.fontSize}
|
|
540
|
+
fieldName="fontSize"
|
|
541
|
+
updateField={updateField}
|
|
542
|
+
/>
|
|
380
543
|
</div>
|
|
381
|
-
<div
|
|
382
|
-
|
|
544
|
+
<div
|
|
545
|
+
className="cove-accordion__panel-col"
|
|
546
|
+
style={{ display: "flex", alignItems: "center" }}
|
|
547
|
+
>
|
|
548
|
+
<label className="accordion__panel-label--muted">
|
|
549
|
+
default (50px)
|
|
550
|
+
</label>
|
|
383
551
|
</div>
|
|
384
552
|
</div>
|
|
385
553
|
</div>
|
|
386
554
|
|
|
387
|
-
<InputSelect
|
|
388
|
-
|
|
555
|
+
<InputSelect
|
|
556
|
+
value={config.overallFontSize}
|
|
557
|
+
fieldName="overallFontSize"
|
|
558
|
+
label="Overall Font Size"
|
|
559
|
+
updateField={updateField}
|
|
560
|
+
options={["small", "medium", "large"]}
|
|
561
|
+
className="cove-input"
|
|
562
|
+
/>
|
|
389
563
|
|
|
390
564
|
<label>
|
|
391
|
-
<span className="edit-label">Theme</span>
|
|
565
|
+
<span className="edit-label cove-input__label">Theme</span>
|
|
392
566
|
<ul className="color-palette">
|
|
393
567
|
{headerColors.map((palette) => (
|
|
394
|
-
<li
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
568
|
+
<li
|
|
569
|
+
title={palette}
|
|
570
|
+
key={palette}
|
|
571
|
+
onClick={() => {
|
|
572
|
+
updateConfig({ ...config, theme: palette });
|
|
573
|
+
}}
|
|
574
|
+
className={
|
|
575
|
+
config.theme === palette ? "selected " + palette : palette
|
|
576
|
+
}
|
|
577
|
+
></li>
|
|
398
578
|
))}
|
|
399
579
|
</ul>
|
|
400
|
-
|
|
401
|
-
{/* <div className="cove-accordion__panel-section">
|
|
402
|
-
<CheckBox value={config.visual.border} section="visual" fieldName="border" label="Display Borders" updateField={updateField} />
|
|
403
|
-
<CheckBox value={config.visual.borderColorTheme} section="visual" fieldName="borderColorTheme" label="Use theme border color" updateField={updateField} />
|
|
404
|
-
<CheckBox value={config.visual.accent} section="visual" fieldName="accent" label="Use Accent Style" updateField={updateField} />
|
|
405
|
-
<CheckBox value={config.visual.background} section="visual" fieldName="background" label="Use theme background color" updateField={updateField} />
|
|
406
|
-
<CheckBox value={config.visual.hideBackgroundColor} section="visual" fieldName="hideBackgroundColor" label="Hide Background Color" updateField={updateField} />
|
|
407
|
-
</div> */}
|
|
408
|
-
|
|
409
580
|
</label>
|
|
581
|
+
|
|
582
|
+
<div className="cove-accordion__panel-section reverse-labels">
|
|
583
|
+
<InputCheckbox inline size='small' value={config.visual.border} section="visual" fieldName="border" label="Display Border" updateField={updateField} />
|
|
584
|
+
<InputCheckbox inline size='small' value={config.visual.borderColorTheme} section="visual" fieldName="borderColorTheme" label="Use theme border color" updateField={updateField} />
|
|
585
|
+
<InputCheckbox size='small' value={config.visual.accent} section="visual" fieldName="accent" label="Use Accent Style" updateField={updateField} />
|
|
586
|
+
<InputCheckbox size='small' value={config.visual.background} section="visual" fieldName="background" label="Use Theme Background Color" updateField={updateField} />
|
|
587
|
+
<InputCheckbox size='small' value={config.visual.hideBackgroundColor} section="visual" fieldName="hideBackgroundColor" label="Hide Background Color" updateField={updateField} />
|
|
588
|
+
</div>
|
|
410
589
|
</Accordion.Section>
|
|
411
590
|
</Accordion>
|
|
412
|
-
)
|
|
591
|
+
);
|
|
413
592
|
|
|
414
593
|
if (loading) return null
|
|
415
594
|
|
package/src/index.html
CHANGED
|
@@ -3,9 +3,30 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8"/>
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
|
6
|
+
<style>
|
|
7
|
+
body {
|
|
8
|
+
/* max-width: 1000px; */
|
|
9
|
+
margin: 0 auto !important;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.react-container+.react-container {
|
|
16
|
+
margin-top: 3rem;
|
|
17
|
+
}
|
|
18
|
+
</style>
|
|
6
19
|
</head>
|
|
7
20
|
<body>
|
|
21
|
+
|
|
22
|
+
<!-- Original -->
|
|
8
23
|
<div class="react-container" data-config="/examples/example-config.json"></div>
|
|
24
|
+
|
|
25
|
+
<!-- DATA PRESENTATION GALLERY: https://www.cdc.gov/wcms/4.0/cdc-wp/data-presentation/waffle-chart.html#examples -->
|
|
26
|
+
<!-- <div class="react-container" data-config="/examples/gallery/avg-to-max.json"></div> -->
|
|
27
|
+
<!-- <div class="react-container" data-config="/examples/gallery/count.json"></div> -->
|
|
28
|
+
|
|
29
|
+
|
|
9
30
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
10
31
|
</body>
|
|
11
32
|
</html>
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
//}
|
|
20
20
|
|
|
21
21
|
.cove {
|
|
22
|
+
|
|
23
|
+
&-editor__panel {
|
|
24
|
+
ul.color-palette { margin: 0; }
|
|
25
|
+
}
|
|
26
|
+
|
|
22
27
|
.cove-waffle-chart {
|
|
23
28
|
display: flex;
|
|
24
29
|
flex-wrap: wrap;
|
|
@@ -32,14 +37,8 @@
|
|
|
32
37
|
.cove-waffle-chart__chart {
|
|
33
38
|
padding-right: 0;
|
|
34
39
|
}
|
|
35
|
-
|
|
36
|
-
.cove-waffle-chart__data {
|
|
37
|
-
text-align: center;
|
|
38
|
-
// display: flex;
|
|
39
|
-
// flex-wrap: wrap;
|
|
40
|
-
// align-content: space-between;
|
|
41
|
-
}
|
|
42
40
|
}
|
|
41
|
+
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
.cove-waffle-chart__chart {
|
|
@@ -56,31 +55,16 @@
|
|
|
56
55
|
|
|
57
56
|
.cove-waffle-chart__subtext {
|
|
58
57
|
font-style: italic;
|
|
59
|
-
font-weight: bold;
|
|
60
58
|
font-size: 0.75em;
|
|
61
|
-
padding: 0 1em 1em;
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
.cove-waffle-chart__data {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-wrap: wrap;
|
|
64
|
+
align-content: space-between;
|
|
65
65
|
|
|
66
66
|
font-size: 14px;
|
|
67
67
|
|
|
68
|
-
@at-root {
|
|
69
|
-
.cove-waffle-chart.font-small #{&} {
|
|
70
|
-
.cove-waffle-chart__data--primary { font-size: 35px; }
|
|
71
|
-
.cove-waffle-chart__data--text { font-size: 14px; }
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.cove-waffle-chart.font-medium #{&} {
|
|
75
|
-
.cove-waffle-chart__data--primary { font-size: 50px; }
|
|
76
|
-
.cove-waffle-chart__data--text { font-size: 18px; }
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.cove-waffle-chart.font-large #{&} {
|
|
80
|
-
.cove-waffle-chart__data--primary { font-size: 80px; }
|
|
81
|
-
.cove-waffle-chart__data--text { font-size: 20px; }
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
68
|
|
|
85
69
|
.cove-waffle-chart__data--primary {
|
|
86
70
|
font-size: 70px;
|
|
@@ -90,6 +74,7 @@
|
|
|
90
74
|
|
|
91
75
|
.cove-waffle-chart__data--text {
|
|
92
76
|
line-height: 1.25em;
|
|
77
|
+
width: 100%;
|
|
93
78
|
}
|
|
94
79
|
}
|
|
95
80
|
|
|
@@ -97,4 +82,30 @@
|
|
|
97
82
|
transition: all 300ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
98
83
|
}
|
|
99
84
|
|
|
85
|
+
.reverse-labels div {
|
|
86
|
+
float: left;
|
|
87
|
+
margin-right: 5px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.reverse-labels {
|
|
91
|
+
overflow: auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@at-root {
|
|
97
|
+
.cove-waffle-chart.font-small #{&} {
|
|
98
|
+
.cove-waffle-chart__data--primary { font-size: 35px; }
|
|
99
|
+
.cove-waffle-chart__data--text { font-size: 14px; }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.cove-waffle-chart.font-medium #{&} {
|
|
103
|
+
.cove-waffle-chart__data--primary { font-size: 50px; }
|
|
104
|
+
.cove-waffle-chart__data--text { font-size: 18px; }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.cove-waffle-chart.font-large #{&} {
|
|
108
|
+
.cove-waffle-chart__data--primary { font-size: 80px; }
|
|
109
|
+
.cove-waffle-chart__data--text { font-size: 20px; }
|
|
110
|
+
}
|
|
100
111
|
}
|