Skip to content

Commit d84b722

Browse files
committed
Use full dataset for markup variables
1 parent 75cd387 commit d84b722

File tree

5 files changed

+156
-3
lines changed

5 files changed

+156
-3
lines changed

packages/core/components/EditorPanel/components/PanelMarkup.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ type PanelMarkupProps = {
1010
markupVariables: MarkupVariable[]
1111
/** Dataset to extract column names and values from */
1212
data: any[]
13+
/** Optional unfiltered data source to prefer for editor mapping options */
14+
editorData?: any[]
1315
/** Whether markup variables feature is enabled */
1416
enableMarkupVariables: boolean
1517
/** Callback when variables are added, updated, or removed */
@@ -30,16 +32,19 @@ const PanelMarkup: React.FC<PanelMarkupProps> = ({
3032
name,
3133
markupVariables,
3234
data,
35+
editorData,
3336
enableMarkupVariables,
3437
onMarkupVariablesChange,
3538
onToggleEnable,
3639
withAccordion = true,
3740
dataMetadata
3841
}) => {
42+
const sourceData = Array.isArray(editorData) && editorData.length ? editorData : data
43+
3944
const content = (
4045
<MarkupVariablesEditor
4146
markupVariables={markupVariables || []}
42-
data={data}
47+
data={sourceData}
4348
onChange={onMarkupVariablesChange}
4449
enableMarkupVariables={enableMarkupVariables || false}
4550
onToggleEnable={onToggleEnable}
@@ -60,4 +65,4 @@ const PanelMarkup: React.FC<PanelMarkupProps> = ({
6065
)
6166
}
6267

63-
export default PanelMarkup
68+
export default PanelMarkup

packages/core/helpers/tests/testStandaloneBuild.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { promisify } from 'node:util'
66

77
const execAsync = promisify(exec)
88

9-
109
function copyDirSync(src, dest) {
1110
fs.mkdirSync(dest, { recursive: true })
1211
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
{
2+
"type": "data-bite",
3+
"dataBite": "",
4+
"dataFunction": "Mean (Average)",
5+
"dataColumn": "Rate",
6+
"bitePosition": "Left",
7+
"biteFontSize": 24,
8+
"fontSize": "medium",
9+
"biteBody": "",
10+
"imageData": {
11+
"display": "none",
12+
"url": "",
13+
"alt": "",
14+
"options": []
15+
},
16+
"dataFormat": {
17+
"roundToPlace": 0,
18+
"commas": true,
19+
"prefix": "",
20+
"suffix": "%"
21+
},
22+
"biteStyle": "tp5",
23+
"filters": [],
24+
"subtext": "",
25+
"title": "",
26+
"theme": "theme-blue",
27+
"shadow": false,
28+
"visual": {
29+
"border": true,
30+
"accent": false,
31+
"background": false,
32+
"hideBackgroundColor": false,
33+
"borderColorTheme": false,
34+
"showTitle": true,
35+
"useWrap": false
36+
},
37+
"general": {
38+
"palette": {
39+
"version": "1.0",
40+
"backups": [
41+
{
42+
"name": "__​undefined__",
43+
"version": "1.0",
44+
"isReversed": "__​undefined__"
45+
}
46+
]
47+
},
48+
"isCompactStyle": false
49+
},
50+
"trendIndicator": {
51+
"mode": "numeric",
52+
"column": "oldrate",
53+
"numericRules": {
54+
"upThreshold": 0,
55+
"downThreshold": 0
56+
},
57+
"mappings": []
58+
},
59+
"markupVariables": [],
60+
"enableMarkupVariables": false,
61+
"errors": [],
62+
"currentViewport": "lg",
63+
"id": 16,
64+
"category": "General",
65+
"label": "Data Bite",
66+
"subType": null,
67+
"orientation": null,
68+
"icon": {
69+
"type": {},
70+
"key": null,
71+
"ref": null,
72+
"props": {},
73+
"_owner": null,
74+
"_store": {}
75+
},
76+
"content": "Highlight a single aggregated value (e.g., sum or median).",
77+
"visualizationType": null,
78+
"activeVizButtonID": 16,
79+
"dataMetadata": {
80+
"lastUpdated": "January 15, 2026",
81+
"source": "CDC NREVSS"
82+
},
83+
"dataFileName": "./data-with-metadata.json",
84+
"dataFileSourceType": "file",
85+
"dataDescription": {
86+
"horizontal": false,
87+
"series": false
88+
},
89+
"version": "4.26.4",
90+
"migrations": {
91+
"addColorMigration": true
92+
},
93+
"locale": "en-US",
94+
"data": [
95+
{
96+
"STATE": "AL",
97+
"Rate": "10",
98+
"Location": "Home",
99+
"oldrate": "7"
100+
},
101+
{
102+
"STATE": "AK",
103+
"Rate": "12",
104+
"Location": "Home",
105+
"oldrate": "13"
106+
},
107+
{
108+
"STATE": "FL",
109+
"Rate": "10",
110+
"Location": "Work",
111+
"oldrate": "10"
112+
},
113+
{
114+
"STATE": "GA",
115+
"Rate": "12",
116+
"Location": "Work",
117+
"oldrate": "11"
118+
}
119+
],
120+
"formattedData": [
121+
{
122+
"STATE": "AL",
123+
"Rate": "10",
124+
"Location": "Home",
125+
"oldrate": "7"
126+
},
127+
{
128+
"STATE": "AK",
129+
"Rate": "12",
130+
"Location": "Home",
131+
"oldrate": "13"
132+
},
133+
{
134+
"STATE": "FL",
135+
"Rate": "10",
136+
"Location": "Work",
137+
"oldrate": "10"
138+
},
139+
{
140+
"STATE": "GA",
141+
"Rate": "12",
142+
"Location": "Work",
143+
"oldrate": "11"
144+
}
145+
],
146+
"datasets": {}
147+
}

packages/data-bite/src/components/EditorPanel/EditorPanel.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ const EditorPanel: React.FC<DataBiteEditorPanelProps> = () => {
742742
name='Markup Variables'
743743
markupVariables={config.markupVariables || []}
744744
data={data}
745+
editorData={editorData}
745746
enableMarkupVariables={config.enableMarkupVariables || false}
746747
onMarkupVariablesChange={variables => updateField(null, null, 'markupVariables', variables)}
747748
onToggleEnable={enabled => updateField(null, null, 'enableMarkupVariables', enabled)}

packages/waffle-chart/src/components/EditorPanel.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ const EditorPanel = memo(props => {
618618
name='Markup Variables'
619619
markupVariables={config.markupVariables || []}
620620
data={data}
621+
editorData={editorData}
621622
enableMarkupVariables={config.enableMarkupVariables || false}
622623
onMarkupVariablesChange={variables => updateField(null, null, 'markupVariables', variables)}
623624
onToggleEnable={enabled => updateField(null, null, 'enableMarkupVariables', enabled)}

0 commit comments

Comments
 (0)