Skip to content

Commit

Permalink
add no gridlines
Browse files Browse the repository at this point in the history
  • Loading branch information
severinlandolt committed May 17, 2024
1 parent dfcab08 commit cb25af5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ interface LineChartProps extends React.HTMLAttributes<HTMLDivElement> {
startEndOnly?: boolean
showXAxis?: boolean
showYAxis?: boolean
showGridLines?: boolean
yAxisWidth?: number
intervalType?: "preserveStartEnd" | "equidistantPreserveStart"
showTooltip?: boolean
Expand Down Expand Up @@ -504,6 +505,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>(
startEndOnly = false,
showXAxis = true,
showYAxis = true,
showGridLines = true,
yAxisWidth = 56,
intervalType = "equidistantPreserveStart",
showTooltip = true,
Expand Down Expand Up @@ -603,11 +605,13 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>(
top: 0,
}}
>
<CartesianGrid
className={cx("stroke-gray-200 stroke-1 dark:stroke-gray-800")}
horizontal={true}
vertical={false}
/>
{showGridLines ? (
<CartesianGrid
className={cx("stroke-gray-200 stroke-1 dark:stroke-gray-800")}
horizontal={true}
vertical={false}
/>
) : null}
<XAxis
padding={{ left: paddingValue, right: paddingValue }}
hide={!showXAxis}
Expand Down
6 changes: 6 additions & 0 deletions src/components/LineChart/linechart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ export const WithNoAxis: Story = {
},
}

export const WithNoGridlines: Story = {
args: {
showGridLines: false,
},
}

export const WithNoLegend: Story = {
args: {
showLegend: false,
Expand Down

0 comments on commit cb25af5

Please sign in to comment.