MCPcopy Create free account
hub / github.com/outerbase/studio / ChartYAxisSection

Function ChartYAxisSection

src/components/chart/chart-y-axis-section.tsx:18–113  ·  view source on GitHub ↗
({
  value,
  onChange,
  isNotChartComponent,
  columns,
}: ChartYAxisSectionProps)

Source from the content-addressed store, hash-verified

16}
17
18export default function ChartYAxisSection({
19 value,
20 onChange,
21 isNotChartComponent,
22 columns,
23}: ChartYAxisSectionProps) {
24 const selectYAxisDisplay = useMemo(() => {
25 if (isNotChartComponent) return null;
26
27 return (
28 <div>
29 <Select
30 size="lg"
31 options={[
32 {
33 value: "Left",
34 label: "Left",
35 },
36 {
37 value: "Right",
38 label: "Right",
39 },
40 {
41 value: "Hidden",
42 label: "Hidden",
43 },
44 ]}
45 setValue={function (value: string): void {
46 onChange((prev) => {
47 return produce(prev, (draft) => {
48 draft.params.options.yAxisLabelDisplay =
49 value.toLowerCase() as ChartLabelDisplayY;
50 });
51 });
52 }}
53 value={capitalizeFirstChar(
54 value.params.options?.yAxisLabelDisplay ?? "left"
55 )}
56 />
57 </div>
58 );
59 }, [isNotChartComponent, onChange, value.params.options?.yAxisLabelDisplay]);
60
61 return (
62 <div>
63 <p className="mb-1.5 text-sm font-bold opacity-70">Y Axis</p>
64 <div className="flex items-center justify-between gap-2">
65 <SimpleInput
66 value={value.params.options?.yAxisLabel}
67 placeholder={
68 value.params.options?.yAxisKeys?.length > 0
69 ? value.params.options?.yAxisKeys[0]
70 : "Y Axis Label"
71 }
72 onSumit={(v) => {
73 onChange((prev) => {
74 return produce(prev, (draft) => {
75 draft.params.options.yAxisLabel = v === "" ? undefined : v;

Callers

nothing calls this directly

Calls 1

capitalizeFirstCharFunction · 0.90

Tested by

no test coverage detected