-
{title}
+
+
{title}
+ {showOptions && (
+
+ )}
+
{Content({
labels: ({ datum }) => datum.y || datum.x,
colorScale: colorScale as ColorScalePropType,
diff --git a/website/src/pages/themes/_config/axis.tsx b/website/src/pages/themes/_config/axis.tsx
index 83f258804..977245706 100644
--- a/website/src/pages/themes/_config/axis.tsx
+++ b/website/src/pages/themes/_config/axis.tsx
@@ -1,5 +1,5 @@
import { getBaseLabelsConfig, getBaseStrokeConfig } from "../_utils";
-import { StrokeProps } from "../_const";
+import { StrokeProps, VictoryComponentType } from "../_const";
import { ControlConfig } from ".";
import {
AxisExamples,
@@ -150,9 +150,10 @@ const axisOptionsConfig = {
description: "Customize the appearance of axes.",
selectLabel: "Axis Type",
types: {
- base: generalAxisOptionsConfig,
- polarAxis: polarAxisOptionsConfig,
- polarDependentAxis: polarDependentAxisOptionsConfig,
+ [VictoryComponentType.AXIS]: generalAxisOptionsConfig,
+ [VictoryComponentType.POLAR_AXIS]: polarAxisOptionsConfig,
+ [VictoryComponentType.POLAR_DEPENDENT_AXIS]:
+ polarDependentAxisOptionsConfig,
},
};
diff --git a/website/src/pages/themes/_config/chart.tsx b/website/src/pages/themes/_config/chart.tsx
index 5c50be22e..6eef98e57 100644
--- a/website/src/pages/themes/_config/chart.tsx
+++ b/website/src/pages/themes/_config/chart.tsx
@@ -4,7 +4,7 @@ import {
getNestedColorScaleConfig,
} from "../_utils";
import { ControlConfig } from ".";
-import { StrokeProps } from "../_const";
+import { VictoryComponentType, StrokeProps } from "../_const";
import {
AreaExamples,
BarExamples,
@@ -24,7 +24,7 @@ import {
const chartConfigs: {
[key: string]: ControlConfig;
} = {
- area: {
+ [VictoryComponentType.AREA]: {
type: "section",
label: "Area Chart",
content: AreaExamples,
@@ -59,7 +59,7 @@ const chartConfigs: {
},
],
},
- bar: {
+ [VictoryComponentType.BAR]: {
type: "section",
label: "Bar Chart",
content: BarExamples,
@@ -101,7 +101,7 @@ const chartConfigs: {
},
],
},
- boxPlot: {
+ [VictoryComponentType.BOX_PLOT]: {
type: "section",
label: "Box Plot",
content: BoxPlotExamples,
@@ -189,7 +189,7 @@ const chartConfigs: {
},
],
},
- candlestick: {
+ [VictoryComponentType.CANDLESTICK]: {
type: "section",
label: "Candlestick Chart",
content: CandlestickExamples,
@@ -242,7 +242,7 @@ const chartConfigs: {
},
],
},
- errorBar: {
+ [VictoryComponentType.ERROR_BAR]: {
type: "section",
label: "Error Bar",
content: ErrorBarExamples,
@@ -273,7 +273,7 @@ const chartConfigs: {
},
],
},
- histogram: {
+ [VictoryComponentType.HISTOGRAM]: {
type: "section",
label: "Histogram",
content: HistogramExamples,
@@ -319,7 +319,7 @@ const chartConfigs: {
},
],
},
- group: {
+ [VictoryComponentType.GROUP]: {
type: "section",
label: "Group",
content: GroupExamples,
@@ -341,7 +341,7 @@ const chartConfigs: {
},
],
},
- legend: {
+ [VictoryComponentType.LEGEND]: {
type: "section",
label: "Legend",
content: LegendExamples,
@@ -419,7 +419,7 @@ const chartConfigs: {
},
],
},
- line: {
+ [VictoryComponentType.LINE]: {
type: "section",
label: "Line Chart",
content: LineExamples,
@@ -441,7 +441,7 @@ const chartConfigs: {
},
],
},
- pie: {
+ [VictoryComponentType.PIE]: {
type: "section",
label: "Pie Chart",
content: PieExamples,
@@ -472,7 +472,7 @@ const chartConfigs: {
},
],
},
- scatter: {
+ [VictoryComponentType.SCATTER]: {
type: "section",
label: "Scatter Chart",
content: ScatterExamples,
@@ -507,7 +507,7 @@ const chartConfigs: {
},
],
},
- stack: {
+ [VictoryComponentType.STACK]: {
type: "section",
label: "Stack",
content: StackExamples,
@@ -529,7 +529,7 @@ const chartConfigs: {
},
],
},
- tooltip: {
+ [VictoryComponentType.TOOLTIP]: {
type: "section",
label: "Tooltip",
controls: [
@@ -580,7 +580,7 @@ const chartConfigs: {
},
],
},
- voronoi: {
+ [VictoryComponentType.VORONOI]: {
type: "section",
label: "Voronoi",
content: VoronoiExamples,
diff --git a/website/src/pages/themes/_const.tsx b/website/src/pages/themes/_const.tsx
index d5f992692..a98caf14c 100644
--- a/website/src/pages/themes/_const.tsx
+++ b/website/src/pages/themes/_const.tsx
@@ -65,3 +65,23 @@ export enum StrokeProps {
STROKE_LINE_CAP = "Stroke Line Cap",
STROKE_LINE_JOIN = "Stroke Line Join",
}
+
+export enum VictoryComponentType {
+ AREA = "area",
+ AXIS = "axis",
+ BAR = "bar",
+ BOX_PLOT = "boxPlot",
+ CANDLESTICK = "candlestick",
+ ERROR_BAR = "errorBar",
+ HISTOGRAM = "histogram",
+ GROUP = "group",
+ LEGEND = "legend",
+ LINE = "line",
+ PIE = "pie",
+ POLAR_AXIS = "polarAxis",
+ POLAR_DEPENDENT_AXIS = "polarDependentAxis",
+ SCATTER = "scatter",
+ STACK = "stack",
+ TOOLTIP = "tooltip",
+ VORONOI = "voronoi",
+}
diff --git a/website/src/pages/themes/_icons/axis-options-icon.tsx b/website/src/pages/themes/_icons/axis-options-icon.tsx
new file mode 100644
index 000000000..c32eda722
--- /dev/null
+++ b/website/src/pages/themes/_icons/axis-options-icon.tsx
@@ -0,0 +1,23 @@
+import React from "react";
+
+const AxisOptionsIcon = ({ className, ...props }) => {
+ return (
+
+ );
+};
+export default AxisOptionsIcon;
diff --git a/website/src/pages/themes/_icons/chart-options-icon.tsx b/website/src/pages/themes/_icons/chart-options-icon.tsx
new file mode 100644
index 000000000..82f6379c7
--- /dev/null
+++ b/website/src/pages/themes/_icons/chart-options-icon.tsx
@@ -0,0 +1,25 @@
+import React from "react";
+
+const ChartOptionsIcon = ({ className, ...props }) => (
+
+);
+
+export default ChartOptionsIcon;
diff --git a/website/src/pages/themes/_icons/export-icon.tsx b/website/src/pages/themes/_icons/export-icon.tsx
new file mode 100644
index 000000000..f903c9072
--- /dev/null
+++ b/website/src/pages/themes/_icons/export-icon.tsx
@@ -0,0 +1,22 @@
+import React from "react";
+
+const ExportIcon = ({ className, ...props }) => {
+ return (
+
+ );
+};
+export default ExportIcon;
diff --git a/website/src/pages/themes/_icons/index.tsx b/website/src/pages/themes/_icons/index.tsx
new file mode 100644
index 000000000..4575afcba
--- /dev/null
+++ b/website/src/pages/themes/_icons/index.tsx
@@ -0,0 +1,3 @@
+export { default as ChartOptionsIcon } from "./chart-options-icon";
+export { default as AxisOptionsIcon } from "./axis-options-icon";
+export { default as ExportIcon } from "./export-icon";
diff --git a/website/src/pages/themes/_providers/previewOptionsProvider.tsx b/website/src/pages/themes/_providers/previewOptionsProvider.tsx
index fa1e22e7d..cf34384f1 100644
--- a/website/src/pages/themes/_providers/previewOptionsProvider.tsx
+++ b/website/src/pages/themes/_providers/previewOptionsProvider.tsx
@@ -1,14 +1,19 @@
import React, { createContext, useContext } from "react";
import { AllExamples, ExampleConfig } from "../_components/examples";
+import { VictoryComponentType } from "../_const";
type PreviewOptionsContextType = {
colorScale?: string;
updateColorScale: (newColorScale?: string) => void;
showTooltips: boolean;
- setShowTooltips: (showTooltips: boolean) => void;
+ setShowTooltips: React.Dispatch
>;
resetPreviewOptions: () => void;
exampleContent: ExampleConfig[];
- setExampleContent: (content: ExampleConfig[]) => void;
+ setExampleContent: React.Dispatch>;
+ activeChartType: VictoryComponentType | null;
+ setActiveChartType: React.Dispatch<
+ React.SetStateAction
+ >;
};
export const defaultColorScale = undefined;
@@ -23,6 +28,8 @@ export const PreviewOptionsProvider = ({ children }) => {
defaultColorScale,
);
const [showTooltips, setShowTooltips] = React.useState(defaultShowTooltips);
+ const [activeChartType, setActiveChartType] =
+ React.useState(null);
const [exampleContent, setExampleContent] = React.useState(AllExamples);
const updateColorScale = (newColorScale?: string) => {
@@ -45,6 +52,8 @@ export const PreviewOptionsProvider = ({ children }) => {
resetPreviewOptions,
exampleContent,
setExampleContent,
+ activeChartType,
+ setActiveChartType,
}}
>
{children}