From cbcabd13e15a1bbed3cf8313e32ed52bf44f9f9c Mon Sep 17 00:00:00 2001 From: Abhinandan Kushwaha Date: Mon, 5 Aug 2024 00:28:02 +0530 Subject: [PATCH] v1.4.26 added hidePointers to dataSet & fixes & updated tests --- .../{BarChart.test.js => BarChart.test.tsx} | 25 + .../{LineChart.test.js => LineChart.test.tsx} | 61 + .../{PieChart.test.js => PieChart.test.tsx} | 13 + __tests__/__snapshots__/BarChart.test.js.snap | 13530 ------ .../__snapshots__/BarChart.test.tsx.snap | 25916 ++++++++++++ .../__snapshots__/LineChart.test.js.snap | 18204 -------- .../__snapshots__/LineChart.test.tsx.snap | 34796 ++++++++++++++++ ...rt.test.js.snap => PieChart.test.tsx.snap} | 936 +- docs/LineChart/LineChartProps.md | 2 + .../SecondaryLineChartFromDataSet.tsx | 2 - jest.config.js | 1 + jestSetup.js | 20 + package.json | 4 +- release-notes/release-notes.md | 19 + src/Components/common/Pointer.tsx | 2 + src/Components/common/StripAndLabel.tsx | 2 + src/LineChart/index.tsx | 8 +- 17 files changed, 61225 insertions(+), 32316 deletions(-) rename __tests__/{BarChart.test.js => BarChart.test.tsx} (66%) rename __tests__/{LineChart.test.js => LineChart.test.tsx} (50%) rename __tests__/{PieChart.test.js => PieChart.test.tsx} (78%) delete mode 100644 __tests__/__snapshots__/BarChart.test.js.snap create mode 100644 __tests__/__snapshots__/BarChart.test.tsx.snap delete mode 100644 __tests__/__snapshots__/LineChart.test.js.snap create mode 100644 __tests__/__snapshots__/LineChart.test.tsx.snap rename __tests__/__snapshots__/{PieChart.test.js.snap => PieChart.test.tsx.snap} (69%) create mode 100644 jestSetup.js diff --git a/__tests__/BarChart.test.js b/__tests__/BarChart.test.tsx similarity index 66% rename from __tests__/BarChart.test.js rename to __tests__/BarChart.test.tsx index 1757a3a6..f20c61dd 100644 --- a/__tests__/BarChart.test.js +++ b/__tests__/BarChart.test.tsx @@ -11,9 +11,13 @@ import RoundStackBar from '../examples/BarChart/RoundStackBar'; import SimpleBlueBars from '../examples/BarChart/SimpleBlueBars'; import SimpleBlueBarsVerticalLines from '../examples/BarChart/SimpleBlueBarsVerticalLines'; import BarChartWithGivenNumberOfVerticalLines from '../examples/BarChart/BarChartWithGivenNumberOfVerticalLines'; +import BarPairWithLine from '../examples/BarChart/BarPairWithLine'; +import StackPairWithPattern from '../examples/BarChart/StackPairWithPattern'; +import StackWithNegative from '../examples/BarChart/StackWithNegative'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; +import ShiftXaxisLabels from '../examples/BarChart/ShiftXaxisLabels'; describe('Bar and Stacked Bar chart tests', () => { it('renders 3D bar chart correctly', () => { @@ -52,4 +56,25 @@ describe('Bar and Stacked Bar chart tests', () => { .toJSON(); expect(tree).toMatchSnapshot(); }); + + it('renders a Bar chart combined with Line chart', () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a Bar chart with shifted X axis labels', () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a stacked Bar chart with patterns', () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); + }); + + + it('renders a stacked Bar chart with negative values', () => { + const tree = renderer.create().toJSON(); + expect(tree).toMatchSnapshot(); + }); }); diff --git a/__tests__/LineChart.test.js b/__tests__/LineChart.test.tsx similarity index 50% rename from __tests__/LineChart.test.js rename to __tests__/LineChart.test.tsx index e8c84dd9..7bb2f3e4 100644 --- a/__tests__/LineChart.test.js +++ b/__tests__/LineChart.test.tsx @@ -12,43 +12,61 @@ import ChartWithAdjustingPointer from '../examples/LineChart/ChartWithAdjustingP import ScrollingChartWithPointer from '../examples/LineChart/ScrollingChartWithPointer'; import CaloriesBurnt from '../examples/LineChart/CaloriesBurnt'; import SimpleBlueLineWithGivenNumberOfVerticalLines from '../examples/LineChart/SimpleBlueLineWithGivenNumberOfVerticalLines'; +import DataSetSteppedChart from '../examples/LineChart/DataSetSteppedChart'; +import HighlightedRange from '../examples/LineChart/HighlightedRange'; +import SecondaryLineChart from '../examples/LineChart/SecondaryLineChart'; +import SecondaryLineChartFromDataSet from '../examples/LineChart/SecondaryLineChartFromDataSet'; +import Segmented from '../examples/LineChart/Segmented'; +import SegmentedDataSet from '../examples/LineChart/SegmentedDataSet'; +import SegmentedDataSetCurved from '../examples/LineChart/SegmentedDataSetCurved'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; describe('Line and Area chart tests', () => { + beforeEach(() => { + jest.useFakeTimers(); + }); + it('renders 2 area chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders 2 line chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders blue line chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders ChartWithPointer correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders ChartWithAdjustingPointer correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders ScrollingChartWithPointer correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders CaloriesBurnt Area chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); @@ -56,6 +74,49 @@ describe('Line and Area chart tests', () => { const tree = renderer .create() .toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a stepped chart with dataSet', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a chart with highlighted range', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a chart with secondary Y axis and secondary line', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a chart with secondary Y axis and secondary line using dataSet', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a segmented chart', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a segmented chart with dataSet', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + + it('renders a curved segmented chart with dataSet', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); }); diff --git a/__tests__/PieChart.test.js b/__tests__/PieChart.test.tsx similarity index 78% rename from __tests__/PieChart.test.js rename to __tests__/PieChart.test.tsx index 5126d4aa..ae485ce1 100644 --- a/__tests__/PieChart.test.js +++ b/__tests__/PieChart.test.tsx @@ -9,6 +9,7 @@ import SimplePie from '../examples/PieChart/SimplePie'; import SplitPie from '../examples/PieChart/SplitPie'; import ThreeDPie from '../examples/PieChart/ThreeDPie'; import PieSingleData from '../examples/PieChart/PieSingleData'; +import PieWithZero from '../examples/PieChart/PieWithZero'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; @@ -19,26 +20,38 @@ describe('Pie and Donut chart tests', () => { }); it('renders progress pie chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders simple pie chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders split pie chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders 3D pie chart correctly', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); it('renders pie chart correctly for Single data', () => { const tree = renderer.create().toJSON(); + jest.runAllTimers(); expect(tree).toMatchSnapshot(); }); + + it('renders pie chart with zero values correctly', () => { + const tree = renderer.create().toJSON(); + jest.runAllTimers(); + expect(tree).toMatchSnapshot(); + }); + }); diff --git a/__tests__/__snapshots__/BarChart.test.js.snap b/__tests__/__snapshots__/BarChart.test.js.snap deleted file mode 100644 index 107255cb..00000000 --- a/__tests__/__snapshots__/BarChart.test.js.snap +++ /dev/null @@ -1,13530 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Bar and Stacked Bar chart tests renders 3D bar chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 400 - - - - - 300 - - - - - 200 - - - - - 100 - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Jan - - - - - - - - - - - - - - - - - - - - - - - - - - Feb - - - - - - - - - - - - - - - - - - - - - - - - - - Mar - - - - - - - - - - - - - - - - - - - - - - - - - - Apr - - - - - - - - - - - - - - - - - - - - - - - - - - May - - - - - - - -`; - -exports[`Bar and Stacked Bar chart tests renders a simple bar chart with given number of vertical lines correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 50 - - - - - 45 - - - - - 40 - - - - - 35 - - - - - 30 - - - - - 25 - - - - - 20 - - - - - 15 - - - - - 10 - - - - - 5 - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Jan - - - - - - - - - - - - Feb - - - - - - - - - - - - Mar - - - - - - - - - - - - Apr - - - - - - - -`; - -exports[`Bar and Stacked Bar chart tests renders a simple bar chart with vertical lines correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 750 - - - - - 500 - - - - - 250 - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - M - - - - - - - - - - - - T - - - - - - - - - - - - W - - - - - - - - - - - - T - - - - - - - - - - - - F - - - - - - - - - - - - S - - - - - - - - - - - - S - - - - - - - -`; - -exports[`Bar and Stacked Bar chart tests renders alternate blue and gray bar chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 750 - - - - - 500 - - - - - 250 - - - - - 0 - - - - - - - - - - - - - - - - - M - - - - - - - - - - - - T - - - - - - - - - - - - W - - - - - - - - - - - - T - - - - - - - - - - - - F - - - - - - - - - - - - S - - - - - - - - - - - - S - - - - - - - -`; - -exports[`Bar and Stacked Bar chart tests renders capped bar chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 50 - - - - - 45 - - - - - 40 - - - - - 35 - - - - - 30 - - - - - 25 - - - - - 20 - - - - - 15 - - - - - 10 - - - - - 5 - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - Jan - - - - - - - - - - Feb - - - - - - - - - - Mar - - - - - - - - - - Apr - - - - - - - -`; - -exports[`Bar and Stacked Bar chart tests renders gradient bar chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - 0.8 - - - - - 0.6 - - - - - 0.4 - - - - - 0.2 - - - - - 0 - - - - - - - - - - - - - - - - 1 - - - - - - - - - 2 - - - - - - - - - 3 - - - - - - - - - 4 - - - - - - - - - 5 - - - - - - - - - 6 - - - - - - - -`; - -exports[`Bar and Stacked Bar chart tests renders rounded stack bar chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 40 - - - - - 30 - - - - - 20 - - - - - 10 - - - - - 0 - - - - - - - - - - - - - - - - - Jan - - - - - - - - - - - - Mar - - - - - - - - - - - Feb - - - - - - - - - - - - Mar - - - - - - - -`; diff --git a/__tests__/__snapshots__/BarChart.test.tsx.snap b/__tests__/__snapshots__/BarChart.test.tsx.snap new file mode 100644 index 00000000..0ebd29d6 --- /dev/null +++ b/__tests__/__snapshots__/BarChart.test.tsx.snap @@ -0,0 +1,25916 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Bar and Stacked Bar chart tests renders 3D bar chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 400.0 + + + + + 300.0 + + + + + 200.0 + + + + + 100.0 + + + + + 0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Jan + + + + + + + + + + + + + + + + + + + + + + + + + + Feb + + + + + + + + + + + + + + + + + + + + + + + + + + Mar + + + + + + + + + + + + + + + + + + + + + + + + + + Apr + + + + + + + + + + + + + + + + + + + + + + + + + + May + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders a Bar chart combined with Line chart 1`] = ` + + + Overview + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6k + + + + + 5k + + + + + 4k + + + + + 3k + + + + + 2k + + + + + 1k + + + + + 0 + + + + + + + + + + + + + + + + + + Jan + + + + + + + + + + + + + + Feb + + + + + + + + + + + + + + Mar + + + + + + + + + + + + + + Apr + + + + + + + + + + + + + + May + + + + + + + + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders a Bar chart with shifted X axis labels 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + €220 + + + + + €176 + + + + + €132 + + + + + €88 + + + + + €44 + + + + + €0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + €-220 + + + + + €-176 + + + + + €-132 + + + + + €-88 + + + + + €-44 + + + + + + + + + + + + + + April + + + + + + + + + + + Mei + + + + + + + + + + + Juni + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders a simple bar chart with given number of vertical lines correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 50 + + + + + 45 + + + + + 40 + + + + + 35 + + + + + 30 + + + + + 25 + + + + + 20 + + + + + 15 + + + + + 10 + + + + + 5 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + Jan + + + + + + + + + + + + Feb + + + + + + + + + + + + Mar + + + + + + + + + + + + Apr + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders a simple bar chart with vertical lines correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 750 + + + + + 500 + + + + + 250 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + M + + + + + + + + + + + + T + + + + + + + + + + + + W + + + + + + + + + + + + T + + + + + + + + + + + + F + + + + + + + + + + + + S + + + + + + + + + + + + S + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders a stacked Bar chart with negative values 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 40 + + + + + 36 + + + + + 32 + + + + + 28 + + + + + 24 + + + + + 20 + + + + + 16 + + + + + 12 + + + + + 8 + + + + + 4 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -12 + + + + + -8 + + + + + -4 + + + + + + + + + + + + + + + + Nov "23 + + + + + + + + + + + + Dez "23 + + + + + + + + + + + + Dez "23 + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders a stacked Bar chart with patterns 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + 66 + + + + + 33 + + + + + 0 + + + + + + + + + + + + + T193 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 828 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 939 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NH950 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + N123 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + T250 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders alternate blue and gray bar chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 750 + + + + + 500 + + + + + 250 + + + + + 0 + + + + + + + + + + + + + + + M + + + + + + + + + + + + T + + + + + + + + + + + + W + + + + + + + + + + + + T + + + + + + + + + + + + F + + + + + + + + + + + + S + + + + + + + + + + + + S + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders capped bar chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 50 + + + + + 45 + + + + + 40 + + + + + 35 + + + + + 30 + + + + + 25 + + + + + 20 + + + + + 15 + + + + + 10 + + + + + 5 + + + + + 0 + + + + + + + + + + + + + Jan + + + + + + + + + + Feb + + + + + + + + + + Mar + + + + + + + + + + Apr + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders gradient bar chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.0 + + + + + 0.8 + + + + + 0.6 + + + + + 0.4 + + + + + 0.2 + + + + + 0.0 + + + + + + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + + + 2 + + + + + + + + + 3 + + + + + + + + + 4 + + + + + + + + + 5 + + + + + + + + + 6 + + + + + + + + + + + +`; + +exports[`Bar and Stacked Bar chart tests renders rounded stack bar chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 40 + + + + + 30 + + + + + 20 + + + + + 10 + + + + + 0 + + + + + + + + + + + + + + + + + + 0 + + + + + + + 30 + + + + + + Jan + + + + + + + + + + + + + + + 1 + + + + + + + 22 + + + + + + Mar + + + + + + + + + + + + + + 2 + + + + + + + 32 + + + + + + Feb + + + + + + + + + + + + + + + 3 + + + + + + + 28 + + + + + + Mar + + + + + + + + + + + +`; diff --git a/__tests__/__snapshots__/LineChart.test.js.snap b/__tests__/__snapshots__/LineChart.test.js.snap deleted file mode 100644 index 5df42bdd..00000000 --- a/__tests__/__snapshots__/LineChart.test.js.snap +++ /dev/null @@ -1,18204 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Line and Area chart tests renders 2 area chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 100 - - - - - 90 - - - - - 80 - - - - - 70 - - - - - 60 - - - - - 50 - - - - - 40 - - - - - 30 - - - - - 20 - - - - - 10 - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Line and Area chart tests renders 2 line chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 100 - - - - - 90 - - - - - 80 - - - - - 70 - - - - - 60 - - - - - 50 - - - - - 40 - - - - - 30 - - - - - 20 - - - - - 10 - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Line and Area chart tests renders CaloriesBurnt Area chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 80% - - - - - 60% - - - - - 40% - - - - - 20% - - - - - 0% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Line and Area chart tests renders ChartWithAdjustingPointer correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - hello600 - - - - - hello500 - - - - - hello400 - - - - - hello300 - - - - - hello200 - - - - - hello100 - - - - - hello0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 30 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Line and Area chart tests renders ChartWithPointer correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - hello600 - - - - - hello500 - - - - - hello400 - - - - - hello300 - - - - - hello200 - - - - - hello100 - - - - - hello0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 30 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Line and Area chart tests renders ScrollingChartWithPointer correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - hello600 - - - - - hello500 - - - - - hello400 - - - - - hello300 - - - - - hello200 - - - - - hello100 - - - - - hello0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 20 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 30 Apr - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Line and Area chart tests renders blue line chart correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; - -exports[`Line and Area chart tests renders blue line chart with given number of vertical lines correctly 1`] = ` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -`; diff --git a/__tests__/__snapshots__/LineChart.test.tsx.snap b/__tests__/__snapshots__/LineChart.test.tsx.snap new file mode 100644 index 00000000..c2379487 --- /dev/null +++ b/__tests__/__snapshots__/LineChart.test.tsx.snap @@ -0,0 +1,34796 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Line and Area chart tests renders 2 area chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + 90 + + + + + 80 + + + + + 70 + + + + + 60 + + + + + 50 + + + + + 40 + + + + + 30 + + + + + 20 + + + + + 10 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders 2 line chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + 90 + + + + + 80 + + + + + 70 + + + + + 60 + + + + + 50 + + + + + 40 + + + + + 30 + + + + + 20 + + + + + 10 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders CaloriesBurnt Area chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 80% + + + + + 60% + + + + + 40% + + + + + 20% + + + + + 0% + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders ChartWithAdjustingPointer correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hello600 + + + + + hello500 + + + + + hello400 + + + + + hello300 + + + + + hello200 + + + + + hello100 + + + + + hello0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders ChartWithPointer correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hello600 + + + + + hello500 + + + + + hello400 + + + + + hello300 + + + + + hello200 + + + + + hello100 + + + + + hello0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders ScrollingChartWithPointer correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + hello600 + + + + + hello500 + + + + + hello400 + + + + + hello300 + + + + + hello200 + + + + + hello100 + + + + + hello0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 20 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 Apr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders a chart with highlighted range 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 30 + + + + + 27 + + + + + 24 + + + + + 21 + + + + + 18 + + + + + 15 + + + + + 12 + + + + + 9 + + + + + 6 + + + + + 3 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders a chart with secondary Y axis and secondary line 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 140 + + + + + 120 + + + + + 100 + + + + + 80 + + + + + 60 + + + + + 40 + + + + + 20 + + + + + 0 + + + + + + + 0.000 + + + + + + 0.050 + + + + + + 0.100 + + + + + + 0.150 + + + + + + 0.200 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2005 + + + + + + + + + + + + + + + + + + + + + + + + + + + 2010 + + + + + + + + + + + + + + + + + + + + + + + + + + + 2015 + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders a chart with secondary Y axis and secondary line using dataSet 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 140 + + + + + 120 + + + + + 100 + + + + + 80 + + + + + 60 + + + + + 40 + + + + + 20 + + + + + 0 + + + + + + + 0.000 + + + + + + 0.050 + + + + + + 0.100 + + + + + + 0.150 + + + + + + 0.200 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2005 + + + + + + + + + + + + + + + + + + + + + + + + + + + 2010 + + + + + + + + + + + + + + + + + + + + + + + + + + + 2015 + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders a curved segmented chart with dataSet 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + 90 + + + + + 80 + + + + + 70 + + + + + 60 + + + + + 50 + + + + + 40 + + + + + 30 + + + + + 20 + + + + + 10 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders a segmented chart 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + 90 + + + + + 80 + + + + + 70 + + + + + 60 + + + + + 50 + + + + + 40 + + + + + 30 + + + + + 20 + + + + + 10 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders a segmented chart with dataSet 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + 90 + + + + + 80 + + + + + 70 + + + + + 60 + + + + + 50 + + + + + 40 + + + + + 30 + + + + + 20 + + + + + 10 + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders a stepped chart with dataSet 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 200 + + + + + 188 + + + + + 176 + + + + + 164 + + + + + 152 + + + + + 140 + + + + + 128 + + + + + 116 + + + + + 104 + + + + + 92 + + + + + 80 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders blue line chart correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Line and Area chart tests renders blue line chart with given number of vertical lines correctly 1`] = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; diff --git a/__tests__/__snapshots__/PieChart.test.js.snap b/__tests__/__snapshots__/PieChart.test.tsx.snap similarity index 69% rename from __tests__/__snapshots__/PieChart.test.js.snap rename to __tests__/__snapshots__/PieChart.test.tsx.snap index 540cd0a3..aa5f3623 100644 --- a/__tests__/__snapshots__/PieChart.test.js.snap +++ b/__tests__/__snapshots__/PieChart.test.tsx.snap @@ -1,12 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Pie and Donut chart tests renders 3D pie chart correctly 1`] = ` - + @@ -18,6 +25,7 @@ exports[`Pie and Donut chart tests renders 3D pie chart correctly 1`] = ` } > @@ -299,8 +308,8 @@ exports[`Pie and Donut chart tests renders 3D pie chart correctly 1`] = ` /> @@ -378,8 +387,8 @@ exports[`Pie and Donut chart tests renders 3D pie chart correctly 1`] = ` /> @@ -458,46 +467,13 @@ exports[`Pie and Donut chart tests renders 3D pie chart correctly 1`] = ` - - - + + + + + + `; exports[`Pie and Donut chart tests renders pie chart correctly for Single data 1`] = ` - + +`; + +exports[`Pie and Donut chart tests renders pie chart with zero values correctly 1`] = ` + @@ -529,6 +598,7 @@ exports[`Pie and Donut chart tests renders pie chart correctly for Single data 1 } > + - + - - - - - -`; - -exports[`Pie and Donut chart tests renders progress pie chart correctly 1`] = ` - - - - - - - - - - - - - + + + - - - 70% - - - - + } + /> `; +exports[`Pie and Donut chart tests renders progress pie chart correctly 1`] = ` + +`; + exports[`Pie and Donut chart tests renders simple pie chart correctly 1`] = ` - + @@ -968,6 +928,7 @@ exports[`Pie and Donut chart tests renders simple pie chart correctly 1`] = ` } > @@ -1243,8 +1205,8 @@ exports[`Pie and Donut chart tests renders simple pie chart correctly 1`] = ` /> @@ -1322,8 +1284,8 @@ exports[`Pie and Donut chart tests renders simple pie chart correctly 1`] = ` /> @@ -1402,258 +1364,78 @@ exports[`Pie and Donut chart tests renders simple pie chart correctly 1`] = ` - - - - - -`; - -exports[`Pie and Donut chart tests renders split pie chart correctly 1`] = ` - - - - + + + - - - - - - - - - - + } + /> `; + +exports[`Pie and Donut chart tests renders split pie chart correctly 1`] = ` + +`; diff --git a/docs/LineChart/LineChartProps.md b/docs/LineChart/LineChartProps.md index ccb20ced..320d2c5d 100644 --- a/docs/LineChart/LineChartProps.md +++ b/docs/LineChart/LineChartProps.md @@ -97,6 +97,7 @@ type DataSet = { curveType?: CurveType; lineSegments?: Array; isSecondary?: boolean; + hidePointers?: boolean; }; ``` @@ -158,6 +159,7 @@ So, all the three must be used together. Using any 1 or 2 of them may produce ab | stripStrokeDashArray | Array | Array of 2 numbers denoting the dashWidth and dashGap of the vertical strip | | pointerShiftX | number | Shifts the pointer for that item horizontally by given quantity (used only when pointerConfig prop is passed) | | pointerShiftY | number | Shifts the pointer for that item vertically by given quantity (used only when pointerConfig prop is passed) | +| hidePointer | boolean | Used to hide the pointer for current item | **Alert**\ When you are using the `dataPointLabelComponent`, make sure to provide the `dataPointsHeight` and `dataPointsWidth` values too (either in the corresponding item object, or directly as a props of the component). Otherwise the data points might appear shifted from their intended positions. diff --git a/examples/LineChart/SecondaryLineChartFromDataSet.tsx b/examples/LineChart/SecondaryLineChartFromDataSet.tsx index 076090ab..004dc688 100644 --- a/examples/LineChart/SecondaryLineChartFromDataSet.tsx +++ b/examples/LineChart/SecondaryLineChartFromDataSet.tsx @@ -42,8 +42,6 @@ const SecondaryLineChart = () => { return ( /node_modules/(?!@ngrx|(?!deck.gl)|ng-dynamic)', ], + // setupFiles: ['./jestSetup.js'], }; diff --git a/jestSetup.js b/jestSetup.js new file mode 100644 index 00000000..2e7b5627 --- /dev/null +++ b/jestSetup.js @@ -0,0 +1,20 @@ +// jestSetup.js +jest.mock('react-native', () => { + const actualReactNative = jest.requireActual('react-native'); + + return { + ...actualReactNative, + Animated: { + ...actualReactNative.Animated, + timing: (value, config) => ({ + start: (callback) => { + value.setValue(config.toValue); + if (callback) { + callback({ finished: true }); + } + }, + }), + }, + }; + }); + \ No newline at end of file diff --git a/package.json b/package.json index c1e4abf8..d7b674fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-gifted-charts", - "version": "1.4.25", + "version": "1.4.26", "description": "The most complete library for Bar, Line, Area, Pie, Donut, Stacked Bar and Population Pyramid charts in React Native. Allows 2D, 3D, gradient, animations and live data updates.", "main": "dist/index.js", "files": [ @@ -25,7 +25,7 @@ "registry": "https://registry.npmjs.org/" }, "dependencies": { - "gifted-charts-core": "^0.1.27" + "gifted-charts-core": "^0.1.28" }, "devDependencies": { "@babel/cli": "^7.24.8", diff --git a/release-notes/release-notes.md b/release-notes/release-notes.md index 9fb0a7d4..5b57ef79 100644 --- a/release-notes/release-notes.md +++ b/release-notes/release-notes.md @@ -1,3 +1,22 @@ +# 🎉 1.4.26 + +## ✨ Features added- + +Added the property `hidePointers` to the objects of the `dataSet` array. This will let us hide the pointers for individual sets.
+Also, we can now add the property `hidePointer` inside individual data items of any dataSet.
+See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/755 + +## 🐛 Bug fixes + +1. Fixed the issue- `areaChart` given in dataSet array of line chart doesn't work. See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/758 +2. Fixed the issue- Crash when I click to datapoint doesn't have any value. See https://github.com/Abhinandan-Kushwaha/react-native-gifted-charts/issues/757 + +--- + +--- + +--- + # 🎉 1.4.25 ## ✨ Features added- diff --git a/src/Components/common/Pointer.tsx b/src/Components/common/Pointer.tsx index cb87e6b7..6eca6daf 100644 --- a/src/Components/common/Pointer.tsx +++ b/src/Components/common/Pointer.tsx @@ -12,6 +12,8 @@ export const Pointer = (props: any) => { pointerItemLocal, pointerColorLocal, } = props; + if (isNaN(pointerYLocal) || typeof pointerYLocal !== 'number') return null; + return ( { const {top, left} = getTopAndLeftForStripAndLabel(props); + if (isNaN(top) || typeof top !== 'number') return null; + return ( { activatePointersOnLongPress, activatePointersDelay, persistPointer, + hidePointers, hidePointer1, hidePointer2, hidePointer3, @@ -309,6 +310,7 @@ export const LineChart = (props: LineChartPropsType) => { lineGradientStartColor, lineGradientEndColor, barAndLineChartsWrapperProps, + areaChart, } = useLineChart({ ...props, parentWidth: props.parentWidth ?? screenWidth, @@ -928,11 +930,13 @@ export const LineChart = (props: LineChartPropsType) => { }; const renderPointer = (lineNumber: number, isDataSet?: boolean) => { + if (hidePointers) return; if (isDataSet) { let pointerItemLocal, pointerYLocal, pointerColorLocal; return dataSet?.map((set, index) => { const pIndex = barAndLineChartsWrapperProps.pointerIndex; pointerItemLocal = set.data[pIndex]; + if (set.hidePointers || pointerItemLocal?.hidePointer) return null; pointerYLocal = pointerYsForDataSet[index]; pointerColorLocal = pointerConfig?.pointerColorsForDataSet?.[index] ?? pointerColor; @@ -1189,7 +1193,9 @@ export const LineChart = (props: LineChartPropsType) => { ) => { if (!points) return null; const isCurved = points.includes('C'); - const isNthAreaChart = getIsNthAreaChart(key ?? 0); + const isNthAreaChart = !!dataSet + ? (dataSet[Number(key)].areaChart ?? areaChart) + : getIsNthAreaChart(key ?? 0); let ar: LineProperties[] = [{d: '', color: '', strokeWidth: 0}]; if (points.includes(RANGE_ENTER)) { ar = getRegionPathObjects(