Skip to content

Commit

Permalink
Merge branch 'panalyt' into feat/allow_passing_label_as_prop
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbalonperin committed Jun 8, 2024
2 parents 51127ed + a641abb commit dc1b05e
Show file tree
Hide file tree
Showing 11 changed files with 106 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<br />
<br />
<h2>WARNING: This is a fork of the Tremor library that can be found at: https://github.com/tremorlabs/tremor</h2>
<p>This fork is intended to be used at Panalyt until the pending PRs that resolves some of the necessary items for Panalyt are merged</p>
<p align="center">
<a href="https://tremor.so">
<picture>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tremor/react",
"name": "@abalonperin/tremor",
"version": "0.0.0-development",
"description": "The React library to build dashboards faster.",
"description": "A fork of the Tremor library",
"scripts": {
"prebuild": "rm -rf dist",
"build": "rollup -c",
Expand All @@ -15,10 +15,10 @@
},
"repository": {
"type": "git",
"url": "https://github.com/tremorlabs/tremor.git"
"url": "git+https://github.com/tremorlabs/tremor.git"
},
"author": "tremor",
"license": "Apache 2.0",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/tremorlabs/tremor/issues"
},
Expand Down
17 changes: 15 additions & 2 deletions src/components/chart-elements/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
showTooltip = true,
showLegend = true,
showGridLines = true,
showAxisLine = false,
showGradient = true,
autoMinValue = false,
curveType = "linear",
Expand Down Expand Up @@ -189,10 +190,16 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
interval={startEndOnly ? "preserveStartEnd" : intervalType}
tickLine={false}
axisLine={false}
axisLine={showAxisLine}
minTickGap={tickGap}
angle={rotateLabelX?.angle}
dy={rotateLabelX?.verticalShift}
Expand All @@ -211,7 +218,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showAxisLine}
tickLine={false}
type="number"
domain={yAxisDomain as AxisDomain}
Expand All @@ -225,6 +232,12 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickFormatter={valueFormatter}
allowDecimals={allowDecimals}
Expand Down
33 changes: 29 additions & 4 deletions src/components/chart-elements/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
showTooltip = true,
showLegend = true,
showGridLines = true,
showAxisLine = false,
autoMinValue = false,
minValue,
maxValue,
Expand Down Expand Up @@ -203,9 +204,15 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
axisLine={false}
axisLine={showAxisLine}
angle={rotateLabelX?.angle}
dy={rotateLabelX?.verticalShift}
height={rotateLabelX?.xAxisHeight}
Expand Down Expand Up @@ -236,9 +243,15 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
axisLine={false}
axisLine={showAxisLine}
tickFormatter={valueFormatter}
minTickGap={tickGap}
allowDecimals={allowDecimals}
Expand All @@ -261,7 +274,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showAxisLine}
tickLine={false}
type="number"
domain={yAxisDomain as AxisDomain}
Expand All @@ -275,6 +288,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickFormatter={
relative ? (value: number) => `${(value * 100).toString()} %` : valueFormatter
Expand All @@ -298,7 +317,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
width={yAxisWidth}
hide={!showYAxis}
dataKey={index}
axisLine={false}
axisLine={showAxisLine}
tickLine={false}
ticks={startEndOnly ? [data[0][index], data[data.length - 1][index]] : undefined}
type="category"
Expand All @@ -313,6 +332,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
>
{yAxisLabel && (
Expand Down
17 changes: 15 additions & 2 deletions src/components/chart-elements/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
showTooltip = true,
showLegend = true,
showGridLines = true,
showAxisLine = false,
autoMinValue = false,
curveType = "linear",
minValue,
Expand Down Expand Up @@ -186,9 +187,15 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
axisLine={false}
axisLine={showAxisLine}
minTickGap={tickGap}
angle={rotateLabelX?.angle}
dy={rotateLabelX?.verticalShift}
Expand All @@ -207,7 +214,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showAxisLine}
tickLine={false}
type="number"
domain={yAxisDomain as AxisDomain}
Expand All @@ -221,6 +228,12 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickFormatter={valueFormatter}
allowDecimals={allowDecimals}
Expand Down
18 changes: 16 additions & 2 deletions src/components/chart-elements/ScatterChart/ScatterChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface ScatterChartProps
showTooltip?: boolean;
showLegend?: boolean;
showGridLines?: boolean;
showAxisLine?: boolean;
autoMinXValue?: boolean;
minXValue?: number;
maxXValue?: number;
Expand Down Expand Up @@ -129,6 +130,7 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
showTooltip = true,
showLegend = true,
showGridLines = true,
showAxisLine = false,
autoMinXValue = false,
minXValue,
maxXValue,
Expand Down Expand Up @@ -246,10 +248,16 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
tickLine={false}
tickFormatter={valueFormatter.x}
axisLine={false}
axisLine={showAxisLine}
minTickGap={tickGap}
domain={xAxisDomain as AxisDomain}
allowDataOverflow={true}
Expand All @@ -272,7 +280,7 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
<YAxis
width={yAxisWidth}
hide={!showYAxis}
axisLine={false}
axisLine={showAxisLine}
tickLine={false}
dataKey={y}
type="number"
Expand All @@ -289,6 +297,12 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
"fill-tremor-content",
// dark
"dark:fill-dark-tremor-content",
// common
"stroke-1",
// light
"stroke-tremor-border",
// dark
"dark:stroke-dark-tremor-border",
)}
allowDecimals={allowDecimals}
allowDataOverflow={true}
Expand Down
1 change: 1 addition & 0 deletions src/components/chart-elements/common/BaseChartProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface BaseChartProps extends BaseAnimationTimingProps, React.HTMLAttributes<
showTooltip?: boolean;
showLegend?: boolean;
showGridLines?: boolean;
showAxisLine?: boolean;
autoMinValue?: boolean;
minValue?: number;
maxValue?: number;
Expand Down
6 changes: 6 additions & 0 deletions src/stories/chart-elements/AreaChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,10 @@ export const DataLabelsFunction: Story = {
args: {
renderLabel: renderCustomizedLabel,
},
}

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};
6 changes: 6 additions & 0 deletions src/stories/chart-elements/BarChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,10 @@ export const DataLabelsFunction: Story = {
args: {
renderLabel: renderCustomizedLabel,
},
}

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};
6 changes: 6 additions & 0 deletions src/stories/chart-elements/LineChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,4 +349,10 @@ export const DataLabelsFunction: Story = {
args: {
renderLabel: renderCustomizedLabel,
},
}

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};
6 changes: 6 additions & 0 deletions src/stories/chart-elements/ScatterChart.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,9 @@ export const AxisLabels: Story = {
yAxisLabel: "Amount (USD)",
},
};

export const ShowAxisLine: Story = {
args: {
showAxisLine: true,
},
};

0 comments on commit dc1b05e

Please sign in to comment.