Skip to content

Commit 41c7de6

Browse files
authoredNov 18, 2024
feat: add bar, candlestick, and error bar chart controls (#2974)
1 parent 8d7c0bf commit 41c7de6

File tree

7 files changed

+355
-102
lines changed

7 files changed

+355
-102
lines changed
 

‎demo/ts/components/theme-builder/config-mapper.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const ControlComponent = ({
2727
updateThemeConfig(field.path, newValue);
2828
};
2929

30-
const configValue = getConfigValue(themeConfig, field.path);
30+
const configValue = getConfigValue(themeConfig, field.path, field.default);
3131
switch (type) {
3232
case "colorScale":
3333
return (

‎demo/ts/components/theme-builder/index.tsx

+16-15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ConfigPreview from "./config-preview";
1616
import Button from "./button";
1717
import ConfigMapper from "./config-mapper";
1818
import { setNestedConfigValue } from "./utils";
19+
import optionsConfig from "./options-config";
1920

2021
export type ThemeOption = {
2122
name: string;
@@ -190,21 +191,21 @@ const ThemeBuilder = () => {
190191
</VictoryStack>
191192
</VictoryChart>
192193
</div>
193-
<div>
194-
<h3 className="text-base font-bold mb-3">Area Chart</h3>
195-
<VictoryChart
196-
theme={customThemeConfig}
197-
domainPadding={20}
198-
style={chartStyle}
199-
>
200-
<VictoryAxis label="X Axis" />
201-
<VictoryAxis dependentAxis label="Y Axis" />
202-
<VictoryArea
203-
data={sampleStackData}
204-
labels={({ datum }) => datum.y}
205-
/>
206-
</VictoryChart>
207-
</div>
194+
{optionsConfig.map(
195+
({ title, content: Content }, i) =>
196+
Content && (
197+
<div key={i}>
198+
<h3 className="text-base font-bold mb-3">{title}</h3>
199+
<VictoryChart
200+
theme={customThemeConfig}
201+
domainPadding={20}
202+
style={chartStyle}
203+
>
204+
{Content({ labels: ({ datum }) => datum.y })}
205+
</VictoryChart>
206+
</div>
207+
),
208+
)}
208209
</div>
209210
</div>
210211
)}

‎demo/ts/components/theme-builder/options-config.ts

-81
This file was deleted.

0 commit comments

Comments
 (0)