Skip to content

Commit

Permalink
feat: add bar, candlestick, and error bar chart controls (#2974)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramenhog authored Nov 18, 2024
1 parent 8d7c0bf commit 41c7de6
Show file tree
Hide file tree
Showing 7 changed files with 355 additions and 102 deletions.
2 changes: 1 addition & 1 deletion demo/ts/components/theme-builder/config-mapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ControlComponent = ({
updateThemeConfig(field.path, newValue);
};

const configValue = getConfigValue(themeConfig, field.path);
const configValue = getConfigValue(themeConfig, field.path, field.default);
switch (type) {
case "colorScale":
return (
Expand Down
31 changes: 16 additions & 15 deletions demo/ts/components/theme-builder/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ConfigPreview from "./config-preview";
import Button from "./button";
import ConfigMapper from "./config-mapper";
import { setNestedConfigValue } from "./utils";
import optionsConfig from "./options-config";

export type ThemeOption = {
name: string;
Expand Down Expand Up @@ -190,21 +191,21 @@ const ThemeBuilder = () => {
</VictoryStack>
</VictoryChart>
</div>
<div>
<h3 className="text-base font-bold mb-3">Area Chart</h3>
<VictoryChart
theme={customThemeConfig}
domainPadding={20}
style={chartStyle}
>
<VictoryAxis label="X Axis" />
<VictoryAxis dependentAxis label="Y Axis" />
<VictoryArea
data={sampleStackData}
labels={({ datum }) => datum.y}
/>
</VictoryChart>
</div>
{optionsConfig.map(
({ title, content: Content }, i) =>
Content && (
<div key={i}>
<h3 className="text-base font-bold mb-3">{title}</h3>
<VictoryChart
theme={customThemeConfig}
domainPadding={20}
style={chartStyle}
>
{Content({ labels: ({ datum }) => datum.y })}
</VictoryChart>
</div>
),
)}
</div>
</div>
)}
Expand Down
81 changes: 0 additions & 81 deletions demo/ts/components/theme-builder/options-config.ts

This file was deleted.

Loading

0 comments on commit 41c7de6

Please sign in to comment.