@cdc/core 4.26.1 → 4.26.3
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/.claude/agents/qa-test-developer.md +126 -0
- package/CLAUDE.local.md +67 -0
- package/LICENSE +201 -0
- package/_stories/Gallery.Charts.stories.tsx +35 -42
- package/_stories/Gallery.DataBite.stories.tsx +15 -8
- package/_stories/Gallery.Maps.stories.tsx +37 -28
- package/_stories/Gallery.WaffleChart.stories.tsx +1 -1
- package/_stories/PageART.stories.tsx +5 -4
- package/_stories/PageBRFSS.stories.tsx +21 -16
- package/_stories/PageCancerRegistries.stories.tsx +15 -15
- package/_stories/PageEasternEquineEncephalitis.stories.tsx +33 -19
- package/_stories/PageExcessiveAlcoholUse.stories.tsx +148 -143
- package/_stories/PageMaternalMortality.stories.tsx +5 -4
- package/_stories/PageOralHealth.stories.tsx +15 -10
- package/_stories/PageRespiratory.stories.tsx +4 -4
- package/_stories/PageSmokingTobacco.stories.tsx +15 -10
- package/_stories/PageStateDiabetesProfiles.stories.tsx +15 -10
- package/_stories/PageWastewater.stories.tsx +44 -30
- package/_stories/VegaImport.stories.tsx +401 -0
- package/_stories/vega-fixtures/bars-with-line.json +444 -0
- package/_stories/vega-fixtures/bars.json +58 -0
- package/_stories/vega-fixtures/combo-bar-rolling-mean.json +88 -0
- package/_stories/vega-fixtures/combo.json +68 -0
- package/_stories/vega-fixtures/grouped-horizontal-bars.json +83 -0
- package/_stories/vega-fixtures/grouped-horizontal-bars2.json +231 -0
- package/_stories/vega-fixtures/horizontal-bar.json +427 -0
- package/_stories/vega-fixtures/horizontal-bars-with-bad-colors.json +197 -0
- package/_stories/vega-fixtures/horizontal-bars2.json +58 -0
- package/_stories/vega-fixtures/lines.json +227 -0
- package/_stories/vega-fixtures/measles-bars.json +348 -0
- package/_stories/vega-fixtures/measles-map.json +11101 -0
- package/_stories/vega-fixtures/measles-stacked-bars.json +2147 -0
- package/_stories/vega-fixtures/multi-dataset.json +255 -0
- package/_stories/vega-fixtures/no-data.json +14 -0
- package/_stories/vega-fixtures/pie-chart.json +94 -0
- package/_stories/vega-fixtures/repeat-spec.json +47 -0
- package/_stories/vega-fixtures/stacked-area.json +222 -0
- package/_stories/vega-fixtures/stacked-bar-with-rect.json +3412 -0
- package/_stories/vega-fixtures/stacked-bars-with-line.json +364 -0
- package/_stories/vega-fixtures/stacked-bars.json +212 -0
- package/_stories/vega-fixtures/stacked-horizontal-bars.json +140 -0
- package/_stories/vega-fixtures/warning-combo.json +59 -0
- package/_stories/vega-fixtures/warning-scatter-and-line.json +1182 -0
- package/assets/callout-flag.svg +7 -0
- package/assets/icon-chart-area.svg +1 -0
- package/assets/icon-chart-radar.svg +23 -0
- package/assets/logo2.svg +31 -0
- package/components/AdvancedEditor/EmbedEditor.tsx +270 -38
- package/components/Alert/components/Alert.styles.css +2 -2
- package/components/ComboBox/combobox.styles.css +48 -48
- package/components/CustomColorsEditor/CustomColorsEditor.css +53 -53
- package/components/CustomColorsEditor/CustomColorsEditor.tsx +3 -10
- package/components/DataTable/DataTable.tsx +46 -18
- package/components/DataTable/DataTableStandAlone.tsx +1 -0
- package/components/DataTable/components/ChartHeader.tsx +21 -12
- package/components/DataTable/components/MapHeader.tsx +34 -28
- package/components/DataTable/components/SortIcon/sort-icon.css +5 -5
- package/components/DataTable/data-table.css +50 -52
- package/components/DataTable/helpers/applyCustomOrder.ts +17 -0
- package/components/DataTable/helpers/getChartCellValue.ts +10 -7
- package/components/DataTable/helpers/getMapDataTableColumnKeys.ts +22 -0
- package/components/DataTable/helpers/getSeriesName.ts +6 -0
- package/components/DataTable/helpers/mapCellMatrix.tsx +33 -23
- package/components/DataTable/helpers/tests/mapCellMatrix.test.ts +33 -0
- package/components/DownloadButton.tsx +14 -6
- package/components/EditorPanel/ColumnsEditor.tsx +38 -31
- package/components/EditorPanel/CustomSortOrder.tsx +94 -0
- package/components/EditorPanel/DataTableEditor.tsx +139 -23
- package/components/EditorPanel/EditorPanel.styles.css +71 -71
- package/components/EditorPanel/EditorPanel.tsx +3 -8
- package/components/EditorPanel/EditorPanelDispatch.tsx +4 -4
- package/components/EditorPanel/FootnotesEditor.tsx +2 -2
- package/components/EditorPanel/VizFilterEditor/NestedDropdownEditor.tsx +21 -12
- package/components/EditorPanel/VizFilterEditor/VizFilterEditor.tsx +16 -10
- package/components/EditorPanel/VizFilterEditor/components/FilterOrder.tsx +33 -29
- package/components/EditorPanel/components/MarkupVariablesEditor.tsx +160 -106
- package/components/EditorPanel/components/PanelMarkup.tsx +5 -1
- package/{styles/v2/components → components/EditorPanel}/editor.scss +76 -22
- package/components/EditorPanel/sections/StyleTreatmentSection.tsx +99 -0
- package/components/EditorPanel/sections/VisualSection.tsx +11 -0
- package/components/EditorWrapper/editor-wrapper.style.css +1 -1
- package/components/Filters/Filters.tsx +3 -5
- package/components/Filters/components/Tabs.tsx +19 -7
- package/{styles → components/Filters}/filters.scss +3 -3
- package/components/Footnotes/FootnotesStandAlone.tsx +4 -2
- package/components/HeaderThemeSelector/HeaderThemeSelector.css +61 -5
- package/components/Layout/components/Responsive.tsx +14 -6
- package/components/Layout/components/Sidebar/components/Sidebar.tsx +1 -1
- package/components/Layout/components/Sidebar/components/sidebar.styles.scss +14 -20
- package/components/Layout/components/Visualization/index.tsx +50 -38
- package/components/Layout/components/Visualization/visualizations.scss +232 -15
- package/components/Layout/components/VisualizationContainer.test.tsx +67 -0
- package/components/Layout/components/VisualizationContainer.tsx +37 -0
- package/components/Layout/components/VisualizationContent.test.tsx +182 -0
- package/components/Layout/components/VisualizationContent.tsx +75 -0
- package/components/Layout/index.tsx +5 -5
- package/components/Layout/styles/editor-utils.scss +3 -3
- package/components/Layout/styles/editor.scss +4 -4
- package/components/Legend/Legend.Gradient.tsx +7 -1
- package/components/Loader/loader.styles.css +2 -2
- package/components/Loading.jsx +1 -1
- package/components/MediaControls.tsx +10 -3
- package/components/MultiSelect/multiselect.styles.css +19 -19
- package/components/NestedDropdown/nesteddropdown.styles.css +15 -15
- package/components/PaletteSelector/PaletteSelector.css +15 -15
- package/components/RichTooltip/richTooltip.css +6 -6
- package/components/Table/table.styles.css +2 -2
- package/components/Waiting.tsx +1 -1
- package/components/_stories/CustomColorsEditor.stories.tsx +37 -0
- package/components/_stories/DataTable.stories.tsx +1 -0
- package/components/_stories/Filters.stories.tsx +1 -1
- package/components/_stories/styles.scss +0 -1
- package/components/elements/Button.jsx +1 -1
- package/components/elements/Card.jsx +1 -1
- package/{styles/v2/components → components/elements}/button.scss +9 -8
- package/components/inputs/InputCheckbox.jsx +1 -1
- package/components/inputs/InputSelect.tsx +1 -1
- package/components/inputs/InputText.jsx +1 -1
- package/components/inputs/InputToggle.tsx +1 -1
- package/{styles/v2/components/input → components/inputs}/_input-check-radio.scss +2 -2
- package/{styles/v2/components/input → components/inputs}/_input-group.scss +3 -3
- package/{styles/v2/components/input → components/inputs}/_input-slider.scss +2 -2
- package/{styles/v2/components/input → components/inputs}/_input.scss +5 -5
- package/{styles/v2/components/input → components/inputs}/index.scss +2 -2
- package/{styles → components}/loading.scss +1 -1
- package/components/managers/DataDesigner.tsx +1 -1
- package/{styles/v2/components → components/managers}/data-designer.scss +6 -7
- package/components/ui/Accordion.jsx +1 -1
- package/components/ui/Icon.tsx +1 -1
- package/components/ui/LoadSpin.jsx +1 -1
- package/components/ui/Modal.jsx +1 -1
- package/components/ui/Overlay.jsx +1 -1
- package/components/ui/Title/index.test.tsx +34 -0
- package/components/ui/Title/index.tsx +24 -7
- package/components/ui/Title/title.styles.css +119 -25
- package/components/ui/Tooltip.tsx +1 -1
- package/components/ui/_stories/Title.stories.tsx +1 -1
- package/{styles/v2/components → components/ui}/accordion.scss +3 -3
- package/components/ui/accordion.styles.css +11 -11
- package/{styles/v2/components → components/ui}/modal.scss +2 -2
- package/{styles/v2/components → components/ui}/overlay.scss +6 -6
- package/{styles/v2/components → components}/ui/tooltip.scss +1 -1
- package/{styles → components}/waiting.scss +9 -3
- package/data/colorPalettes.ts +18 -5
- package/data/mapColorPalettes.ts +10 -0
- package/devTemplate/dev.js +285 -0
- package/devTemplate/index.html +30 -0
- package/devTemplate/preview.html +1503 -0
- package/devTemplate/sidebar.css +151 -0
- package/dist/cove-main.css +2530 -3901
- package/dist/cove-main.css.map +1 -1
- package/generateViteConfig.js +111 -2
- package/helpers/DataTransform.ts +1 -5
- package/helpers/backfillDefaults.ts +35 -0
- package/helpers/constants.ts +12 -0
- package/helpers/cove/date.ts +64 -3
- package/helpers/cove/number.ts +29 -15
- package/helpers/cove/string.ts +29 -0
- package/helpers/coveUpdateWorker.ts +14 -8
- package/helpers/displayDataAsText.ts +1 -1
- package/helpers/embed/embedCodeGenerator.ts +80 -0
- package/helpers/embed/embedHelper.js +169 -0
- package/helpers/embed/filterUtils.ts +121 -0
- package/helpers/embed/index.ts +17 -0
- package/helpers/embed/urlValidation.ts +119 -0
- package/helpers/extractDataAndMetadata.ts +20 -0
- package/helpers/fetchRemoteData.ts +14 -8
- package/helpers/filterVizData.ts +6 -1
- package/helpers/getFileExtension.ts +0 -6
- package/helpers/labelHash.ts +9 -0
- package/helpers/markupProcessor.ts +56 -38
- package/helpers/metrics/types.ts +3 -0
- package/helpers/palettes/colorDistributions.ts +1 -1
- package/helpers/palettes/utils.ts +12 -12
- package/helpers/parseCsvWithQuotes.ts +15 -14
- package/helpers/prepareScreenshot.ts +33 -10
- package/helpers/testing.ts +44 -0
- package/helpers/tests/DataTransform.test.ts +125 -0
- package/helpers/tests/abbreviateNumber.test.ts +59 -0
- package/helpers/tests/backfillDefaults.test.ts +253 -0
- package/helpers/tests/date.test.ts +110 -0
- package/helpers/tests/extractDataAndMetadata.test.ts +93 -0
- package/helpers/tests/markupProcessor.test.ts +315 -124
- package/helpers/tests/number.test.ts +42 -0
- package/helpers/tests/prepareScreenshot.test.ts +28 -28
- package/helpers/tests/testStandaloneBuild.ts +36 -26
- package/helpers/tests/useDataVizClasses.test.ts +66 -0
- package/helpers/tests/visualizationWrapperUsage.test.ts +57 -0
- package/helpers/useDataVizClasses.ts +13 -7
- package/helpers/vegaConfig.ts +1 -1
- package/helpers/vegaConfigImport.ts +160 -0
- package/helpers/ver/4.24.4.ts +24 -0
- package/helpers/ver/4.26.1.ts +1 -1
- package/helpers/ver/4.26.2.ts +84 -0
- package/helpers/ver/4.26.3.ts +44 -0
- package/helpers/ver/4.26.4.ts +31 -0
- package/helpers/ver/tests/4.26.1.test.ts +105 -0
- package/helpers/ver/tests/4.26.2.test.ts +298 -0
- package/helpers/ver/tests/4.26.3.test.ts +168 -0
- package/helpers/ver/tests/4.26.4.test.ts +88 -0
- package/helpers/ver/tests/coveUpdateWorker.test.ts +57 -0
- package/helpers/viewports.ts +2 -0
- package/package.json +27 -32
- package/styles/_global.scss +7 -7
- package/styles/_reset.scss +2 -2
- package/styles/{v2/base → base}/_file-selector.scss +4 -4
- package/styles/{v2/base → base}/_general.scss +2 -4
- package/styles/{v2/base → base}/index.scss +1 -1
- package/styles/base.scss +107 -165
- package/styles/cove-main.scss +3 -6
- package/styles/layout/_component.scss +110 -0
- package/styles/{v2/layout → layout}/_data-table.scss +7 -7
- package/styles/layout/_wrapper-padding.scss +27 -0
- package/styles/{v2/main.scss → main.scss} +3 -1
- package/styles/{v2/themes → themes}/_color-definitions.scss +46 -41
- package/styles/{_accessibility.scss → utils/_accessibility.scss} +1 -1
- package/styles/{v2/utils → utils}/_grid.scss +8 -3
- package/styles/{_global-variables.scss → utils/_properties.scss} +133 -112
- package/styles/{v2/utils → utils}/index.scss +2 -1
- package/types/Annotation.ts +10 -11
- package/types/Axis.ts +2 -0
- package/types/ComponentStyles.ts +1 -0
- package/types/ConfigureData.ts +1 -0
- package/types/General.ts +2 -0
- package/types/MarkupInclude.ts +1 -0
- package/types/MarkupVariable.ts +2 -1
- package/types/Palette.ts +22 -0
- package/types/Table.ts +9 -0
- package/types/Visualization.ts +7 -0
- package/_stories/StoryRenderingTests.stories.tsx +0 -164
- package/helpers/embedCodeGenerator.ts +0 -109
- package/styles/_common-components.css +0 -73
- package/styles/_variables.scss +0 -63
- package/styles/v2/layout/_component.scss +0 -21
- package/styles/v2/utils/_variables.scss +0 -9
- package/{styles/v2/components/card.scss → components/elements/card.css} +2 -2
- /package/{styles/v2/components → components/ui}/icon.scss +0 -0
- /package/{styles/v2/components → components/ui}/loadspin.scss +0 -0
- /package/styles/{v2/base → base}/_heading.scss +0 -0
- /package/styles/{v2/base → base}/_reset.scss +0 -0
- /package/styles/{v2/layout → layout}/_alert.scss +0 -0
- /package/styles/{v2/layout → layout}/_progression.scss +0 -0
- /package/styles/{v2/layout → layout}/_tooltip.scss +0 -0
- /package/styles/{v2/layout → layout}/index.scss +0 -0
- /package/styles/{v2/themes → themes}/index.scss +0 -0
- /package/styles/{v2/utils → utils}/_align.scss +0 -0
- /package/styles/{v2/utils → utils}/_animations.scss +0 -0
- /package/styles/{v2/utils → utils}/_breakpoints.scss +0 -0
- /package/styles/{v2/utils → utils}/_mixins.scss +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://vega.github.io/schema/vega-lite/v6.json",
|
|
3
|
+
"data": {
|
|
4
|
+
"values": [
|
|
5
|
+
{
|
|
6
|
+
"category": "A",
|
|
7
|
+
"position": 0,
|
|
8
|
+
"value": 0.1
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"category": "A",
|
|
12
|
+
"position": 1,
|
|
13
|
+
"value": 0.6
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"category": "A",
|
|
17
|
+
"position": 2,
|
|
18
|
+
"value": 0.9
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"category": "A",
|
|
22
|
+
"position": 3,
|
|
23
|
+
"value": 0.9
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"category": "B",
|
|
27
|
+
"position": 0,
|
|
28
|
+
"value": 0.7
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"category": "B",
|
|
32
|
+
"position": 1,
|
|
33
|
+
"value": 0.2
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"category": "B",
|
|
37
|
+
"position": 2,
|
|
38
|
+
"value": 1.1
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"category": "B",
|
|
42
|
+
"position": 3,
|
|
43
|
+
"value": 0.9
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"category": "C",
|
|
47
|
+
"position": 0,
|
|
48
|
+
"value": 0.6
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"category": "C",
|
|
52
|
+
"position": 1,
|
|
53
|
+
"value": 0.1
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"category": "C",
|
|
57
|
+
"position": 2,
|
|
58
|
+
"value": 0.2
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"category": "C",
|
|
62
|
+
"position": 3,
|
|
63
|
+
"value": 0.9
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"mark": "bar",
|
|
68
|
+
"encoding": {
|
|
69
|
+
"y": {
|
|
70
|
+
"field": "category"
|
|
71
|
+
},
|
|
72
|
+
"x": {
|
|
73
|
+
"field": "value",
|
|
74
|
+
"type": "quantitative"
|
|
75
|
+
},
|
|
76
|
+
"yOffset": {
|
|
77
|
+
"field": "position"
|
|
78
|
+
},
|
|
79
|
+
"color": {
|
|
80
|
+
"field": "position"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://vega.github.io/schema/vega/v5.json",
|
|
3
|
+
"description": "A basic grouped bar chart example.",
|
|
4
|
+
"width": 300,
|
|
5
|
+
"height": 240,
|
|
6
|
+
"padding": 5,
|
|
7
|
+
"data": [
|
|
8
|
+
{
|
|
9
|
+
"name": "table",
|
|
10
|
+
"values": [
|
|
11
|
+
{
|
|
12
|
+
"category": "A",
|
|
13
|
+
"position": 0,
|
|
14
|
+
"value": 0.1
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"category": "A",
|
|
18
|
+
"position": 1,
|
|
19
|
+
"value": 0.6
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"category": "A",
|
|
23
|
+
"position": 2,
|
|
24
|
+
"value": 0.9
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"category": "A",
|
|
28
|
+
"position": 3,
|
|
29
|
+
"value": 0.4
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"category": "B",
|
|
33
|
+
"position": 0,
|
|
34
|
+
"value": 0.7
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"category": "B",
|
|
38
|
+
"position": 1,
|
|
39
|
+
"value": 0.2
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"category": "B",
|
|
43
|
+
"position": 2,
|
|
44
|
+
"value": 1.1
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"category": "B",
|
|
48
|
+
"position": 3,
|
|
49
|
+
"value": 0.8
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"category": "C",
|
|
53
|
+
"position": 0,
|
|
54
|
+
"value": 0.6
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"category": "C",
|
|
58
|
+
"position": 1,
|
|
59
|
+
"value": 0.1
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"category": "C",
|
|
63
|
+
"position": 2,
|
|
64
|
+
"value": 0.2
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"category": "C",
|
|
68
|
+
"position": 3,
|
|
69
|
+
"value": 0.7
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"scales": [
|
|
75
|
+
{
|
|
76
|
+
"name": "yscale",
|
|
77
|
+
"type": "band",
|
|
78
|
+
"domain": {
|
|
79
|
+
"data": "table",
|
|
80
|
+
"field": "category"
|
|
81
|
+
},
|
|
82
|
+
"range": "height",
|
|
83
|
+
"padding": 0.2
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "xscale",
|
|
87
|
+
"type": "linear",
|
|
88
|
+
"domain": {
|
|
89
|
+
"data": "table",
|
|
90
|
+
"field": "value"
|
|
91
|
+
},
|
|
92
|
+
"range": "width",
|
|
93
|
+
"round": true,
|
|
94
|
+
"zero": true,
|
|
95
|
+
"nice": true
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "color",
|
|
99
|
+
"type": "ordinal",
|
|
100
|
+
"domain": {
|
|
101
|
+
"data": "table",
|
|
102
|
+
"field": "position"
|
|
103
|
+
},
|
|
104
|
+
"range": {
|
|
105
|
+
"scheme": "category20"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"axes": [
|
|
110
|
+
{
|
|
111
|
+
"orient": "left",
|
|
112
|
+
"scale": "yscale",
|
|
113
|
+
"tickSize": 0,
|
|
114
|
+
"labelPadding": 4,
|
|
115
|
+
"zindex": 1
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"orient": "bottom",
|
|
119
|
+
"scale": "xscale"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"marks": [
|
|
123
|
+
{
|
|
124
|
+
"type": "group",
|
|
125
|
+
"from": {
|
|
126
|
+
"facet": {
|
|
127
|
+
"data": "table",
|
|
128
|
+
"name": "facet",
|
|
129
|
+
"groupby": "category"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"encode": {
|
|
133
|
+
"enter": {
|
|
134
|
+
"y": {
|
|
135
|
+
"scale": "yscale",
|
|
136
|
+
"field": "category"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"signals": [
|
|
141
|
+
{
|
|
142
|
+
"name": "height",
|
|
143
|
+
"update": "bandwidth('yscale')"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"scales": [
|
|
147
|
+
{
|
|
148
|
+
"name": "pos",
|
|
149
|
+
"type": "band",
|
|
150
|
+
"range": "height",
|
|
151
|
+
"domain": {
|
|
152
|
+
"data": "facet",
|
|
153
|
+
"field": "position"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"marks": [
|
|
158
|
+
{
|
|
159
|
+
"name": "bars",
|
|
160
|
+
"from": {
|
|
161
|
+
"data": "facet"
|
|
162
|
+
},
|
|
163
|
+
"type": "rect",
|
|
164
|
+
"encode": {
|
|
165
|
+
"enter": {
|
|
166
|
+
"y": {
|
|
167
|
+
"scale": "pos",
|
|
168
|
+
"field": "position"
|
|
169
|
+
},
|
|
170
|
+
"height": {
|
|
171
|
+
"scale": "pos",
|
|
172
|
+
"band": 1
|
|
173
|
+
},
|
|
174
|
+
"x": {
|
|
175
|
+
"scale": "xscale",
|
|
176
|
+
"field": "value"
|
|
177
|
+
},
|
|
178
|
+
"x2": {
|
|
179
|
+
"scale": "xscale",
|
|
180
|
+
"value": 0
|
|
181
|
+
},
|
|
182
|
+
"fill": {
|
|
183
|
+
"scale": "color",
|
|
184
|
+
"field": "position"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"type": "text",
|
|
191
|
+
"from": {
|
|
192
|
+
"data": "bars"
|
|
193
|
+
},
|
|
194
|
+
"encode": {
|
|
195
|
+
"enter": {
|
|
196
|
+
"x": {
|
|
197
|
+
"field": "x2",
|
|
198
|
+
"offset": -5
|
|
199
|
+
},
|
|
200
|
+
"y": {
|
|
201
|
+
"field": "y",
|
|
202
|
+
"offset": {
|
|
203
|
+
"field": "height",
|
|
204
|
+
"mult": 0.5
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"fill": [
|
|
208
|
+
{
|
|
209
|
+
"test": "contrast('white', datum.fill) > contrast('black', datum.fill)",
|
|
210
|
+
"value": "white"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"value": "black"
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"align": {
|
|
217
|
+
"value": "right"
|
|
218
|
+
},
|
|
219
|
+
"baseline": {
|
|
220
|
+
"value": "middle"
|
|
221
|
+
},
|
|
222
|
+
"text": {
|
|
223
|
+
"field": "datum.value"
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
}
|