Skip to content

Commit 68f8700

Browse files
Merge branch 'panalyt' into feat/xaxis_padding_prop
2 parents b1429ff + bce4fa0 commit 68f8700

File tree

13 files changed

+251
-15
lines changed

13 files changed

+251
-15
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<br />
22
<br />
3+
<h2>WARNING: This is a fork of the Tremor library that can be found at: https://github.com/tremorlabs/tremor</h2>
4+
<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>
35
<p align="center">
46
<a href="https://tremor.so">
57
<picture>

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@tremor/react",
3-
"version": "0.0.0-development",
4-
"description": "The React library to build dashboards faster.",
2+
"name": "@abalonperin/tremor",
3+
"version": "0.0.1-development",
4+
"description": "A fork of the Tremor library",
55
"scripts": {
66
"prebuild": "rm -rf dist",
77
"build": "rollup -c",
@@ -15,10 +15,10 @@
1515
},
1616
"repository": {
1717
"type": "git",
18-
"url": "https://github.com/tremorlabs/tremor.git"
18+
"url": "git+https://github.com/tremorlabs/tremor.git"
1919
},
2020
"author": "tremor",
21-
"license": "Apache 2.0",
21+
"license": "Apache-2.0",
2222
"bugs": {
2323
"url": "https://github.com/tremorlabs/tremor/issues"
2424
},

src/components/chart-elements/AreaChart/AreaChart.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
6565
showTooltip = true,
6666
showLegend = true,
6767
showGridLines = true,
68+
showAxisLine = false,
6869
showGradient = true,
6970
autoMinValue = false,
7071
curveType = "linear",
@@ -77,6 +78,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
7778
onValueChange,
7879
enableLegendSlider = false,
7980
customTooltip,
81+
renderLabel,
8082
rotateLabelX,
8183
tickGap = 5,
8284
xAxisLabel,
@@ -190,10 +192,16 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
190192
"fill-tremor-content",
191193
// dark
192194
"dark:fill-dark-tremor-content",
195+
// common
196+
"stroke-1",
197+
// light
198+
"stroke-tremor-border",
199+
// dark
200+
"dark:stroke-dark-tremor-border",
193201
)}
194202
interval={startEndOnly ? "preserveStartEnd" : intervalType}
195203
tickLine={false}
196-
axisLine={false}
204+
axisLine={showAxisLine}
197205
minTickGap={tickGap}
198206
angle={rotateLabelX?.angle}
199207
dy={rotateLabelX?.verticalShift}
@@ -212,7 +220,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
212220
<YAxis
213221
width={yAxisWidth}
214222
hide={!showYAxis}
215-
axisLine={false}
223+
axisLine={showAxisLine}
216224
tickLine={false}
217225
type="number"
218226
domain={yAxisDomain as AxisDomain}
@@ -226,6 +234,12 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
226234
"fill-tremor-content",
227235
// dark
228236
"dark:fill-dark-tremor-content",
237+
// common
238+
"stroke-1",
239+
// light
240+
"stroke-tremor-border",
241+
// dark
242+
"dark:stroke-dark-tremor-border",
229243
)}
230244
tickFormatter={valueFormatter}
231245
allowDecimals={allowDecimals}
@@ -430,6 +444,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
430444
animationDuration={animationDuration}
431445
stackId={stack ? "a" : undefined}
432446
connectNulls={connectNulls}
447+
label={renderLabel}
433448
/>
434449
))}
435450
{onValueChange

src/components/chart-elements/BarChart/BarChart.tsx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
8484
showTooltip = true,
8585
showLegend = true,
8686
showGridLines = true,
87+
showAxisLine = false,
8788
autoMinValue = false,
8889
minValue,
8990
maxValue,
@@ -92,6 +93,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
9293
onValueChange,
9394
enableLegendSlider = false,
9495
customTooltip,
96+
renderLabel,
9597
rotateLabelX,
9698
barCategoryGap,
9799
tickGap = 5,
@@ -203,9 +205,15 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
203205
"fill-tremor-content",
204206
// dark
205207
"dark:fill-dark-tremor-content",
208+
// common
209+
"stroke-1",
210+
// light
211+
"stroke-tremor-border",
212+
// dark
213+
"dark:stroke-dark-tremor-border",
206214
)}
207215
tickLine={false}
208-
axisLine={false}
216+
axisLine={showAxisLine}
209217
angle={rotateLabelX?.angle}
210218
dy={rotateLabelX?.verticalShift}
211219
height={rotateLabelX?.xAxisHeight}
@@ -236,9 +244,15 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
236244
"fill-tremor-content",
237245
// dark
238246
"dark:fill-dark-tremor-content",
247+
// common
248+
"stroke-1",
249+
// light
250+
"stroke-tremor-border",
251+
// dark
252+
"dark:stroke-dark-tremor-border",
239253
)}
240254
tickLine={false}
241-
axisLine={false}
255+
axisLine={showAxisLine}
242256
tickFormatter={valueFormatter}
243257
minTickGap={tickGap}
244258
allowDecimals={allowDecimals}
@@ -261,7 +275,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
261275
<YAxis
262276
width={yAxisWidth}
263277
hide={!showYAxis}
264-
axisLine={false}
278+
axisLine={showAxisLine}
265279
tickLine={false}
266280
type="number"
267281
domain={yAxisDomain as AxisDomain}
@@ -275,6 +289,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
275289
"fill-tremor-content",
276290
// dark
277291
"dark:fill-dark-tremor-content",
292+
// common
293+
"stroke-1",
294+
// light
295+
"stroke-tremor-border",
296+
// dark
297+
"dark:stroke-dark-tremor-border",
278298
)}
279299
tickFormatter={
280300
relative ? (value: number) => `${(value * 100).toString()} %` : valueFormatter
@@ -298,7 +318,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
298318
width={yAxisWidth}
299319
hide={!showYAxis}
300320
dataKey={index}
301-
axisLine={false}
321+
axisLine={showAxisLine}
302322
tickLine={false}
303323
ticks={startEndOnly ? [data[0][index], data[data.length - 1][index]] : undefined}
304324
type="category"
@@ -313,6 +333,12 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
313333
"fill-tremor-content",
314334
// dark
315335
"dark:fill-dark-tremor-content",
336+
// common
337+
"stroke-1",
338+
// light
339+
"stroke-tremor-border",
340+
// dark
341+
"dark:stroke-dark-tremor-border",
316342
)}
317343
>
318344
{yAxisLabel && (
@@ -396,6 +422,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
396422
animationDuration={animationDuration}
397423
shape={(props: any) => renderShape(props, activeBar, activeLegend, layout)}
398424
onClick={onBarClick}
425+
label={renderLabel}
399426
/>
400427
))}
401428
</ReChartsBarChart>

src/components/chart-elements/DonutChart/DonutChart.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { parseData, parseLabelInput } from "./inputParser";
1818
import type { EventProps } from "components/chart-elements/common";
1919
import { CustomTooltipProps } from "components/chart-elements/common/CustomTooltipProps";
2020
import type BaseAnimationTimingProps from "../common/BaseAnimationTimingProps";
21+
import { PieLabel } from "recharts/types/polar/Pie";
2122

2223
type DonutChartVariant = "donut" | "pie";
2324

@@ -36,6 +37,7 @@ export interface DonutChartProps extends BaseAnimationTimingProps {
3637
className?: string;
3738
onValueChange?: (value: EventProps) => void;
3839
customTooltip?: React.ComponentType<CustomTooltipProps>;
40+
renderLabel?: PieLabel;
3941
}
4042

4143
const renderInactiveShape = (props: any) => {
@@ -89,6 +91,7 @@ const DonutChart = React.forwardRef<HTMLDivElement, DonutChartProps>((props, ref
8991
noDataText,
9092
onValueChange,
9193
customTooltip,
94+
renderLabel,
9295
className,
9396
...other
9497
} = props;
@@ -177,6 +180,7 @@ const DonutChart = React.forwardRef<HTMLDivElement, DonutChartProps>((props, ref
177180
activeIndex={activeIndex}
178181
inactiveShape={renderInactiveShape}
179182
style={{ outline: "none" }}
183+
label={renderLabel}
180184
/>
181185
{/* {showTooltip ? (
182186
<Tooltip

src/components/chart-elements/LineChart/LineChart.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
6161
showTooltip = true,
6262
showLegend = true,
6363
showGridLines = true,
64+
showAxisLine = false,
6465
autoMinValue = false,
6566
curveType = "linear",
6667
minValue,
@@ -72,6 +73,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
7273
onValueChange,
7374
enableLegendSlider = false,
7475
customTooltip,
76+
renderLabel,
7577
rotateLabelX,
7678
tickGap = 5,
7779
xAxisLabel,
@@ -186,9 +188,15 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
186188
"fill-tremor-content",
187189
// dark
188190
"dark:fill-dark-tremor-content",
191+
// common
192+
"stroke-1",
193+
// light
194+
"stroke-tremor-border",
195+
// dark
196+
"dark:stroke-dark-tremor-border",
189197
)}
190198
tickLine={false}
191-
axisLine={false}
199+
axisLine={showAxisLine}
192200
minTickGap={tickGap}
193201
angle={rotateLabelX?.angle}
194202
dy={rotateLabelX?.verticalShift}
@@ -207,7 +215,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
207215
<YAxis
208216
width={yAxisWidth}
209217
hide={!showYAxis}
210-
axisLine={false}
218+
axisLine={showAxisLine}
211219
tickLine={false}
212220
type="number"
213221
domain={yAxisDomain as AxisDomain}
@@ -221,6 +229,12 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
221229
"fill-tremor-content",
222230
// dark
223231
"dark:fill-dark-tremor-content",
232+
// common
233+
"stroke-1",
234+
// light
235+
"stroke-tremor-border",
236+
// dark
237+
"dark:stroke-dark-tremor-border",
224238
)}
225239
tickFormatter={valueFormatter}
226240
allowDecimals={allowDecimals}
@@ -373,6 +387,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
373387
isAnimationActive={showAnimation}
374388
animationDuration={animationDuration}
375389
connectNulls={connectNulls}
390+
label={renderLabel}
376391
/>
377392
))}
378393
{onValueChange
@@ -395,6 +410,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
395410
const { name } = props;
396411
onCategoryClick(name);
397412
}}
413+
label={renderLabel}
398414
/>
399415
))
400416
: null}

src/components/chart-elements/ScatterChart/ScatterChart.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export interface ScatterChartProps
6464
showTooltip?: boolean;
6565
showLegend?: boolean;
6666
showGridLines?: boolean;
67+
showAxisLine?: boolean;
6768
autoMinXValue?: boolean;
6869
minXValue?: number;
6970
maxXValue?: number;
@@ -129,6 +130,7 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
129130
showTooltip = true,
130131
showLegend = true,
131132
showGridLines = true,
133+
showAxisLine = false,
132134
autoMinXValue = false,
133135
minXValue,
134136
maxXValue,
@@ -246,10 +248,16 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
246248
"fill-tremor-content",
247249
// dark
248250
"dark:fill-dark-tremor-content",
251+
// common
252+
"stroke-1",
253+
// light
254+
"stroke-tremor-border",
255+
// dark
256+
"dark:stroke-dark-tremor-border",
249257
)}
250258
tickLine={false}
251259
tickFormatter={valueFormatter.x}
252-
axisLine={false}
260+
axisLine={showAxisLine}
253261
minTickGap={tickGap}
254262
domain={xAxisDomain as AxisDomain}
255263
allowDataOverflow={true}
@@ -272,7 +280,7 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
272280
<YAxis
273281
width={yAxisWidth}
274282
hide={!showYAxis}
275-
axisLine={false}
283+
axisLine={showAxisLine}
276284
tickLine={false}
277285
dataKey={y}
278286
type="number"
@@ -289,6 +297,12 @@ const ScatterChart = React.forwardRef<HTMLDivElement, ScatterChartProps>((props,
289297
"fill-tremor-content",
290298
// dark
291299
"dark:fill-dark-tremor-content",
300+
// common
301+
"stroke-1",
302+
// light
303+
"stroke-tremor-border",
304+
// dark
305+
"dark:stroke-dark-tremor-border",
292306
)}
293307
allowDecimals={allowDecimals}
294308
allowDataOverflow={true}

src/components/chart-elements/common/BaseChartProps.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ImplicitLabelType } from "recharts/types/component/Label";
12
import { Color, ValueFormatter, IntervalType } from "../../../lib";
23
import type BaseAnimationTimingProps from "./BaseAnimationTimingProps";
34
import { CustomTooltipProps } from "./CustomTooltipProps";
@@ -27,6 +28,7 @@ interface BaseChartProps extends BaseAnimationTimingProps, React.HTMLAttributes<
2728
showTooltip?: boolean;
2829
showLegend?: boolean;
2930
showGridLines?: boolean;
31+
showAxisLine?: boolean;
3032
autoMinValue?: boolean;
3133
minValue?: number;
3234
maxValue?: number;
@@ -44,6 +46,7 @@ interface BaseChartProps extends BaseAnimationTimingProps, React.HTMLAttributes<
4446
xAxisLabel?: string;
4547
xAxisPadding?: number;
4648
yAxisLabel?: string;
49+
renderLabel?: ImplicitLabelType;
4750
}
4851

4952
export default BaseChartProps;

0 commit comments

Comments
 (0)