@coinbase/cds-mobile-visualization 3.8.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dts/chart/index.d.ts +1 -15
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/index.d.ts.map +1 -1
- package/dts/sparkline/index.d.ts +1 -5
- package/dts/sparkline/index.d.ts.map +1 -1
- package/esm/chart/index.js +1 -17
- package/esm/index.js +1 -3
- package/esm/sparkline/index.js +1 -5
- package/package.json +26 -20
- package/dts/chart/CartesianChart.d.ts +0 -206
- package/dts/chart/CartesianChart.d.ts.map +0 -1
- package/dts/chart/ChartContextBridge.d.ts +0 -28
- package/dts/chart/ChartContextBridge.d.ts.map +0 -1
- package/dts/chart/ChartProvider.d.ts +0 -9
- package/dts/chart/ChartProvider.d.ts.map +0 -1
- package/dts/chart/Path.d.ts +0 -121
- package/dts/chart/Path.d.ts.map +0 -1
- package/dts/chart/PeriodSelector.d.ts +0 -100
- package/dts/chart/PeriodSelector.d.ts.map +0 -1
- package/dts/chart/area/Area.d.ts +0 -83
- package/dts/chart/area/Area.d.ts.map +0 -1
- package/dts/chart/area/AreaChart.d.ts +0 -155
- package/dts/chart/area/AreaChart.d.ts.map +0 -1
- package/dts/chart/area/DottedArea.d.ts +0 -46
- package/dts/chart/area/DottedArea.d.ts.map +0 -1
- package/dts/chart/area/GradientArea.d.ts +0 -36
- package/dts/chart/area/GradientArea.d.ts.map +0 -1
- package/dts/chart/area/SolidArea.d.ts +0 -23
- package/dts/chart/area/SolidArea.d.ts.map +0 -1
- package/dts/chart/area/index.d.ts +0 -6
- package/dts/chart/area/index.d.ts.map +0 -1
- package/dts/chart/axis/Axis.d.ts +0 -174
- package/dts/chart/axis/Axis.d.ts.map +0 -1
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts +0 -8
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +0 -1
- package/dts/chart/axis/XAxis.d.ts +0 -22
- package/dts/chart/axis/XAxis.d.ts.map +0 -1
- package/dts/chart/axis/YAxis.d.ts +0 -22
- package/dts/chart/axis/YAxis.d.ts.map +0 -1
- package/dts/chart/axis/index.d.ts +0 -5
- package/dts/chart/axis/index.d.ts.map +0 -1
- package/dts/chart/bar/Bar.d.ts +0 -100
- package/dts/chart/bar/Bar.d.ts.map +0 -1
- package/dts/chart/bar/BarChart.d.ts +0 -158
- package/dts/chart/bar/BarChart.d.ts.map +0 -1
- package/dts/chart/bar/BarPlot.d.ts +0 -31
- package/dts/chart/bar/BarPlot.d.ts.map +0 -1
- package/dts/chart/bar/BarStack.d.ts +0 -127
- package/dts/chart/bar/BarStack.d.ts.map +0 -1
- package/dts/chart/bar/BarStackGroup.d.ts +0 -37
- package/dts/chart/bar/BarStackGroup.d.ts.map +0 -1
- package/dts/chart/bar/DefaultBar.d.ts +0 -7
- package/dts/chart/bar/DefaultBar.d.ts.map +0 -1
- package/dts/chart/bar/DefaultBarStack.d.ts +0 -7
- package/dts/chart/bar/DefaultBarStack.d.ts.map +0 -1
- package/dts/chart/bar/PercentageBarChart.d.ts +0 -106
- package/dts/chart/bar/PercentageBarChart.d.ts.map +0 -1
- package/dts/chart/bar/index.d.ts +0 -9
- package/dts/chart/bar/index.d.ts.map +0 -1
- package/dts/chart/gradient/Gradient.d.ts +0 -41
- package/dts/chart/gradient/Gradient.d.ts.map +0 -1
- package/dts/chart/gradient/index.d.ts +0 -2
- package/dts/chart/gradient/index.d.ts.map +0 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +0 -5
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +0 -1
- package/dts/chart/legend/DefaultLegendShape.d.ts +0 -5
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +0 -1
- package/dts/chart/legend/Legend.d.ts +0 -168
- package/dts/chart/legend/Legend.d.ts.map +0 -1
- package/dts/chart/legend/index.d.ts +0 -4
- package/dts/chart/legend/index.d.ts.map +0 -1
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts +0 -9
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +0 -1
- package/dts/chart/line/DottedLine.d.ts +0 -20
- package/dts/chart/line/DottedLine.d.ts.map +0 -1
- package/dts/chart/line/Line.d.ts +0 -122
- package/dts/chart/line/Line.d.ts.map +0 -1
- package/dts/chart/line/LineChart.d.ts +0 -135
- package/dts/chart/line/LineChart.d.ts.map +0 -1
- package/dts/chart/line/ReferenceLine.d.ts +0 -140
- package/dts/chart/line/ReferenceLine.d.ts.map +0 -1
- package/dts/chart/line/SolidLine.d.ts +0 -15
- package/dts/chart/line/SolidLine.d.ts.map +0 -1
- package/dts/chart/line/index.d.ts +0 -7
- package/dts/chart/line/index.d.ts.map +0 -1
- package/dts/chart/point/DefaultPointLabel.d.ts +0 -10
- package/dts/chart/point/DefaultPointLabel.d.ts.map +0 -1
- package/dts/chart/point/Point.d.ts +0 -144
- package/dts/chart/point/Point.d.ts.map +0 -1
- package/dts/chart/point/index.d.ts +0 -3
- package/dts/chart/point/index.d.ts.map +0 -1
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +0 -38
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +0 -1
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +0 -12
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +0 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +0 -12
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +0 -1
- package/dts/chart/scrubber/Scrubber.d.ts +0 -302
- package/dts/chart/scrubber/Scrubber.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts +0 -12
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +0 -54
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +0 -46
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberProvider.d.ts +0 -20
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +0 -1
- package/dts/chart/scrubber/index.d.ts +0 -5
- package/dts/chart/scrubber/index.d.ts.map +0 -1
- package/dts/chart/text/ChartText.d.ts +0 -164
- package/dts/chart/text/ChartText.d.ts.map +0 -1
- package/dts/chart/text/ChartTextGroup.d.ts +0 -61
- package/dts/chart/text/ChartTextGroup.d.ts.map +0 -1
- package/dts/chart/text/index.d.ts +0 -3
- package/dts/chart/text/index.d.ts.map +0 -1
- package/dts/chart/utils/axis.d.ts +0 -387
- package/dts/chart/utils/axis.d.ts.map +0 -1
- package/dts/chart/utils/bar.d.ts +0 -225
- package/dts/chart/utils/bar.d.ts.map +0 -1
- package/dts/chart/utils/chart.d.ts +0 -165
- package/dts/chart/utils/chart.d.ts.map +0 -1
- package/dts/chart/utils/context.d.ts +0 -131
- package/dts/chart/utils/context.d.ts.map +0 -1
- package/dts/chart/utils/gradient.d.ts +0 -129
- package/dts/chart/utils/gradient.d.ts.map +0 -1
- package/dts/chart/utils/index.d.ts +0 -11
- package/dts/chart/utils/index.d.ts.map +0 -1
- package/dts/chart/utils/path.d.ts +0 -186
- package/dts/chart/utils/path.d.ts.map +0 -1
- package/dts/chart/utils/point.d.ts +0 -146
- package/dts/chart/utils/point.d.ts.map +0 -1
- package/dts/chart/utils/scale.d.ts +0 -145
- package/dts/chart/utils/scale.d.ts.map +0 -1
- package/dts/chart/utils/scrubber.d.ts +0 -40
- package/dts/chart/utils/scrubber.d.ts.map +0 -1
- package/dts/chart/utils/transition.d.ts +0 -181
- package/dts/chart/utils/transition.d.ts.map +0 -1
- package/dts/sparkline/Counter.d.ts +0 -8
- package/dts/sparkline/Counter.d.ts.map +0 -1
- package/dts/sparkline/Sparkline.d.ts +0 -74
- package/dts/sparkline/Sparkline.d.ts.map +0 -1
- package/dts/sparkline/SparklineArea.d.ts +0 -15
- package/dts/sparkline/SparklineArea.d.ts.map +0 -1
- package/dts/sparkline/SparklineAreaPattern.d.ts +0 -14
- package/dts/sparkline/SparklineAreaPattern.d.ts.map +0 -1
- package/dts/sparkline/SparklineGradient.d.ts +0 -24
- package/dts/sparkline/SparklineGradient.d.ts.map +0 -1
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts +0 -2
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts.map +0 -1
- package/dts/sparkline/generateSparklineWithId.d.ts +0 -11
- package/dts/sparkline/generateSparklineWithId.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts +0 -23
- package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +0 -185
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +0 -25
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +0 -28
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +0 -13
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +0 -17
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts +0 -11
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts +0 -26
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +0 -25
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +0 -25
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +0 -39
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +0 -31
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts +0 -13
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts +0 -16
- package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts +0 -6
- package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +0 -22
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts +0 -34
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +0 -118
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts +0 -29
- package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts.map +0 -1
- package/esm/chart/CartesianChart.js +0 -431
- package/esm/chart/ChartContextBridge.js +0 -159
- package/esm/chart/ChartProvider.js +0 -10
- package/esm/chart/Path.js +0 -255
- package/esm/chart/PeriodSelector.js +0 -139
- package/esm/chart/__stories__/CartesianChart.stories.js +0 -659
- package/esm/chart/__stories__/ChartAccessibility.stories.js +0 -721
- package/esm/chart/__stories__/ChartTransitions.stories.js +0 -693
- package/esm/chart/__stories__/PeriodSelector.stories.js +0 -420
- package/esm/chart/area/Area.js +0 -85
- package/esm/chart/area/AreaChart.js +0 -152
- package/esm/chart/area/DottedArea.js +0 -92
- package/esm/chart/area/GradientArea.js +0 -63
- package/esm/chart/area/SolidArea.js +0 -45
- package/esm/chart/area/__stories__/AreaChart.stories.js +0 -370
- package/esm/chart/area/index.js +0 -7
- package/esm/chart/axis/Axis.js +0 -9
- package/esm/chart/axis/DefaultAxisTickLabel.js +0 -11
- package/esm/chart/axis/XAxis.js +0 -256
- package/esm/chart/axis/YAxis.js +0 -255
- package/esm/chart/axis/__stories__/Axis.stories.js +0 -552
- package/esm/chart/axis/index.js +0 -6
- package/esm/chart/bar/Bar.js +0 -71
- package/esm/chart/bar/BarChart.js +0 -122
- package/esm/chart/bar/BarPlot.js +0 -106
- package/esm/chart/bar/BarStack.js +0 -173
- package/esm/chart/bar/BarStackGroup.js +0 -89
- package/esm/chart/bar/DefaultBar.js +0 -79
- package/esm/chart/bar/DefaultBarStack.js +0 -68
- package/esm/chart/bar/PercentageBarChart.js +0 -99
- package/esm/chart/bar/__stories__/BarChart.stories.js +0 -1417
- package/esm/chart/bar/__stories__/PercentageBarChart.stories.js +0 -833
- package/esm/chart/bar/index.js +0 -10
- package/esm/chart/gradient/Gradient.js +0 -156
- package/esm/chart/gradient/index.js +0 -1
- package/esm/chart/legend/DefaultLegendEntry.js +0 -42
- package/esm/chart/legend/DefaultLegendShape.js +0 -64
- package/esm/chart/legend/Legend.js +0 -59
- package/esm/chart/legend/__stories__/Legend.stories.js +0 -574
- package/esm/chart/legend/index.js +0 -3
- package/esm/chart/line/DefaultReferenceLineLabel.js +0 -66
- package/esm/chart/line/DottedLine.js +0 -57
- package/esm/chart/line/Line.js +0 -180
- package/esm/chart/line/LineChart.js +0 -149
- package/esm/chart/line/ReferenceLine.js +0 -132
- package/esm/chart/line/SolidLine.js +0 -53
- package/esm/chart/line/__stories__/LineChart.stories.js +0 -2018
- package/esm/chart/line/__stories__/ReferenceLine.stories.js +0 -226
- package/esm/chart/line/index.js +0 -8
- package/esm/chart/point/DefaultPointLabel.js +0 -39
- package/esm/chart/point/Point.js +0 -187
- package/esm/chart/point/index.js +0 -2
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +0 -182
- package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +0 -43
- package/esm/chart/scrubber/DefaultScrubberLabel.js +0 -44
- package/esm/chart/scrubber/Scrubber.js +0 -198
- package/esm/chart/scrubber/ScrubberAccessibilityView.js +0 -177
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +0 -169
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +0 -212
- package/esm/chart/scrubber/ScrubberProvider.js +0 -140
- package/esm/chart/scrubber/__stories__/Scrubber.stories.js +0 -946
- package/esm/chart/scrubber/index.js +0 -4
- package/esm/chart/text/ChartText.js +0 -305
- package/esm/chart/text/ChartTextGroup.js +0 -211
- package/esm/chart/text/index.js +0 -4
- package/esm/chart/utils/axis.js +0 -664
- package/esm/chart/utils/bar.js +0 -906
- package/esm/chart/utils/chart.js +0 -329
- package/esm/chart/utils/context.js +0 -22
- package/esm/chart/utils/gradient.js +0 -319
- package/esm/chart/utils/index.js +0 -12
- package/esm/chart/utils/path.js +0 -304
- package/esm/chart/utils/point.js +0 -282
- package/esm/chart/utils/scale.js +0 -288
- package/esm/chart/utils/scrubber.js +0 -146
- package/esm/chart/utils/transition.js +0 -241
- package/esm/sparkline/Counter.js +0 -45
- package/esm/sparkline/Sparkline.js +0 -165
- package/esm/sparkline/SparklineArea.js +0 -20
- package/esm/sparkline/SparklineAreaPattern.js +0 -38
- package/esm/sparkline/SparklineGradient.js +0 -77
- package/esm/sparkline/__figma__/Sparkline.figma.js +0 -22
- package/esm/sparkline/__stories__/Sparkline.stories.js +0 -124
- package/esm/sparkline/__stories__/SparklineGradient.stories.js +0 -126
- package/esm/sparkline/generateSparklineWithId.js +0 -7
- package/esm/sparkline/sparkline-interactive/SparklineAccessibleView.js +0 -75
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +0 -308
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.js +0 -116
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.js +0 -131
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.js +0 -99
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +0 -82
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMinMax.js +0 -103
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.js +0 -104
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePaths.js +0 -57
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.js +0 -124
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveProvider.js +0 -80
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.js +0 -109
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +0 -85
- package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +0 -526
- package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.js +0 -58
- package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.js +0 -37
- package/esm/sparkline/sparkline-interactive/useMinMaxTransform.js +0 -56
- package/esm/sparkline/sparkline-interactive/useOpacityAnimation.js +0 -23
- package/esm/sparkline/sparkline-interactive/useSparklineInteractiveConstants.js +0 -47
- package/esm/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.js +0 -34
- package/esm/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.js +0 -233
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +0 -104
- package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +0 -565
- package/esm/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.js +0 -117
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
const _excluded = ["d", "fill", "patternSize", "dotSize", "peakOpacity", "baselineOpacity", "xAxisId", "yAxisId", "gradient", "animate", "transitions", "transition"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import { memo, useMemo } from 'react';
|
|
5
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
6
|
-
import { Group } from '@shopify/react-native-skia';
|
|
7
|
-
import { useCartesianChartContext } from '../ChartProvider';
|
|
8
|
-
import { Gradient } from '../gradient';
|
|
9
|
-
import { Path } from '../Path';
|
|
10
|
-
import { createGradient, getBaseline } from '../utils';
|
|
11
|
-
import { getDottedAreaPath } from '../utils/path';
|
|
12
|
-
import { defaultTransition, usePathTransition } from '../utils/transition';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
/**
|
|
15
|
-
* A customizable dotted area gradient component.
|
|
16
|
-
* When no gradient is provided, renders a default gradient based
|
|
17
|
-
* on the fill color and peak/baseline opacities.
|
|
18
|
-
*/
|
|
19
|
-
export const DottedArea = /*#__PURE__*/memo(_ref => {
|
|
20
|
-
var _transitions$update;
|
|
21
|
-
let {
|
|
22
|
-
d,
|
|
23
|
-
fill: fillProp,
|
|
24
|
-
patternSize = 4,
|
|
25
|
-
dotSize = 1,
|
|
26
|
-
peakOpacity = 1,
|
|
27
|
-
baselineOpacity = 0,
|
|
28
|
-
xAxisId,
|
|
29
|
-
yAxisId,
|
|
30
|
-
gradient: gradientProp,
|
|
31
|
-
animate: animateProp,
|
|
32
|
-
transitions,
|
|
33
|
-
transition
|
|
34
|
-
} = _ref,
|
|
35
|
-
pathProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
36
|
-
const theme = useTheme();
|
|
37
|
-
const {
|
|
38
|
-
drawingArea,
|
|
39
|
-
animate,
|
|
40
|
-
layout,
|
|
41
|
-
getXAxis,
|
|
42
|
-
getYAxis
|
|
43
|
-
} = useCartesianChartContext();
|
|
44
|
-
const shouldAnimate = animateProp != null ? animateProp : animate;
|
|
45
|
-
const valueAxisConfig = layout !== 'horizontal' ? getYAxis(yAxisId) : getXAxis(xAxisId);
|
|
46
|
-
const gradientAxis = layout !== 'horizontal' ? 'y' : 'x';
|
|
47
|
-
const fill = useMemo(() => fillProp != null ? fillProp : theme.color.fgPrimary, [fillProp, theme.color.fgPrimary]);
|
|
48
|
-
const updateTransition = useMemo(() => {
|
|
49
|
-
return (transitions == null ? void 0 : transitions.update) !== undefined ? transitions.update : transition !== undefined ? transition : defaultTransition;
|
|
50
|
-
}, [transitions == null ? void 0 : transitions.update, transition]);
|
|
51
|
-
const dottedPath = useMemo(() => {
|
|
52
|
-
if (!drawingArea) return '';
|
|
53
|
-
return getDottedAreaPath({
|
|
54
|
-
x: drawingArea.x,
|
|
55
|
-
y: drawingArea.y,
|
|
56
|
-
width: drawingArea.width,
|
|
57
|
-
height: drawingArea.height
|
|
58
|
-
}, patternSize, dotSize);
|
|
59
|
-
}, [drawingArea, patternSize, dotSize]);
|
|
60
|
-
const clipPath = usePathTransition({
|
|
61
|
-
currentPath: d,
|
|
62
|
-
transitions: {
|
|
63
|
-
update: shouldAnimate ? updateTransition : null
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const gradient = useMemo(() => {
|
|
67
|
-
if (gradientProp) return gradientProp;
|
|
68
|
-
if (!valueAxisConfig) return;
|
|
69
|
-
const baselineValue = getBaseline(valueAxisConfig.domain, valueAxisConfig.baseline);
|
|
70
|
-
return createGradient(valueAxisConfig.domain, baselineValue, fill, peakOpacity, baselineOpacity, gradientAxis);
|
|
71
|
-
}, [gradientProp, valueAxisConfig, fill, peakOpacity, baselineOpacity, gradientAxis]);
|
|
72
|
-
|
|
73
|
-
// Update transition is used for clip path, we skip update animation on Path itself
|
|
74
|
-
return /*#__PURE__*/_jsx(Group, {
|
|
75
|
-
clip: clipPath,
|
|
76
|
-
children: /*#__PURE__*/_jsx(Path, _extends({
|
|
77
|
-
animate: shouldAnimate,
|
|
78
|
-
d: dottedPath,
|
|
79
|
-
fill: fill,
|
|
80
|
-
transition: transition,
|
|
81
|
-
transitions: transitions
|
|
82
|
-
}, pathProps, {
|
|
83
|
-
children: gradient && /*#__PURE__*/_jsx(Gradient, {
|
|
84
|
-
animate: shouldAnimate,
|
|
85
|
-
gradient: gradient,
|
|
86
|
-
transition: (_transitions$update = transitions == null ? void 0 : transitions.update) != null ? _transitions$update : transition,
|
|
87
|
-
xAxisId: xAxisId,
|
|
88
|
-
yAxisId: yAxisId
|
|
89
|
-
})
|
|
90
|
-
}))
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const _excluded = ["d", "fill", "fillOpacity", "gradient", "peakOpacity", "baselineOpacity", "xAxisId", "yAxisId", "animate", "transitions", "transition"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import { memo, useMemo } from 'react';
|
|
5
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
6
|
-
import { useCartesianChartContext } from '../ChartProvider';
|
|
7
|
-
import { Gradient } from '../gradient';
|
|
8
|
-
import { Path } from '../Path';
|
|
9
|
-
import { createGradient, getBaseline } from '../utils';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
/**
|
|
12
|
-
* A customizable gradient area component.
|
|
13
|
-
* When no gradient is provided, renders a default gradient based
|
|
14
|
-
* on the fill color and peak/baseline opacities.
|
|
15
|
-
*/
|
|
16
|
-
export const GradientArea = /*#__PURE__*/memo(_ref => {
|
|
17
|
-
var _transitions$update;
|
|
18
|
-
let {
|
|
19
|
-
d,
|
|
20
|
-
fill: fillProp,
|
|
21
|
-
fillOpacity = 1,
|
|
22
|
-
gradient: gradientProp,
|
|
23
|
-
peakOpacity = 0.3,
|
|
24
|
-
baselineOpacity = 0,
|
|
25
|
-
xAxisId,
|
|
26
|
-
yAxisId,
|
|
27
|
-
animate,
|
|
28
|
-
transitions,
|
|
29
|
-
transition
|
|
30
|
-
} = _ref,
|
|
31
|
-
pathProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32
|
-
const {
|
|
33
|
-
layout,
|
|
34
|
-
getXAxis,
|
|
35
|
-
getYAxis
|
|
36
|
-
} = useCartesianChartContext();
|
|
37
|
-
const theme = useTheme();
|
|
38
|
-
const valueAxisConfig = layout !== 'horizontal' ? getYAxis(yAxisId) : getXAxis(xAxisId);
|
|
39
|
-
const gradientAxis = layout !== 'horizontal' ? 'y' : 'x';
|
|
40
|
-
const fill = useMemo(() => fillProp != null ? fillProp : theme.color.fgPrimary, [fillProp, theme.color.fgPrimary]);
|
|
41
|
-
const gradient = useMemo(() => {
|
|
42
|
-
if (gradientProp) return gradientProp;
|
|
43
|
-
if (!valueAxisConfig) return;
|
|
44
|
-
const baselineValue = getBaseline(valueAxisConfig.domain, valueAxisConfig.baseline);
|
|
45
|
-
return createGradient(valueAxisConfig.domain, baselineValue, fill, peakOpacity, baselineOpacity, gradientAxis);
|
|
46
|
-
}, [gradientProp, valueAxisConfig, fill, peakOpacity, baselineOpacity, gradientAxis]);
|
|
47
|
-
return /*#__PURE__*/_jsx(Path, _extends({
|
|
48
|
-
animate: animate,
|
|
49
|
-
d: d,
|
|
50
|
-
fill: fill,
|
|
51
|
-
fillOpacity: fillOpacity,
|
|
52
|
-
transition: transition,
|
|
53
|
-
transitions: transitions
|
|
54
|
-
}, pathProps, {
|
|
55
|
-
children: gradient && /*#__PURE__*/_jsx(Gradient, {
|
|
56
|
-
animate: animate,
|
|
57
|
-
gradient: gradient,
|
|
58
|
-
transition: (_transitions$update = transitions == null ? void 0 : transitions.update) != null ? _transitions$update : transition,
|
|
59
|
-
xAxisId: xAxisId,
|
|
60
|
-
yAxisId: yAxisId
|
|
61
|
-
})
|
|
62
|
-
}));
|
|
63
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const _excluded = ["d", "fill", "fillOpacity", "xAxisId", "yAxisId", "animate", "transitions", "transition", "gradient"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
6
|
-
import { Gradient } from '../gradient';
|
|
7
|
-
import { Path } from '../Path';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
/**
|
|
10
|
-
* A customizable solid area component.
|
|
11
|
-
* When a gradient is provided, renders with gradient fill.
|
|
12
|
-
* Otherwise, renders with solid fill.
|
|
13
|
-
*/
|
|
14
|
-
export const SolidArea = /*#__PURE__*/memo(_ref => {
|
|
15
|
-
var _transitions$update;
|
|
16
|
-
let {
|
|
17
|
-
d,
|
|
18
|
-
fill,
|
|
19
|
-
fillOpacity = 1,
|
|
20
|
-
xAxisId,
|
|
21
|
-
yAxisId,
|
|
22
|
-
animate,
|
|
23
|
-
transitions,
|
|
24
|
-
transition,
|
|
25
|
-
gradient
|
|
26
|
-
} = _ref,
|
|
27
|
-
pathProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
28
|
-
const theme = useTheme();
|
|
29
|
-
return /*#__PURE__*/_jsx(Path, _extends({
|
|
30
|
-
animate: animate,
|
|
31
|
-
d: d,
|
|
32
|
-
fill: fill != null ? fill : theme.color.fgPrimary,
|
|
33
|
-
fillOpacity: fillOpacity,
|
|
34
|
-
transition: transition,
|
|
35
|
-
transitions: transitions
|
|
36
|
-
}, pathProps, {
|
|
37
|
-
children: gradient && /*#__PURE__*/_jsx(Gradient, {
|
|
38
|
-
animate: animate,
|
|
39
|
-
gradient: gradient,
|
|
40
|
-
transition: (_transitions$update = transitions == null ? void 0 : transitions.update) != null ? _transitions$update : transition,
|
|
41
|
-
xAxisId: xAxisId,
|
|
42
|
-
yAxisId: yAxisId
|
|
43
|
-
})
|
|
44
|
-
}));
|
|
45
|
-
});
|
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import { memo, useCallback, useState } from 'react';
|
|
3
|
-
import { candles as btcCandles } from '@coinbase/cds-common/internal/data/candles';
|
|
4
|
-
import { Button } from '@coinbase/cds-mobile/buttons/Button';
|
|
5
|
-
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
6
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
7
|
-
import { Box, VStack } from '@coinbase/cds-mobile/layout';
|
|
8
|
-
import { DefaultReferenceLineLabel, DottedLine, ReferenceLine } from '../../line';
|
|
9
|
-
import { Scrubber } from '../../scrubber/Scrubber';
|
|
10
|
-
import { AreaChart } from '..';
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
const basicData = [24, 13, 98, 39, 48, 38, 43];
|
|
13
|
-
const baselineThresholdData = [40, 28, 21, 5, 48, 5, 28, 2, 29, 48, 18, 30, 29, 8].map(value => value + 50);
|
|
14
|
-
const BasicExample = () => {
|
|
15
|
-
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": " + basicData[index], []);
|
|
16
|
-
return /*#__PURE__*/_jsx(AreaChart, {
|
|
17
|
-
enableScrubbing: true,
|
|
18
|
-
showYAxis: true,
|
|
19
|
-
accessibilityLabel: "Area chart with " + basicData.length + " data points. Swipe to navigate.",
|
|
20
|
-
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
21
|
-
height: 400,
|
|
22
|
-
series: [{
|
|
23
|
-
id: 'pageViews',
|
|
24
|
-
data: basicData
|
|
25
|
-
}],
|
|
26
|
-
yAxis: {
|
|
27
|
-
showGrid: true,
|
|
28
|
-
domain: {
|
|
29
|
-
min: 0
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
const currentRewardsData = [100, 150, 200, 280, 380, 500, 650, 820, 1020, 1250, 1510, 1800, 2120, 2470, 2850, 3260, 3700, 4170];
|
|
36
|
-
const potentialRewardsData = [150, 220, 300, 400, 520, 660, 820, 1000, 1200, 1420, 1660, 1920, 2200, 2500, 2820, 3160, 3520, 3900];
|
|
37
|
-
const StackedExample = () => {
|
|
38
|
-
const theme = useTheme();
|
|
39
|
-
const getScrubberAccessibilityLabel = useCallback(index => "Point " + (index + 1) + ": current " + currentRewardsData[index] + ", potential " + potentialRewardsData[index], []);
|
|
40
|
-
return /*#__PURE__*/_jsx(AreaChart, {
|
|
41
|
-
enableScrubbing: true,
|
|
42
|
-
showLines: true,
|
|
43
|
-
stacked: true,
|
|
44
|
-
accessibilityLabel: "Stacked rewards chart with " + currentRewardsData.length + " data points. Swipe to navigate.",
|
|
45
|
-
curve: "natural",
|
|
46
|
-
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
47
|
-
height: 256,
|
|
48
|
-
series: [{
|
|
49
|
-
id: 'currentRewards',
|
|
50
|
-
data: currentRewardsData,
|
|
51
|
-
color: theme.color.fg
|
|
52
|
-
}, {
|
|
53
|
-
id: 'potentialRewards',
|
|
54
|
-
data: potentialRewardsData,
|
|
55
|
-
color: theme.color.fgPositive,
|
|
56
|
-
type: 'dotted',
|
|
57
|
-
LineComponent: props => /*#__PURE__*/_jsx(DottedLine, _extends({}, props, {
|
|
58
|
-
dashIntervals: [6, 6]
|
|
59
|
-
}))
|
|
60
|
-
}],
|
|
61
|
-
type: "dotted",
|
|
62
|
-
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const CustomBaselineExample = () => {
|
|
66
|
-
const theme = useTheme();
|
|
67
|
-
const candles = [...btcCandles].reverse().slice(0, 180);
|
|
68
|
-
const prices = candles.map(candle => parseFloat(candle.close));
|
|
69
|
-
const dates = candles.map(candle => new Date(parseInt(candle.start, 10) * 1000));
|
|
70
|
-
const startingPrice = prices[0];
|
|
71
|
-
const formatPrice = useCallback(price => {
|
|
72
|
-
return "$" + price.toLocaleString('en-US', {
|
|
73
|
-
minimumFractionDigits: 2,
|
|
74
|
-
maximumFractionDigits: 2
|
|
75
|
-
});
|
|
76
|
-
}, []);
|
|
77
|
-
const formatPriceInThousands = useCallback(price => {
|
|
78
|
-
return "$" + (price / 1000).toLocaleString('en-US', {
|
|
79
|
-
minimumFractionDigits: 0,
|
|
80
|
-
maximumFractionDigits: 0
|
|
81
|
-
}) + "k";
|
|
82
|
-
}, []);
|
|
83
|
-
const formatDate = useCallback(date => {
|
|
84
|
-
return date.toLocaleDateString('en-US', {
|
|
85
|
-
month: 'short',
|
|
86
|
-
day: 'numeric',
|
|
87
|
-
year: 'numeric'
|
|
88
|
-
});
|
|
89
|
-
}, []);
|
|
90
|
-
const formatLabel = useCallback(dataIndex => formatPrice(prices[dataIndex]) + " " + formatDate(dates[dataIndex]), [dates, formatDate, formatPrice, prices]);
|
|
91
|
-
const PriceLabel = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(DefaultReferenceLineLabel, _extends({}, props, {
|
|
92
|
-
background: theme.color.bgSecondary,
|
|
93
|
-
borderRadius: 12.5,
|
|
94
|
-
color: theme.color.fg,
|
|
95
|
-
dx: 12,
|
|
96
|
-
font: "label1",
|
|
97
|
-
horizontalAlignment: "left",
|
|
98
|
-
inset: {
|
|
99
|
-
top: 4,
|
|
100
|
-
bottom: 4,
|
|
101
|
-
left: 8,
|
|
102
|
-
right: 8
|
|
103
|
-
}
|
|
104
|
-
})));
|
|
105
|
-
const chartAccessibilityLabel = "Bitcoin area chart with custom baseline. Current price: " + formatPrice(prices[prices.length - 1]) + ". Swipe to navigate.";
|
|
106
|
-
const getScrubberAccessibilityLabel = useCallback(index => formatPrice(prices[index]) + " " + formatDate(dates[index]), [dates, formatDate, formatPrice, prices]);
|
|
107
|
-
return /*#__PURE__*/_jsxs(AreaChart, {
|
|
108
|
-
enableScrubbing: true,
|
|
109
|
-
showLines: true,
|
|
110
|
-
showYAxis: true,
|
|
111
|
-
accessibilityLabel: chartAccessibilityLabel,
|
|
112
|
-
fillOpacity: 0.5,
|
|
113
|
-
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
114
|
-
height: 300,
|
|
115
|
-
series: [{
|
|
116
|
-
id: 'prices',
|
|
117
|
-
data: prices,
|
|
118
|
-
gradient: {
|
|
119
|
-
stops: [{
|
|
120
|
-
offset: startingPrice,
|
|
121
|
-
color: theme.color.fgNegative
|
|
122
|
-
}, {
|
|
123
|
-
offset: startingPrice,
|
|
124
|
-
color: theme.color.fgPositive
|
|
125
|
-
}]
|
|
126
|
-
}
|
|
127
|
-
}],
|
|
128
|
-
yAxis: {
|
|
129
|
-
baseline: startingPrice,
|
|
130
|
-
showGrid: true,
|
|
131
|
-
tickLabelFormatter: formatPriceInThousands,
|
|
132
|
-
domain: {
|
|
133
|
-
min: 70000,
|
|
134
|
-
max: 120000
|
|
135
|
-
},
|
|
136
|
-
ticks: [80000, 100000, 120000]
|
|
137
|
-
},
|
|
138
|
-
children: [/*#__PURE__*/_jsx(Scrubber, {
|
|
139
|
-
labelElevated: true,
|
|
140
|
-
label: formatLabel
|
|
141
|
-
}), /*#__PURE__*/_jsx(ReferenceLine, {
|
|
142
|
-
LabelComponent: PriceLabel,
|
|
143
|
-
LineComponent: props => /*#__PURE__*/_jsx(DottedLine, _extends({}, props, {
|
|
144
|
-
dashIntervals: [0, 16],
|
|
145
|
-
strokeWidth: 3
|
|
146
|
-
})),
|
|
147
|
-
dataY: startingPrice,
|
|
148
|
-
label: formatPrice(startingPrice),
|
|
149
|
-
stroke: theme.color.fg
|
|
150
|
-
})]
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
const AxisBaselineThresholdExample = () => {
|
|
154
|
-
const theme = useTheme();
|
|
155
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
156
|
-
gap: 2,
|
|
157
|
-
children: [/*#__PURE__*/_jsx(AreaChart, {
|
|
158
|
-
enableScrubbing: true,
|
|
159
|
-
showLines: true,
|
|
160
|
-
showYAxis: true,
|
|
161
|
-
accessibilityLabel: "Area chart with threshold baseline at 30.",
|
|
162
|
-
getScrubberAccessibilityLabel: index => "Point " + (index + 1) + ": " + baselineThresholdData[index],
|
|
163
|
-
height: 220,
|
|
164
|
-
inset: 0,
|
|
165
|
-
series: [{
|
|
166
|
-
id: 'axis-baseline-threshold-vertical',
|
|
167
|
-
data: baselineThresholdData,
|
|
168
|
-
gradient: {
|
|
169
|
-
stops: [{
|
|
170
|
-
offset: 30,
|
|
171
|
-
color: theme.color.fgNegative
|
|
172
|
-
}, {
|
|
173
|
-
offset: 30,
|
|
174
|
-
color: theme.color.fgPositive
|
|
175
|
-
}]
|
|
176
|
-
}
|
|
177
|
-
}],
|
|
178
|
-
type: "dotted",
|
|
179
|
-
yAxis: {
|
|
180
|
-
showGrid: true,
|
|
181
|
-
baseline: 30
|
|
182
|
-
},
|
|
183
|
-
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
184
|
-
}), /*#__PURE__*/_jsx(AreaChart, {
|
|
185
|
-
enableScrubbing: true,
|
|
186
|
-
showLines: true,
|
|
187
|
-
showXAxis: true,
|
|
188
|
-
accessibilityLabel: "Horizontal area chart with threshold baseline at 30.",
|
|
189
|
-
getScrubberAccessibilityLabel: index => "Point " + (index + 1) + ": " + baselineThresholdData[index],
|
|
190
|
-
height: 220,
|
|
191
|
-
inset: 0,
|
|
192
|
-
layout: "horizontal",
|
|
193
|
-
series: [{
|
|
194
|
-
id: 'axis-baseline-threshold-horizontal',
|
|
195
|
-
data: baselineThresholdData,
|
|
196
|
-
gradient: {
|
|
197
|
-
stops: [{
|
|
198
|
-
offset: 30,
|
|
199
|
-
color: theme.color.fgNegative
|
|
200
|
-
}, {
|
|
201
|
-
offset: 30,
|
|
202
|
-
color: theme.color.fgPositive
|
|
203
|
-
}]
|
|
204
|
-
}
|
|
205
|
-
}],
|
|
206
|
-
type: "dotted",
|
|
207
|
-
xAxis: {
|
|
208
|
-
showGrid: true,
|
|
209
|
-
baseline: 30
|
|
210
|
-
},
|
|
211
|
-
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
212
|
-
})]
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// Regression repro for CDS-2065. The default baseline is 0; alternating between
|
|
217
|
-
// an all-positive dataset (2 gradient stops) and a negative-crossing dataset
|
|
218
|
-
// (3 gradient stops) causes the Gradient component to swap stop counts between
|
|
219
|
-
// renders. Before the fix this crashed with `ReanimatedError: Positions array
|
|
220
|
-
// must have the same size as colors array`.
|
|
221
|
-
const positiveOnlyData = [10, 25, 15, 40, 30, 50, 35];
|
|
222
|
-
const crossesBaselineData = [-20, 25, -15, 40, -30, 50, 35];
|
|
223
|
-
const BaselineCrossingExample = () => {
|
|
224
|
-
const [crosses, setCrosses] = useState(false);
|
|
225
|
-
const data = crosses ? crossesBaselineData : positiveOnlyData;
|
|
226
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
227
|
-
gap: 2,
|
|
228
|
-
children: [/*#__PURE__*/_jsx(AreaChart, {
|
|
229
|
-
showLines: true,
|
|
230
|
-
showYAxis: true,
|
|
231
|
-
accessibilityLabel: "Area chart toggling across the y-axis baseline",
|
|
232
|
-
height: 220,
|
|
233
|
-
series: [{
|
|
234
|
-
id: 'flow',
|
|
235
|
-
data
|
|
236
|
-
}],
|
|
237
|
-
type: "gradient",
|
|
238
|
-
yAxis: {
|
|
239
|
-
baseline: 0,
|
|
240
|
-
showGrid: true
|
|
241
|
-
}
|
|
242
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
243
|
-
paddingX: 2,
|
|
244
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
245
|
-
compact: true,
|
|
246
|
-
onPress: () => setCrosses(c => !c),
|
|
247
|
-
variant: "secondary",
|
|
248
|
-
children: "Toggle baseline crossing"
|
|
249
|
-
})
|
|
250
|
-
})]
|
|
251
|
-
});
|
|
252
|
-
};
|
|
253
|
-
const AreaChartStories = () => {
|
|
254
|
-
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
255
|
-
children: [/*#__PURE__*/_jsx(Example, {
|
|
256
|
-
title: "Basic",
|
|
257
|
-
children: /*#__PURE__*/_jsx(BasicExample, {})
|
|
258
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
259
|
-
title: "Stacked",
|
|
260
|
-
children: /*#__PURE__*/_jsx(StackedExample, {})
|
|
261
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
262
|
-
title: "Negative Values",
|
|
263
|
-
children: /*#__PURE__*/_jsx(AreaChart, {
|
|
264
|
-
enableScrubbing: true,
|
|
265
|
-
showLines: true,
|
|
266
|
-
showYAxis: true,
|
|
267
|
-
accessibilityLabel: "Area chart with negative values. 7 data points. Swipe to navigate.",
|
|
268
|
-
getScrubberAccessibilityLabel: index => "Point " + (index + 1) + ": " + [24, 13, -98, 39, 48, 38, 43][index],
|
|
269
|
-
height: 150,
|
|
270
|
-
series: [{
|
|
271
|
-
id: 'pageViews',
|
|
272
|
-
data: [24, 13, -98, 39, 48, 38, 43]
|
|
273
|
-
}],
|
|
274
|
-
type: "gradient",
|
|
275
|
-
yAxis: {
|
|
276
|
-
showGrid: true
|
|
277
|
-
},
|
|
278
|
-
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
279
|
-
})
|
|
280
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
281
|
-
title: "Baseline Crossing (CDS-2065 repro)",
|
|
282
|
-
children: /*#__PURE__*/_jsx(BaselineCrossingExample, {})
|
|
283
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
284
|
-
title: "Axis Baseline",
|
|
285
|
-
children: /*#__PURE__*/_jsx(AreaChart, {
|
|
286
|
-
enableScrubbing: true,
|
|
287
|
-
showLines: true,
|
|
288
|
-
showYAxis: true,
|
|
289
|
-
accessibilityLabel: "Area chart with custom axis baseline at 100.",
|
|
290
|
-
getScrubberAccessibilityLabel: index => "Point " + (index + 1) + ": " + [112, 97, 121, 103, 129, 118, 94][index],
|
|
291
|
-
height: 220,
|
|
292
|
-
series: [{
|
|
293
|
-
id: 'netFlow',
|
|
294
|
-
data: [112, 97, 121, 103, 129, 118, 94]
|
|
295
|
-
}],
|
|
296
|
-
yAxis: {
|
|
297
|
-
baseline: 100,
|
|
298
|
-
domain: {
|
|
299
|
-
min: 80,
|
|
300
|
-
max: 140
|
|
301
|
-
},
|
|
302
|
-
showGrid: true,
|
|
303
|
-
tickLabelFormatter: value => "" + value
|
|
304
|
-
},
|
|
305
|
-
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
306
|
-
})
|
|
307
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
308
|
-
title: "Axis Baseline Threshold",
|
|
309
|
-
children: /*#__PURE__*/_jsx(AxisBaselineThresholdExample, {})
|
|
310
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
311
|
-
title: "Custom Baseline",
|
|
312
|
-
children: /*#__PURE__*/_jsx(CustomBaselineExample, {})
|
|
313
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
314
|
-
title: "Styles",
|
|
315
|
-
children: /*#__PURE__*/_jsx(AreaChart, {
|
|
316
|
-
enableScrubbing: false,
|
|
317
|
-
height: 350,
|
|
318
|
-
series: [{
|
|
319
|
-
id: 'visitors',
|
|
320
|
-
data: [450, 520, 480, 600, 750, 680, 590],
|
|
321
|
-
label: 'Weekly Visitors',
|
|
322
|
-
color: '#fb4d3d',
|
|
323
|
-
type: 'dotted'
|
|
324
|
-
}, {
|
|
325
|
-
id: 'repeatVisitors',
|
|
326
|
-
data: [250, 200, 150, 140, 100, 80, 50],
|
|
327
|
-
label: 'Weekly Repeat Visitors',
|
|
328
|
-
color: '#16a34a'
|
|
329
|
-
}, {
|
|
330
|
-
id: 'signups',
|
|
331
|
-
data: [45, 62, 55, 250, 380, 400, 450],
|
|
332
|
-
label: 'Weekly Signups',
|
|
333
|
-
color: '#2563eb',
|
|
334
|
-
type: 'gradient'
|
|
335
|
-
}]
|
|
336
|
-
})
|
|
337
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
338
|
-
title: "Horizontal Layout",
|
|
339
|
-
children: /*#__PURE__*/_jsx(AreaChart, {
|
|
340
|
-
enableScrubbing: true,
|
|
341
|
-
showLines: true,
|
|
342
|
-
showXAxis: true,
|
|
343
|
-
showYAxis: true,
|
|
344
|
-
accessibilityLabel: "Volume by asset. 5 data points. Swipe to navigate.",
|
|
345
|
-
getScrubberAccessibilityLabel: index => ['BTC', 'ETH', 'SOL', 'DOGE', 'ADA'][index] + ": " + [68, 54, 43, 29, 18][index] + "%",
|
|
346
|
-
height: 280,
|
|
347
|
-
layout: "horizontal",
|
|
348
|
-
series: [{
|
|
349
|
-
id: 'volume',
|
|
350
|
-
data: [68, 54, 43, 29, 18],
|
|
351
|
-
label: 'Volume'
|
|
352
|
-
}],
|
|
353
|
-
type: "gradient",
|
|
354
|
-
xAxis: {
|
|
355
|
-
domain: {
|
|
356
|
-
min: 0,
|
|
357
|
-
max: 80
|
|
358
|
-
},
|
|
359
|
-
tickLabelFormatter: value => value + "%"
|
|
360
|
-
},
|
|
361
|
-
yAxis: {
|
|
362
|
-
data: ['BTC', 'ETH', 'SOL', 'DOGE', 'ADA'],
|
|
363
|
-
scaleType: 'band'
|
|
364
|
-
},
|
|
365
|
-
children: /*#__PURE__*/_jsx(Scrubber, {})
|
|
366
|
-
})
|
|
367
|
-
})]
|
|
368
|
-
});
|
|
369
|
-
};
|
|
370
|
-
export default AreaChartStories;
|
package/esm/chart/area/index.js
DELETED
package/esm/chart/axis/Axis.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { accessoryFadeTransitionDuration } from '../utils';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Animation transition for axis elements (grid lines, tick marks, tick labels).
|
|
5
|
-
* Matches web's axisUpdateAnimationTransition timing.
|
|
6
|
-
*/
|
|
7
|
-
export const axisUpdateAnimationTransition = {
|
|
8
|
-
duration: accessoryFadeTransitionDuration
|
|
9
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { ChartText } from '../text';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
/**
|
|
6
|
-
* DefaultAxisTickLabel is the default label component for axis tick labels.
|
|
7
|
-
* Provides standard styling for both X and Y axis tick labels.
|
|
8
|
-
*/
|
|
9
|
-
export const DefaultAxisTickLabel = /*#__PURE__*/memo(props => {
|
|
10
|
-
return /*#__PURE__*/_jsx(ChartText, _extends({}, props));
|
|
11
|
-
});
|