Skip to content

Commit

Permalink
Fix: Expose show axis lines on line, bar, scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
thesergsb committed Jul 24, 2024
1 parent b0d209c commit aef1cbf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/components/chart-elements/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
startEndOnly = false,
showXAxis = true,
showYAxis = true,
showXAxisLine = false,
showYAxisLine = false,
yAxisWidth = 56,
intervalType = "equidistantPreserveStart",
showAnimation = false,
Expand Down Expand Up @@ -195,7 +197,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
)}
interval={startEndOnly ? "preserveStartEnd" : intervalType}
tickLine={false}
axisLine={false}
axisLine={showXAxis && showXAxisLine}
minTickGap={tickGap}
angle={rotateLabelX?.angle}
dy={rotateLabelX?.verticalShift}
Expand Down Expand Up @@ -246,7 +248,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showYAxis && showYAxisLine}
tickLine={false}
type="number"
domain={yAxisDomain as AxisDomain}
Expand Down
10 changes: 6 additions & 4 deletions src/components/chart-elements/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
showAnimation = false,
showXAxis = true,
showYAxis = true,
showXAxisLine = false,
showYAxisLine = false,
yAxisWidth = 56,
intervalType = "equidistantPreserveStart",
showTooltip = true,
Expand Down Expand Up @@ -205,7 +207,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"dark:fill-dark-tremor-content",
)}
tickLine={false}
axisLine={false}
axisLine={showXAxis && showXAxisLine}
angle={rotateLabelX?.angle}
dy={rotateLabelX?.verticalShift}
height={rotateLabelX?.xAxisHeight}
Expand Down Expand Up @@ -238,7 +240,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"dark:fill-dark-tremor-content",
)}
tickLine={false}
axisLine={false}
axisLine={showXAxis && showXAxisLine}
tickFormatter={valueFormatter}
minTickGap={tickGap}
allowDecimals={allowDecimals}
Expand All @@ -261,7 +263,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showYAxis && showYAxisLine}
tickLine={false}
type="number"
domain={yAxisDomain as AxisDomain}
Expand Down Expand Up @@ -298,7 +300,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
width={yAxisWidth}
hide={!showYAxis}
dataKey={index}
axisLine={false}
axisLine={showYAxis && showYAxisLine}
tickLine={false}
ticks={startEndOnly ? [data[0][index], data[data.length - 1][index]] : undefined}
type="category"
Expand Down
8 changes: 5 additions & 3 deletions src/components/chart-elements/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
startEndOnly = false,
showXAxis = true,
showYAxis = true,
showXAxisLine = false,
showYAxisLine = false,
yAxisWidth = 56,
intervalType = "equidistantPreserveStart",
animationDuration = 900,
Expand Down Expand Up @@ -190,7 +192,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
"dark:fill-dark-tremor-content",
)}
tickLine={false}
axisLine={false}
axisLine={showXAxis && showXAxisLine}
minTickGap={tickGap}
angle={rotateLabelX?.angle}
dy={rotateLabelX?.verticalShift}
Expand All @@ -201,7 +203,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showYAxis && showYAxisLine}
tickLine={false}
type="number"
domain={yAxisDomain as AxisDomain}
Expand Down Expand Up @@ -241,7 +243,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showYAxis && showYAxisLine}
tickLine={false}
type="number"
domain={yAxisDomain as AxisDomain}
Expand Down
8 changes: 6 additions & 2 deletions src/components/chart-elements/ScatterChart/ScatterChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export interface ScatterChartProps
startEndOnly?: boolean;
showXAxis?: boolean;
showYAxis?: boolean;
showXAxisLine?: boolean;
showYAxisLine?: boolean;
yAxisWidth?: number;
intervalType?: IntervalType;
showTooltip?: boolean;
Expand Down Expand Up @@ -124,6 +126,8 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
startEndOnly = false,
showXAxis = true,
showYAxis = true,
showXAxisLine = false,
showYAxisLine = false,
yAxisWidth = 56,
intervalType = "equidistantPreserveStart",
animationDuration = 900,
Expand Down Expand Up @@ -252,7 +256,7 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
)}
tickLine={false}
tickFormatter={valueFormatter.x}
axisLine={false}
axisLine={showXAxis && showXAxisLine}
minTickGap={tickGap}
domain={xAxisDomain as AxisDomain}
allowDataOverflow={true}
Expand All @@ -275,7 +279,7 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showYAxis && showYAxisLine}
tickLine={false}
dataKey={y}
type="number"
Expand Down
2 changes: 2 additions & 0 deletions src/components/chart-elements/common/BaseChartProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ interface BaseChartProps extends BaseAnimationTimingProps, React.HTMLAttributes<
startEndOnly?: boolean;
showXAxis?: boolean;
showYAxis?: boolean;
showXAxisLine?: boolean;
showYAxisLine?: boolean;
yAxisWidth?: number;
intervalType?: IntervalType;
showTooltip?: boolean;
Expand Down

0 comments on commit aef1cbf

Please sign in to comment.