@cdc/chart 4.25.5-1 → 4.25.6-2

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.
Files changed (63) hide show
  1. package/LICENSE +201 -0
  2. package/dist/cdcchart.js +31118 -27459
  3. package/examples/private/0527.json +1 -0
  4. package/examples/private/DEV-8850-2.json +493 -0
  5. package/examples/private/DEV-9822.json +574 -0
  6. package/examples/private/DEV-9840.json +553 -0
  7. package/examples/private/DEV-9850-3.json +461 -0
  8. package/examples/private/chart.json +1084 -0
  9. package/examples/private/ci_formatted.json +202 -0
  10. package/examples/private/ci_issue.json +3016 -0
  11. package/examples/private/completed.json +634 -0
  12. package/examples/private/dem-data-long.csv +20 -0
  13. package/examples/private/dem-data-long.json +36 -0
  14. package/examples/private/demographic_data.csv +157 -0
  15. package/examples/private/demographic_data.json +2654 -0
  16. package/examples/private/demographic_dynamic.json +443 -0
  17. package/examples/private/demographic_standard.json +560 -0
  18. package/examples/private/ehdi.json +29939 -0
  19. package/examples/private/line-issue.json +497 -0
  20. package/examples/private/not-loading.json +360 -0
  21. package/examples/private/test.json +493 -0
  22. package/examples/private/testing-pie.json +436 -0
  23. package/index.html +130 -130
  24. package/package.json +2 -2
  25. package/src/CdcChartComponent.tsx +66 -26
  26. package/src/_stories/Chart.stories.tsx +99 -93
  27. package/src/_stories/ChartPrefixSuffix.stories.tsx +29 -32
  28. package/src/_stories/_mock/pie_calculated_area.json +417 -0
  29. package/src/components/BarChart/components/BarChart.Horizontal.tsx +4 -13
  30. package/src/components/BarChart/components/BarChart.StackedVertical.tsx +3 -14
  31. package/src/components/BarChart/components/BarChart.Vertical.tsx +2 -8
  32. package/src/components/Brush/BrushChart.tsx +73 -0
  33. package/src/components/Brush/BrushController..tsx +39 -0
  34. package/src/components/DeviationBar.jsx +0 -1
  35. package/src/components/EditorPanel/EditorPanel.tsx +246 -156
  36. package/src/components/EditorPanel/components/Panels/Panel.General.tsx +2 -2
  37. package/src/components/EditorPanel/components/Panels/Panel.Series.tsx +3 -2
  38. package/src/components/EditorPanel/components/Panels/Panel.Visual.tsx +2 -1
  39. package/src/components/EditorPanel/components/Panels/panelVisual.styles.css +8 -0
  40. package/src/components/EditorPanel/useEditorPermissions.ts +7 -4
  41. package/src/components/HoverLine/HoverLine.tsx +74 -0
  42. package/src/components/Legend/Legend.Suppression.tsx +47 -3
  43. package/src/components/Legend/helpers/index.ts +1 -1
  44. package/src/components/LineChart/helpers.ts +7 -7
  45. package/src/components/LineChart/index.tsx +3 -6
  46. package/src/components/LinearChart.tsx +108 -72
  47. package/src/components/PieChart/PieChart.tsx +58 -13
  48. package/src/data/initial-state.js +8 -5
  49. package/src/helpers/countNumOfTicks.ts +4 -19
  50. package/src/helpers/getNewRuntime.ts +35 -0
  51. package/src/helpers/getPiePercent.ts +22 -0
  52. package/src/helpers/getTransformedData.ts +22 -0
  53. package/src/helpers/tests/getNewRuntime.test.ts +82 -0
  54. package/src/helpers/tests/getPiePercent.test.ts +38 -0
  55. package/src/hooks/useRightAxis.ts +1 -1
  56. package/src/hooks/useScales.ts +8 -3
  57. package/src/hooks/useTooltip.tsx +24 -10
  58. package/src/scss/main.scss +8 -4
  59. package/src/store/chart.actions.ts +2 -6
  60. package/src/store/chart.reducer.ts +23 -23
  61. package/src/types/ChartConfig.ts +7 -4
  62. package/src/types/ChartContext.ts +0 -2
  63. package/src/components/ZoomBrush.tsx +0 -251
@@ -0,0 +1,634 @@
1
+ {
2
+ "annotations": [],
3
+ "type": "chart",
4
+ "debugSvg": false,
5
+ "chartMessage": {
6
+ "noData": "No Data Available"
7
+ },
8
+ "title": "",
9
+ "showTitle": true,
10
+ "showDownloadMediaButton": false,
11
+ "theme": "theme-blue",
12
+ "animate": false,
13
+ "fontSize": "medium",
14
+ "lineDatapointStyle": "hover",
15
+ "lineDatapointColor": "Same as Line",
16
+ "barHasBorder": "false",
17
+ "isLollipopChart": false,
18
+ "lollipopShape": "circle",
19
+ "lollipopColorStyle": "two-tone",
20
+ "visualizationSubType": "regular",
21
+ "barStyle": "",
22
+ "roundingStyle": "standard",
23
+ "tipRounding": "top",
24
+ "isResponsiveTicks": false,
25
+ "general": {
26
+ "annotationDropdownText": "Annotations",
27
+ "showDownloadButton": false,
28
+ "showMissingDataLabel": false,
29
+ "showSuppressedSymbol": true,
30
+ "showZeroValueData": true,
31
+ "hideNullValue": true
32
+ },
33
+ "padding": {
34
+ "left": 5,
35
+ "right": 5
36
+ },
37
+ "preliminaryData": [],
38
+ "yAxis": {
39
+ "hideAxis": false,
40
+ "displayNumbersOnBar": false,
41
+ "hideLabel": false,
42
+ "hideTicks": false,
43
+ "size": 50,
44
+ "gridLines": false,
45
+ "enablePadding": false,
46
+ "min": "",
47
+ "max": "",
48
+ "labelColor": "#333",
49
+ "tickLabelColor": "#333",
50
+ "tickColor": "#333",
51
+ "rightHideAxis": false,
52
+ "rightAxisSize": 0,
53
+ "rightLabel": "",
54
+ "rightLabelOffsetSize": 0,
55
+ "rightAxisLabelColor": "#333",
56
+ "rightAxisTickLabelColor": "#333",
57
+ "rightAxisTickColor": "#333",
58
+ "numTicks": "",
59
+ "axisPadding": 0,
60
+ "scalePadding": 10,
61
+ "tickRotation": 0,
62
+ "anchors": [],
63
+ "shoMissingDataLabel": true,
64
+ "showMissingDataLine": true,
65
+ "categories": []
66
+ },
67
+ "boxplot": {
68
+ "plots": [],
69
+ "borders": "true",
70
+ "plotOutlierValues": false,
71
+ "plotNonOutlierValues": true,
72
+ "labels": {
73
+ "q1": "Lower Quartile",
74
+ "q2": "q2",
75
+ "q3": "Upper Quartile",
76
+ "q4": "q4",
77
+ "minimum": "Minimum",
78
+ "maximum": "Maximum",
79
+ "mean": "Mean",
80
+ "median": "Median",
81
+ "sd": "Standard Deviation",
82
+ "iqr": "Interquartile Range",
83
+ "count": "Count",
84
+ "outliers": "Outliers",
85
+ "values": "Values",
86
+ "lowerBounds": "Lower Bounds",
87
+ "upperBounds": "Upper Bounds"
88
+ }
89
+ },
90
+ "topAxis": {
91
+ "hasLine": false
92
+ },
93
+ "isLegendValue": false,
94
+ "barThickness": 0.35,
95
+ "barHeight": 25,
96
+ "barSpace": 15,
97
+ "heights": {
98
+ "vertical": 300,
99
+ "horizontal": 750
100
+ },
101
+ "xAxis": {
102
+ "sortDates": false,
103
+ "anchors": [],
104
+ "type": "categorical",
105
+ "showTargetLabel": true,
106
+ "targetLabel": "Target",
107
+ "hideAxis": false,
108
+ "hideLabel": false,
109
+ "hideTicks": false,
110
+ "size": 75,
111
+ "tickRotation": 0,
112
+ "min": "",
113
+ "max": "",
114
+ "labelColor": "#333",
115
+ "tickLabelColor": "#333",
116
+ "tickColor": "#333",
117
+ "numTicks": "",
118
+ "labelOffset": 0,
119
+ "axisPadding": 200,
120
+ "target": 0,
121
+ "maxTickRotation": 0,
122
+ "padding": 5,
123
+ "showYearsOnce": false,
124
+ "sortByRecentDate": false,
125
+ "dataKey": "Year",
126
+ "axisBBox": 25.693336486816406,
127
+ "tickWidthMax": 41
128
+ },
129
+ "table": {
130
+ "label": "Data Table",
131
+ "expanded": true,
132
+ "limitHeight": false,
133
+ "height": "",
134
+ "caption": "",
135
+ "showDownloadUrl": false,
136
+ "showDataTableLink": true,
137
+ "showDownloadLinkBelow": true,
138
+ "indexLabel": "",
139
+ "download": true,
140
+ "showVertical": true,
141
+ "dateDisplayFormat": "",
142
+ "showMissingDataLabel": true,
143
+ "showSuppressedSymbol": true,
144
+ "show": true
145
+ },
146
+ "orientation": "vertical",
147
+ "color": "pinkpurple",
148
+ "columns": {
149
+ "State_Long": {
150
+ "label": "State_Long",
151
+ "dataTable": true,
152
+ "tooltips": false,
153
+ "prefix": "",
154
+ "suffix": "",
155
+ "forestPlot": false,
156
+ "startingPoint": "0",
157
+ "forestPlotAlignRight": false,
158
+ "roundToPlace": 0,
159
+ "commas": false,
160
+ "showInViz": false,
161
+ "forestPlotStartingPoint": 0,
162
+ "name": "State_Long",
163
+ "order": 2
164
+ }
165
+ },
166
+ "legend": {
167
+ "hide": false,
168
+ "behavior": "isolate",
169
+ "axisAlign": true,
170
+ "singleRow": true,
171
+ "colorCode": "",
172
+ "reverseLabelOrder": false,
173
+ "description": "",
174
+ "dynamicLegend": false,
175
+ "dynamicLegendDefaultText": "Show All",
176
+ "dynamicLegendItemLimit": 5,
177
+ "dynamicLegendItemLimitMessage": "Dynamic Legend Item Limit Hit.",
178
+ "dynamicLegendChartMessage": "Select Options from the Legend",
179
+ "label": "",
180
+ "lineMode": false,
181
+ "verticalSorted": false,
182
+ "highlightOnHover": false,
183
+ "hideSuppressedLabels": false,
184
+ "hideSuppressionLink": false,
185
+ "seriesHighlight": [],
186
+ "style": "circles",
187
+ "subStyle": "linear blocks",
188
+ "tickRotation": "",
189
+ "hideBorder": {
190
+ "side": false,
191
+ "topBottom": true
192
+ },
193
+ "position": "right"
194
+ },
195
+ "brush": {
196
+ "height": 45,
197
+ "active": false
198
+ },
199
+ "exclusions": {
200
+ "active": false,
201
+ "keys": []
202
+ },
203
+ "palette": "qualitative-bold",
204
+ "isPaletteReversed": false,
205
+ "twoColor": {
206
+ "palette": "monochrome-1",
207
+ "isPaletteReversed": false
208
+ },
209
+ "labels": false,
210
+ "dataFormat": {
211
+ "commas": false,
212
+ "prefix": "",
213
+ "suffix": "",
214
+ "abbreviated": false,
215
+ "bottomSuffix": "",
216
+ "bottomPrefix": "",
217
+ "bottomAbbreviated": false
218
+ },
219
+ "confidenceKeys": {
220
+ "upper": "CI Upper",
221
+ "lower": "CI Lower"
222
+ },
223
+ "visual": {
224
+ "border": true,
225
+ "accent": true,
226
+ "background": true,
227
+ "verticalHoverLine": false,
228
+ "horizontalHoverLine": false
229
+ },
230
+ "useLogScale": false,
231
+ "filterBehavior": "Filter Change",
232
+ "highlightedBarValues": [],
233
+ "series": [
234
+ {
235
+ "dataKey": "Male",
236
+ "type": "Bar",
237
+ "axis": "Left",
238
+ "tooltip": true
239
+ },
240
+ {
241
+ "dataKey": "Female",
242
+ "type": "Bar",
243
+ "axis": "Left",
244
+ "tooltip": true
245
+ }
246
+ ],
247
+ "tooltips": {
248
+ "opacity": 90,
249
+ "singleSeries": false,
250
+ "dateDisplayFormat": ""
251
+ },
252
+ "forestPlot": {
253
+ "startAt": 0,
254
+ "colors": {
255
+ "line": "",
256
+ "shape": ""
257
+ },
258
+ "lineOfNoEffect": {
259
+ "show": true
260
+ },
261
+ "type": "",
262
+ "pooledResult": {
263
+ "diamondHeight": 5,
264
+ "column": ""
265
+ },
266
+ "estimateField": "",
267
+ "estimateRadius": "",
268
+ "shape": "square",
269
+ "rowHeight": 20,
270
+ "description": {
271
+ "show": true,
272
+ "text": "description",
273
+ "location": 0
274
+ },
275
+ "result": {
276
+ "show": true,
277
+ "text": "result",
278
+ "location": 100
279
+ },
280
+ "radius": {
281
+ "min": 2,
282
+ "max": 10,
283
+ "scalingColumn": ""
284
+ },
285
+ "regression": {
286
+ "lower": 0,
287
+ "upper": 0,
288
+ "estimateField": 0
289
+ },
290
+ "leftWidthOffset": 0,
291
+ "rightWidthOffset": 0,
292
+ "showZeroLine": false,
293
+ "leftLabel": "",
294
+ "rightLabel": ""
295
+ },
296
+ "area": {
297
+ "isStacked": false
298
+ },
299
+ "sankey": {
300
+ "title": {
301
+ "defaultColor": "black"
302
+ },
303
+ "iterations": 1,
304
+ "rxValue": 0.9,
305
+ "overallSize": {
306
+ "width": 900,
307
+ "height": 700
308
+ },
309
+ "margin": {
310
+ "margin_y": 25,
311
+ "margin_x": 0
312
+ },
313
+ "nodeSize": {
314
+ "nodeWidth": 26,
315
+ "nodeHeight": 40
316
+ },
317
+ "nodePadding": 55,
318
+ "nodeFontColor": "black",
319
+ "nodeColor": {
320
+ "default": "#ff8500",
321
+ "inactive": "#808080"
322
+ },
323
+ "linkColor": {
324
+ "default": "#ffc900",
325
+ "inactive": "#D3D3D3"
326
+ },
327
+ "opacity": {
328
+ "nodeOpacityDefault": 1,
329
+ "nodeOpacityInactive": 0.1,
330
+ "LinkOpacityDefault": 1,
331
+ "LinkOpacityInactive": 0.1
332
+ },
333
+ "storyNodeFontColor": "#006778",
334
+ "storyNodeText": [],
335
+ "nodeValueStyle": {
336
+ "textBefore": "(",
337
+ "textAfter": ")"
338
+ },
339
+ "data": []
340
+ },
341
+ "visualizationType": "Bar",
342
+ "data": [
343
+ {
344
+ "Year": "2019",
345
+ "State": "XX",
346
+ "State_Long": "United States",
347
+ "CI Lower": "35.2",
348
+ "CI Upper": "38.2",
349
+ "Total": "36.7"
350
+ },
351
+ {
352
+ "Year": "2019",
353
+ "State": "AL",
354
+ "State_Long": "Alabama",
355
+ "CI Lower": "36.0",
356
+ "CI Upper": "39.0",
357
+ "Total": "37.5"
358
+ },
359
+ {
360
+ "Year": "2019",
361
+ "State": "AK",
362
+ "State_Long": "Alaska",
363
+ "CI Lower": "36.6",
364
+ "CI Upper": "39.6",
365
+ "Total": "38.1"
366
+ },
367
+ {
368
+ "Year": "2021",
369
+ "State": "AL",
370
+ "State_Long": "Alabama",
371
+ "CI Lower": "34.9",
372
+ "CI Upper": "38.9",
373
+ "Total": "36.9"
374
+ },
375
+ {
376
+ "Year": "2021",
377
+ "State": "AK",
378
+ "State_Long": "Alaska",
379
+ "CI Lower": "N/A",
380
+ "CI Upper": "N/A",
381
+ "Total": "Not Available",
382
+ "Female": "Not Available",
383
+ "Male": "Not Available"
384
+ },
385
+ {
386
+ "Year": "2023",
387
+ "State": "AL",
388
+ "State_Long": "Alabama",
389
+ "CI Lower": "N/A",
390
+ "CI Upper": "N/A",
391
+ "Total": "Not Available",
392
+ "Female": "Not Available",
393
+ "Male": "Not Available"
394
+ },
395
+ {
396
+ "Year": "2023",
397
+ "State": "AK",
398
+ "State_Long": "Alaska",
399
+ "CI Lower": "41.2",
400
+ "CI Upper": "45.2",
401
+ "Total": "43.2"
402
+ },
403
+ {
404
+ "Year": "2019",
405
+ "State": "AL",
406
+ "State_Long": "Alabama",
407
+ "CI Lower": "47.1",
408
+ "CI Upper": "50.1",
409
+ "Female": "48.6"
410
+ },
411
+ {
412
+ "Year": "2019",
413
+ "State": "AK",
414
+ "State_Long": "Alaska",
415
+ "CI Lower": "46.9",
416
+ "CI Upper": "49.9",
417
+ "Female": "48.4"
418
+ },
419
+ {
420
+ "Year": "2021",
421
+ "State": "AL",
422
+ "State_Long": "Alabama",
423
+ "CI Lower": "44.0",
424
+ "CI Upper": "48.0",
425
+ "Female": "46.0"
426
+ },
427
+ {
428
+ "Year": "2023",
429
+ "State": "AK",
430
+ "State_Long": "Alaska",
431
+ "CI Lower": "54.0",
432
+ "CI Upper": "58.0",
433
+ "Female": "56.0"
434
+ },
435
+ {
436
+ "Year": "2019",
437
+ "State": "AL",
438
+ "State_Long": "Alabama",
439
+ "CI Lower": "24.7",
440
+ "CI Upper": "27.7",
441
+ "Male": "26.2"
442
+ },
443
+ {
444
+ "Year": "2019",
445
+ "State": "AK",
446
+ "State_Long": "Alaska",
447
+ "CI Lower": "26.9",
448
+ "CI Upper": "29.9",
449
+ "Male": "28.4"
450
+ },
451
+ {
452
+ "Year": "2021",
453
+ "State": "AL",
454
+ "State_Long": "Alabama",
455
+ "CI Lower": "25.4",
456
+ "CI Upper": "29.4",
457
+ "Male": "27.4"
458
+ },
459
+ {
460
+ "Year": "2023",
461
+ "State": "AK",
462
+ "State_Long": "Alaska",
463
+ "CI Lower": "29.8",
464
+ "CI Upper": "33.8",
465
+ "Male": "31.8"
466
+ }
467
+ ],
468
+ "dataFileName": "dem-data-long.csv",
469
+ "dataFileSourceType": "file",
470
+ "formattedData": [
471
+ {
472
+ "Year": "2019",
473
+ "State": "XX",
474
+ "State_Long": "United States",
475
+ "CI Lower": "35.2",
476
+ "CI Upper": "38.2",
477
+ "Total": "36.7"
478
+ },
479
+ {
480
+ "Year": "2019",
481
+ "State": "AL",
482
+ "State_Long": "Alabama",
483
+ "CI Lower": "36.0",
484
+ "CI Upper": "39.0",
485
+ "Total": "37.5"
486
+ },
487
+ {
488
+ "Year": "2019",
489
+ "State": "AK",
490
+ "State_Long": "Alaska",
491
+ "CI Lower": "36.6",
492
+ "CI Upper": "39.6",
493
+ "Total": "38.1"
494
+ },
495
+ {
496
+ "Year": "2021",
497
+ "State": "AL",
498
+ "State_Long": "Alabama",
499
+ "CI Lower": "34.9",
500
+ "CI Upper": "38.9",
501
+ "Total": "36.9"
502
+ },
503
+ {
504
+ "Year": "2021",
505
+ "State": "AK",
506
+ "State_Long": "Alaska",
507
+ "CI Lower": "N/A",
508
+ "CI Upper": "N/A",
509
+ "Total": "Not Available",
510
+ "Female": "Not Available",
511
+ "Male": "Not Available"
512
+ },
513
+ {
514
+ "Year": "2023",
515
+ "State": "AL",
516
+ "State_Long": "Alabama",
517
+ "CI Lower": "N/A",
518
+ "CI Upper": "N/A",
519
+ "Total": "Not Available",
520
+ "Female": "Not Available",
521
+ "Male": "Not Available"
522
+ },
523
+ {
524
+ "Year": "2023",
525
+ "State": "AK",
526
+ "State_Long": "Alaska",
527
+ "CI Lower": "41.2",
528
+ "CI Upper": "45.2",
529
+ "Total": "43.2"
530
+ },
531
+ {
532
+ "Year": "2019",
533
+ "State": "AL",
534
+ "State_Long": "Alabama",
535
+ "CI Lower": "47.1",
536
+ "CI Upper": "50.1",
537
+ "Female": "48.6"
538
+ },
539
+ {
540
+ "Year": "2019",
541
+ "State": "AK",
542
+ "State_Long": "Alaska",
543
+ "CI Lower": "46.9",
544
+ "CI Upper": "49.9",
545
+ "Female": "48.4"
546
+ },
547
+ {
548
+ "Year": "2021",
549
+ "State": "AL",
550
+ "State_Long": "Alabama",
551
+ "CI Lower": "44.0",
552
+ "CI Upper": "48.0",
553
+ "Female": "46.0"
554
+ },
555
+ {
556
+ "Year": "2023",
557
+ "State": "AK",
558
+ "State_Long": "Alaska",
559
+ "CI Lower": "54.0",
560
+ "CI Upper": "58.0",
561
+ "Female": "56.0"
562
+ },
563
+ {
564
+ "Year": "2019",
565
+ "State": "AL",
566
+ "State_Long": "Alabama",
567
+ "CI Lower": "24.7",
568
+ "CI Upper": "27.7",
569
+ "Male": "26.2"
570
+ },
571
+ {
572
+ "Year": "2019",
573
+ "State": "AK",
574
+ "State_Long": "Alaska",
575
+ "CI Lower": "26.9",
576
+ "CI Upper": "29.9",
577
+ "Male": "28.4"
578
+ },
579
+ {
580
+ "Year": "2021",
581
+ "State": "AL",
582
+ "State_Long": "Alabama",
583
+ "CI Lower": "25.4",
584
+ "CI Upper": "29.4",
585
+ "Male": "27.4"
586
+ },
587
+ {
588
+ "Year": "2023",
589
+ "State": "AK",
590
+ "State_Long": "Alaska",
591
+ "CI Lower": "29.8",
592
+ "CI Upper": "33.8",
593
+ "Male": "31.8"
594
+ }
595
+ ],
596
+ "dataDescription": {
597
+ "horizontal": false,
598
+ "series": true,
599
+ "singleRow": false,
600
+ "seriesKey": "Demographic_Group",
601
+ "xKey": "Year",
602
+ "valueKeysTallSupport": [
603
+ "Value"
604
+ ]
605
+ },
606
+ "version": "4.24.10",
607
+ "dynamicMarginTop": 0,
608
+ "filters": [
609
+ {
610
+ "values": [
611
+ "United States",
612
+ "Alabama",
613
+ "Alaska"
614
+ ],
615
+ "filterStyle": "dropdown",
616
+ "id": 1733535847908,
617
+ "showDropdown": true,
618
+ "columnName": "State_Long",
619
+ "active": "Alabama"
620
+ },
621
+ {
622
+ "values": [
623
+ "2019",
624
+ "2021",
625
+ "2023"
626
+ ],
627
+ "filterStyle": "dropdown",
628
+ "id": 1733535895266,
629
+ "showDropdown": true,
630
+ "columnName": "Year",
631
+ "active": "2019"
632
+ }
633
+ ]
634
+ }
@@ -0,0 +1,20 @@
1
+ Year,State,State_Long,Demographic_Group,Value,CI Lower,CI Upper
2
+ 2019,XX,United States,Total,36.7,35.2,38.2
3
+ 2019,AL,Alabama,Total,37.5,36.0,39.0
4
+ 2019,AK,Alaska,Total,38.1,36.6,39.6
5
+ 2021,AL,Alabama,Total,36.9,34.9,38.9
6
+ 2021,AK,Alaska,Total,Not Available,N/A,N/A
7
+ 2023,AL,Alabama,Total,Not Available,N/A,N/A
8
+ 2023,AK,Alaska,Total,43.2,41.2,45.2
9
+ 2019,AL,Alabama,Female,48.6,47.1,50.1
10
+ 2019,AK,Alaska,Female,48.4,46.9,49.9
11
+ 2021,AL,Alabama,Female,46.0,44.0,48.0
12
+ 2021,AK,Alaska,Female,Not Available,N/A,N/A
13
+ 2023,AL,Alabama,Female,Not Available,N/A,N/A
14
+ 2023,AK,Alaska,Female,56.0,54.0,58.0
15
+ 2019,AL,Alabama,Male,26.2,24.7,27.7
16
+ 2019,AK,Alaska,Male,28.4,26.9,29.9
17
+ 2021,AL,Alabama,Male,27.4,25.4,29.4
18
+ 2021,AK,Alaska,Male,Not Available,N/A,N/A
19
+ 2023,AL,Alabama,Male,Not Available,N/A,N/A
20
+ 2023,AK,Alaska,Male,31.8,29.8,33.8
@@ -0,0 +1,36 @@
1
+ unknown parameter ./dem-data-long.csv.
2
+ Please specify csv file path or pipe the csv data through.
3
+
4
+ csvtojson: Convert csv to JSON format
5
+ version: 2.0.10
6
+ Usage: csvtojson [<command>] [<options>] filepath
7
+
8
+ Commands:
9
+ parse: (Default)Parse a csv file to json
10
+ version: Show version of current csvtojson
11
+ Options:
12
+ --output: The format to be converted to. "json" (default) -- convert csv to json. "csv" -- convert csv to csv row array. "line" -- convert csv to csv line string
13
+ --delimiter: delimiter to separate columns. Possible to give an array or just use 'auto'. default comma (,). e.g. --delimiter=# --delimiter='[",",";"]' --delimiter=auto
14
+ --quote: quote surrounding a column content containing delimiters. To turn off quote, please use 'off' --quote=off. default double quote ("). e.g. chage to hash: --quote=#
15
+ --trim: Indicate if parser trim off spaces surrounding column content. e.g. " content " will be trimmed to "content". Default: true
16
+ --checkType: This parameter turns on and off whether check field type. default is false.
17
+ --ignoreEmpty: This parameter turns on and off whether ignore empty column values while parsing. default is false
18
+ --noheader: Indicating csv data has no header row and first row is data row. Default is false
19
+ --headers: An array to specify the headers of CSV data. If --noheader is false, this value will override CSV header. Default: null. Example: --headers='["my field","name"]'
20
+ --flatKeys: Don't interpret dots (.) and square brackets in header fields as nested object or array identifiers at all (treat them like regular characters for JSON field identifiers). Default: false.
21
+ --maxRowLength: the max character a csv row could have. 0 means infinite. If max number exceeded, parser will emit "error" of "row_exceed". if a possibly corrupted csv data provided, give it a number like 65535 so the parser wont consume memory. default: 10240
22
+ --checkColumn: whether check column number of a row is the same as headers. If column number mismatched headers number, an error of "mismatched_column" will be emitted.. default: false
23
+ --eol: Explicitly specify the end of line character to use.
24
+ --quiet: If any error happens, quit the process quietly rather than log out the error. Default is false.
25
+ --escape: escape character used in quoted column. Default is double quote (") according to RFC4108. Change to back slash (\) or other chars for your own case.
26
+ --ignoreColumns: RegExp matched columns to ignore from input. e.g. --ignoreColumns=/(name|age)/
27
+ --includeColumns: RegExp matched columns to include from input. e.g. --includeColumns=/(name|age)/
28
+ --colParser: Specific parser for columns. e.g. --colParser='{"col1":"number","col2":"string"}'
29
+ --alwaysSplitAtEOL: Always interpret each line (as defined by eol) as a row. This will prevent eol characters from being used within a row (even inside a quoted field). This ensures that misplaced quotes only break on row, and not all ensuing rows.
30
+ --nullObject: How to parse if a csv cell contains 'null'. Default false will keep 'null' as string. Change to true if a null object is needed.
31
+ --downstreamFormat: Option to set what JSON array format is needed by downstream. 'line' is also called ndjson format. This format will write lines of JSON (without square brackets and commas) to downstream. 'array' will write complete JSON array string to downstream (suitable for file writable stream etc). Default 'line'
32
+ Examples:
33
+ csvtojson < csvfile
34
+ csvtojson <path to csvfile>
35
+ cat <csvfile> | csvtojson
36
+ csvtojson <csvfilepath> --checkType=false --trim=false --delimiter=#