@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,659 +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, useMemo, useState } from 'react';
|
|
3
|
-
import { Image, ScrollView, StyleSheet } from 'react-native';
|
|
4
|
-
import { assets } from '@coinbase/cds-common/internal/data/assets';
|
|
5
|
-
import { candles as btcCandles } from '@coinbase/cds-common/internal/data/candles';
|
|
6
|
-
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
7
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
8
|
-
import { Box, HStack, VStack } from '@coinbase/cds-mobile/layout';
|
|
9
|
-
import { Text } from '@coinbase/cds-mobile/typography';
|
|
10
|
-
import { Circle, Group } from '@shopify/react-native-skia';
|
|
11
|
-
import { Area } from '../area/Area';
|
|
12
|
-
import { XAxis, YAxis } from '../axis';
|
|
13
|
-
import { BarPlot } from '../bar/BarPlot';
|
|
14
|
-
import { useCartesianChartContext } from '../ChartProvider';
|
|
15
|
-
import { Line } from '../line/Line';
|
|
16
|
-
import { Point } from '../point/Point';
|
|
17
|
-
import { Scrubber } from '../scrubber/Scrubber';
|
|
18
|
-
import { ChartText } from '../text';
|
|
19
|
-
import { isCategoricalScale } from '../utils';
|
|
20
|
-
import { CartesianChart, DottedArea, ReferenceLine, SolidLine } from '../';
|
|
21
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
const defaultChartHeight = 250;
|
|
23
|
-
const LineStyles = () => {
|
|
24
|
-
const topChartData = [15, 28, 32, 44, 46, 36, 40, 45, 48, 38];
|
|
25
|
-
const upperMiddleChartData = [12, 23, 21, 29, 34, 28, 31, 38, 42, 35];
|
|
26
|
-
const lowerMiddleChartData = [8, 15, 14, 25, 20, 18, 22, 28, 24, 30];
|
|
27
|
-
const bottomChartData = [4, 8, 11, 15, 16, 14, 16, 10, 12, 14];
|
|
28
|
-
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
29
|
-
height: defaultChartHeight,
|
|
30
|
-
series: [{
|
|
31
|
-
id: 'top',
|
|
32
|
-
data: topChartData
|
|
33
|
-
}, {
|
|
34
|
-
id: 'upperMiddle',
|
|
35
|
-
data: upperMiddleChartData,
|
|
36
|
-
color: '#ef4444'
|
|
37
|
-
}, {
|
|
38
|
-
id: 'lowerMiddle',
|
|
39
|
-
data: lowerMiddleChartData,
|
|
40
|
-
color: '#f59e0b'
|
|
41
|
-
}, {
|
|
42
|
-
id: 'bottom',
|
|
43
|
-
data: bottomChartData,
|
|
44
|
-
color: '#800080'
|
|
45
|
-
}],
|
|
46
|
-
children: [/*#__PURE__*/_jsx(Line, {
|
|
47
|
-
seriesId: "top"
|
|
48
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
49
|
-
seriesId: "upperMiddle",
|
|
50
|
-
type: "dotted"
|
|
51
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
52
|
-
LineComponent: lineProps => /*#__PURE__*/_jsx(SolidLine, _extends({}, lineProps, {
|
|
53
|
-
strokeWidth: 4
|
|
54
|
-
})),
|
|
55
|
-
curve: "natural",
|
|
56
|
-
seriesId: "lowerMiddle"
|
|
57
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
58
|
-
showArea: true,
|
|
59
|
-
AreaComponent: DottedArea,
|
|
60
|
-
curve: "step",
|
|
61
|
-
seriesId: "bottom"
|
|
62
|
-
})]
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const MultipleChart = () => {
|
|
66
|
-
const barData = [1, 2, 3, 2, 1];
|
|
67
|
-
const lineData = [4, 3, 1, 3, 4];
|
|
68
|
-
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
69
|
-
height: defaultChartHeight,
|
|
70
|
-
series: [{
|
|
71
|
-
id: 'bar',
|
|
72
|
-
data: barData
|
|
73
|
-
}, {
|
|
74
|
-
id: 'line',
|
|
75
|
-
data: lineData
|
|
76
|
-
}],
|
|
77
|
-
children: [/*#__PURE__*/_jsx(Area, {
|
|
78
|
-
seriesId: "bar",
|
|
79
|
-
type: "dotted"
|
|
80
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
81
|
-
curve: "natural",
|
|
82
|
-
seriesId: "line"
|
|
83
|
-
})]
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
const EarningsHistory = () => {
|
|
87
|
-
const theme = useTheme();
|
|
88
|
-
const CirclePlot = /*#__PURE__*/memo(_ref => {
|
|
89
|
-
let {
|
|
90
|
-
seriesId,
|
|
91
|
-
opacity = 1
|
|
92
|
-
} = _ref;
|
|
93
|
-
const {
|
|
94
|
-
getSeries,
|
|
95
|
-
getSeriesData,
|
|
96
|
-
getXScale,
|
|
97
|
-
getYScale
|
|
98
|
-
} = useCartesianChartContext();
|
|
99
|
-
const series = getSeries(seriesId);
|
|
100
|
-
const data = getSeriesData(seriesId);
|
|
101
|
-
const xScale = getXScale();
|
|
102
|
-
const yScale = getYScale(series == null ? void 0 : series.yAxisId);
|
|
103
|
-
if (!xScale || !yScale || !data || !isCategoricalScale(xScale)) return null;
|
|
104
|
-
const yScaleSize = Math.abs(yScale.range()[1] - yScale.range()[0]);
|
|
105
|
-
|
|
106
|
-
// Have circle diameter be the smaller of the x scale bandwidth or 10% of the y space available
|
|
107
|
-
const diameter = Math.min(xScale.bandwidth(), yScaleSize / 10);
|
|
108
|
-
return /*#__PURE__*/_jsx(Group, {
|
|
109
|
-
children: data.map((value, index) => {
|
|
110
|
-
if (value === null || value === undefined) return null;
|
|
111
|
-
|
|
112
|
-
// Get x position from band scale - center of the band
|
|
113
|
-
const xPos = xScale(index);
|
|
114
|
-
if (xPos === undefined) return null;
|
|
115
|
-
const centerX = xPos + xScale.bandwidth() / 2;
|
|
116
|
-
|
|
117
|
-
// Get y position from value
|
|
118
|
-
const yValue = Array.isArray(value) ? value[1] : value;
|
|
119
|
-
const centerY = yScale(yValue);
|
|
120
|
-
if (centerY === undefined) return null;
|
|
121
|
-
return /*#__PURE__*/_jsx(Circle, {
|
|
122
|
-
color: (series == null ? void 0 : series.color) || theme.color.fgPrimary,
|
|
123
|
-
cx: centerX,
|
|
124
|
-
cy: centerY,
|
|
125
|
-
opacity: opacity,
|
|
126
|
-
r: diameter / 2
|
|
127
|
-
}, seriesId + "-" + index);
|
|
128
|
-
})
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
const quarters = useMemo(() => ['Q1', 'Q2', 'Q3', 'Q4'], []);
|
|
132
|
-
const estimatedEPS = useMemo(() => [1.71, 1.82, 1.93, 2.34], []);
|
|
133
|
-
const actualEPS = useMemo(() => [1.68, 1.83, 2.01, 2.24], []);
|
|
134
|
-
const formatEarningAmount = useCallback(value => {
|
|
135
|
-
return "$" + value.toLocaleString('en-US', {
|
|
136
|
-
minimumFractionDigits: 2,
|
|
137
|
-
maximumFractionDigits: 2
|
|
138
|
-
});
|
|
139
|
-
}, []);
|
|
140
|
-
const surprisePercentage = useCallback(index => {
|
|
141
|
-
const percentage = (actualEPS[index] - estimatedEPS[index]) / estimatedEPS[index];
|
|
142
|
-
const percentageString = percentage.toLocaleString('en-US', {
|
|
143
|
-
style: 'percent',
|
|
144
|
-
minimumFractionDigits: 2,
|
|
145
|
-
maximumFractionDigits: 2
|
|
146
|
-
});
|
|
147
|
-
const prefix = percentage > 0 ? '+' : '';
|
|
148
|
-
return "" + prefix + percentageString;
|
|
149
|
-
}, [actualEPS, estimatedEPS]);
|
|
150
|
-
const styles = StyleSheet.create({
|
|
151
|
-
legendDot: {
|
|
152
|
-
width: 10,
|
|
153
|
-
height: 10,
|
|
154
|
-
borderRadius: 1000,
|
|
155
|
-
backgroundColor: theme.color.bgPositive
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
const LegendEntry = /*#__PURE__*/memo(_ref2 => {
|
|
159
|
-
let {
|
|
160
|
-
opacity = 1,
|
|
161
|
-
label
|
|
162
|
-
} = _ref2;
|
|
163
|
-
return /*#__PURE__*/_jsxs(Box, {
|
|
164
|
-
alignItems: "center",
|
|
165
|
-
flexDirection: "row",
|
|
166
|
-
gap: 0.5,
|
|
167
|
-
children: [/*#__PURE__*/_jsx(Box, {
|
|
168
|
-
style: [styles.legendDot, {
|
|
169
|
-
opacity
|
|
170
|
-
}]
|
|
171
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
172
|
-
font: "label2",
|
|
173
|
-
children: label
|
|
174
|
-
})]
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
178
|
-
gap: 0.5,
|
|
179
|
-
children: [/*#__PURE__*/_jsxs(CartesianChart, {
|
|
180
|
-
height: defaultChartHeight,
|
|
181
|
-
inset: {
|
|
182
|
-
top: 32,
|
|
183
|
-
bottom: 0,
|
|
184
|
-
left: 0,
|
|
185
|
-
right: 0
|
|
186
|
-
},
|
|
187
|
-
series: [{
|
|
188
|
-
id: 'estimatedEPS',
|
|
189
|
-
data: estimatedEPS,
|
|
190
|
-
color: theme.color.bgPositive
|
|
191
|
-
}, {
|
|
192
|
-
id: 'actualEPS',
|
|
193
|
-
data: actualEPS,
|
|
194
|
-
color: theme.color.bgPositive
|
|
195
|
-
}],
|
|
196
|
-
xAxis: {
|
|
197
|
-
scaleType: 'band',
|
|
198
|
-
categoryPadding: 0.25
|
|
199
|
-
},
|
|
200
|
-
children: [/*#__PURE__*/_jsx(YAxis, {
|
|
201
|
-
showGrid: true,
|
|
202
|
-
position: "left",
|
|
203
|
-
requestedTickCount: 3,
|
|
204
|
-
tickLabelFormatter: formatEarningAmount
|
|
205
|
-
}), /*#__PURE__*/_jsx(XAxis, {
|
|
206
|
-
height: 20,
|
|
207
|
-
tickLabelFormatter: index => quarters[index]
|
|
208
|
-
}), /*#__PURE__*/_jsx(XAxis, {
|
|
209
|
-
height: 20,
|
|
210
|
-
tickLabelFormatter: surprisePercentage
|
|
211
|
-
}), /*#__PURE__*/_jsx(CirclePlot, {
|
|
212
|
-
opacity: 0.5,
|
|
213
|
-
seriesId: "estimatedEPS"
|
|
214
|
-
}), /*#__PURE__*/_jsx(CirclePlot, {
|
|
215
|
-
seriesId: "actualEPS"
|
|
216
|
-
})]
|
|
217
|
-
}), /*#__PURE__*/_jsxs(HStack, {
|
|
218
|
-
gap: 2,
|
|
219
|
-
justifyContent: "flex-end",
|
|
220
|
-
children: [/*#__PURE__*/_jsx(LegendEntry, {
|
|
221
|
-
label: "Estimated EPS",
|
|
222
|
-
opacity: 0.5
|
|
223
|
-
}), /*#__PURE__*/_jsx(LegendEntry, {
|
|
224
|
-
label: "Actual EPS"
|
|
225
|
-
})]
|
|
226
|
-
})]
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
const btcData = btcCandles.slice(0, 180).reverse();
|
|
230
|
-
const btcPrices = btcData.map(candle => parseFloat(candle.close));
|
|
231
|
-
const btcVolumes = btcData.map(candle => parseFloat(candle.volume));
|
|
232
|
-
const btcDates = btcData.map(candle => new Date(parseInt(candle.start) * 1000));
|
|
233
|
-
const displayIndex = btcPrices.length - 1;
|
|
234
|
-
const currentPrice = btcPrices[displayIndex];
|
|
235
|
-
const currentDate = btcDates[displayIndex];
|
|
236
|
-
const PriceWithVolumeChart = /*#__PURE__*/memo(_ref3 => {
|
|
237
|
-
let {
|
|
238
|
-
onScrubberPositionChange
|
|
239
|
-
} = _ref3;
|
|
240
|
-
const theme = useTheme();
|
|
241
|
-
const formatPriceInThousands = useCallback(price => {
|
|
242
|
-
return "$" + (price / 1000).toLocaleString('en-US', {
|
|
243
|
-
minimumFractionDigits: 0,
|
|
244
|
-
maximumFractionDigits: 2
|
|
245
|
-
}) + "k";
|
|
246
|
-
}, []);
|
|
247
|
-
const formatDate = useCallback(date => {
|
|
248
|
-
return date.toLocaleDateString('en-US', {
|
|
249
|
-
month: 'short',
|
|
250
|
-
day: 'numeric'
|
|
251
|
-
});
|
|
252
|
-
}, []);
|
|
253
|
-
const formatVolume = useCallback(volume => {
|
|
254
|
-
return (volume / 1000).toFixed(2) + "K";
|
|
255
|
-
}, []);
|
|
256
|
-
const scrubberLabel = useCallback(dataIndex => {
|
|
257
|
-
return formatDate(btcDates[dataIndex]);
|
|
258
|
-
}, [formatDate]);
|
|
259
|
-
const chartAccessibilityLabel = useMemo(() => {
|
|
260
|
-
const lastIndex = btcPrices.length - 1;
|
|
261
|
-
return "Bitcoin chart. Current date " + formatDate(btcDates[lastIndex]) + ". Current price " + formatPriceInThousands(btcPrices[lastIndex]) + ". Current volume " + formatVolume(btcVolumes[lastIndex]) + ".";
|
|
262
|
-
}, [formatDate, formatPriceInThousands, formatVolume]);
|
|
263
|
-
const getScrubberAccessibilityLabel = useCallback(dataIndex => "Bitcoin on " + formatDate(btcDates[dataIndex]) + ". Price " + formatPriceInThousands(btcPrices[dataIndex]) + ". Volume " + formatVolume(btcVolumes[dataIndex]) + ".", [formatDate, formatPriceInThousands, formatVolume]);
|
|
264
|
-
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
265
|
-
enableScrubbing: true,
|
|
266
|
-
accessibilityLabel: chartAccessibilityLabel,
|
|
267
|
-
getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
|
|
268
|
-
height: defaultChartHeight,
|
|
269
|
-
onScrubberPositionChange: onScrubberPositionChange,
|
|
270
|
-
series: [{
|
|
271
|
-
id: 'prices',
|
|
272
|
-
data: btcPrices,
|
|
273
|
-
color: assets.btc.color,
|
|
274
|
-
yAxisId: 'price'
|
|
275
|
-
}, {
|
|
276
|
-
id: 'volume',
|
|
277
|
-
data: btcVolumes,
|
|
278
|
-
color: theme.color.fgMuted,
|
|
279
|
-
yAxisId: 'volume'
|
|
280
|
-
}],
|
|
281
|
-
xAxis: {
|
|
282
|
-
scaleType: 'band',
|
|
283
|
-
range: _ref4 => {
|
|
284
|
-
let {
|
|
285
|
-
min,
|
|
286
|
-
max
|
|
287
|
-
} = _ref4;
|
|
288
|
-
return {
|
|
289
|
-
min,
|
|
290
|
-
max: max - 8
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
yAxis: [{
|
|
295
|
-
id: 'price',
|
|
296
|
-
domain: _ref5 => {
|
|
297
|
-
let {
|
|
298
|
-
min,
|
|
299
|
-
max
|
|
300
|
-
} = _ref5;
|
|
301
|
-
return {
|
|
302
|
-
min: min * 0.9,
|
|
303
|
-
max
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
}, {
|
|
307
|
-
id: 'volume',
|
|
308
|
-
range: _ref6 => {
|
|
309
|
-
let {
|
|
310
|
-
min,
|
|
311
|
-
max
|
|
312
|
-
} = _ref6;
|
|
313
|
-
return {
|
|
314
|
-
min: max - 32,
|
|
315
|
-
max
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
}],
|
|
319
|
-
children: [/*#__PURE__*/_jsx(YAxis, {
|
|
320
|
-
showGrid: true,
|
|
321
|
-
axisId: "price",
|
|
322
|
-
tickLabelFormatter: formatPriceInThousands,
|
|
323
|
-
width: 20
|
|
324
|
-
}), /*#__PURE__*/_jsx(BarPlot, {
|
|
325
|
-
seriesIds: ['volume']
|
|
326
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
327
|
-
showArea: true,
|
|
328
|
-
seriesId: "prices"
|
|
329
|
-
}), /*#__PURE__*/_jsx(Scrubber, {
|
|
330
|
-
label: scrubberLabel,
|
|
331
|
-
seriesIds: ['prices']
|
|
332
|
-
})]
|
|
333
|
-
});
|
|
334
|
-
});
|
|
335
|
-
const PriceWithVolumeHeader = /*#__PURE__*/memo(_ref7 => {
|
|
336
|
-
let {
|
|
337
|
-
currentIndex
|
|
338
|
-
} = _ref7;
|
|
339
|
-
const theme = useTheme();
|
|
340
|
-
const formatPrice = useCallback(price => {
|
|
341
|
-
return "$" + price.toLocaleString('en-US', {
|
|
342
|
-
minimumFractionDigits: 2,
|
|
343
|
-
maximumFractionDigits: 2
|
|
344
|
-
});
|
|
345
|
-
}, []);
|
|
346
|
-
const formatDate = useCallback(date => {
|
|
347
|
-
return date.toLocaleDateString('en-US', {
|
|
348
|
-
month: 'short',
|
|
349
|
-
day: 'numeric'
|
|
350
|
-
});
|
|
351
|
-
}, []);
|
|
352
|
-
const formatVolume = useCallback(volume => {
|
|
353
|
-
return (volume / 1000).toFixed(2) + "K";
|
|
354
|
-
}, []);
|
|
355
|
-
const volumeText = useMemo(() => {
|
|
356
|
-
return formatVolume(currentIndex !== undefined ? btcVolumes[currentIndex] : btcVolumes[displayIndex]);
|
|
357
|
-
}, [currentIndex, formatVolume]);
|
|
358
|
-
return /*#__PURE__*/_jsxs(HStack, {
|
|
359
|
-
gap: 2,
|
|
360
|
-
justifyContent: "space-between",
|
|
361
|
-
paddingX: 0,
|
|
362
|
-
children: [/*#__PURE__*/_jsxs(VStack, {
|
|
363
|
-
gap: 0,
|
|
364
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
365
|
-
font: "title1",
|
|
366
|
-
children: "Bitcoin"
|
|
367
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
368
|
-
font: "title2",
|
|
369
|
-
children: formatPrice(currentPrice)
|
|
370
|
-
})]
|
|
371
|
-
}), /*#__PURE__*/_jsxs(HStack, {
|
|
372
|
-
gap: 2,
|
|
373
|
-
children: [/*#__PURE__*/_jsxs(VStack, {
|
|
374
|
-
alignItems: "flex-end",
|
|
375
|
-
justifyContent: "center",
|
|
376
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
377
|
-
font: "label1",
|
|
378
|
-
children: formatDate(currentDate)
|
|
379
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
380
|
-
font: "label2",
|
|
381
|
-
children: volumeText
|
|
382
|
-
})]
|
|
383
|
-
}), /*#__PURE__*/_jsx(VStack, {
|
|
384
|
-
justifyContent: "center",
|
|
385
|
-
children: /*#__PURE__*/_jsx(Image, {
|
|
386
|
-
source: {
|
|
387
|
-
uri: assets.btc.imageUrl
|
|
388
|
-
},
|
|
389
|
-
style: {
|
|
390
|
-
width: theme.iconSize.l,
|
|
391
|
-
height: theme.iconSize.l,
|
|
392
|
-
borderRadius: 1000
|
|
393
|
-
}
|
|
394
|
-
})
|
|
395
|
-
})]
|
|
396
|
-
})]
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
const PriceWithVolume = /*#__PURE__*/memo(() => {
|
|
400
|
-
const [currentIndex, setCurrentIndex] = useState();
|
|
401
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
402
|
-
gap: 2,
|
|
403
|
-
children: [/*#__PURE__*/_jsx(PriceWithVolumeHeader, {
|
|
404
|
-
currentIndex: currentIndex
|
|
405
|
-
}), /*#__PURE__*/_jsx(PriceWithVolumeChart, {
|
|
406
|
-
onScrubberPositionChange: setCurrentIndex
|
|
407
|
-
})]
|
|
408
|
-
});
|
|
409
|
-
});
|
|
410
|
-
function TradingTrends() {
|
|
411
|
-
const theme = useTheme();
|
|
412
|
-
const profitData = [34, 24, 28, -4, 8, -16, -3, 12, 24, 18, 20, 28];
|
|
413
|
-
const gains = profitData.map(value => value > 0 ? value : 0);
|
|
414
|
-
const losses = profitData.map(value => value < 0 ? value : 0);
|
|
415
|
-
const renderProfit = useCallback(value => {
|
|
416
|
-
return "$" + value + "M";
|
|
417
|
-
}, []);
|
|
418
|
-
const ThinSolidLine = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SolidLine, _extends({}, props, {
|
|
419
|
-
strokeWidth: 1
|
|
420
|
-
})));
|
|
421
|
-
const ThickSolidLine = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SolidLine, _extends({}, props, {
|
|
422
|
-
strokeWidth: 2
|
|
423
|
-
})));
|
|
424
|
-
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
425
|
-
height: 250,
|
|
426
|
-
series: [{
|
|
427
|
-
id: 'gains',
|
|
428
|
-
data: gains,
|
|
429
|
-
yAxisId: 'profit',
|
|
430
|
-
color: theme.color.bgPositive,
|
|
431
|
-
stackId: 'bars'
|
|
432
|
-
}, {
|
|
433
|
-
id: 'losses',
|
|
434
|
-
data: losses,
|
|
435
|
-
yAxisId: 'profit',
|
|
436
|
-
color: theme.color.bgNegative,
|
|
437
|
-
stackId: 'bars'
|
|
438
|
-
}, {
|
|
439
|
-
id: 'revenue',
|
|
440
|
-
data: [128, 118, 122, 116, 120, 114, 118, 122, 126, 130, 134, 138],
|
|
441
|
-
yAxisId: 'revenue',
|
|
442
|
-
color: theme.color.fgMuted
|
|
443
|
-
}],
|
|
444
|
-
xAxis: {
|
|
445
|
-
scaleType: 'band',
|
|
446
|
-
data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
447
|
-
},
|
|
448
|
-
yAxis: [{
|
|
449
|
-
id: 'profit',
|
|
450
|
-
range: _ref8 => {
|
|
451
|
-
let {
|
|
452
|
-
min,
|
|
453
|
-
max
|
|
454
|
-
} = _ref8;
|
|
455
|
-
return {
|
|
456
|
-
min: min,
|
|
457
|
-
max: max - 64
|
|
458
|
-
};
|
|
459
|
-
},
|
|
460
|
-
domain: {
|
|
461
|
-
min: -40,
|
|
462
|
-
max: 40
|
|
463
|
-
}
|
|
464
|
-
}, {
|
|
465
|
-
id: 'revenue',
|
|
466
|
-
range: _ref9 => {
|
|
467
|
-
let {
|
|
468
|
-
min,
|
|
469
|
-
max
|
|
470
|
-
} = _ref9;
|
|
471
|
-
return {
|
|
472
|
-
min: max - 64,
|
|
473
|
-
max
|
|
474
|
-
};
|
|
475
|
-
},
|
|
476
|
-
domain: {
|
|
477
|
-
min: 100
|
|
478
|
-
}
|
|
479
|
-
}],
|
|
480
|
-
children: [/*#__PURE__*/_jsx(YAxis, {
|
|
481
|
-
showGrid: true,
|
|
482
|
-
GridLineComponent: ThinSolidLine,
|
|
483
|
-
axisId: "profit",
|
|
484
|
-
position: "left",
|
|
485
|
-
tickLabelFormatter: renderProfit
|
|
486
|
-
}), /*#__PURE__*/_jsx(XAxis, {}), /*#__PURE__*/_jsx(ReferenceLine, {
|
|
487
|
-
LineComponent: ThickSolidLine,
|
|
488
|
-
dataY: 0,
|
|
489
|
-
yAxisId: "profit"
|
|
490
|
-
}), /*#__PURE__*/_jsx(BarPlot, {
|
|
491
|
-
seriesIds: ['gains', 'losses']
|
|
492
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
493
|
-
showArea: true,
|
|
494
|
-
seriesId: "revenue"
|
|
495
|
-
})]
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
const ScatterplotWithCustomLabels = /*#__PURE__*/memo(() => {
|
|
499
|
-
const theme = useTheme();
|
|
500
|
-
const dataPoints = useMemo(() => [{
|
|
501
|
-
x: 12,
|
|
502
|
-
y: 34,
|
|
503
|
-
label: 'A',
|
|
504
|
-
color: theme.color.accentBoldBlue
|
|
505
|
-
}, {
|
|
506
|
-
x: 28,
|
|
507
|
-
y: 67,
|
|
508
|
-
label: 'B',
|
|
509
|
-
color: theme.color.accentBoldBlue
|
|
510
|
-
}, {
|
|
511
|
-
x: 45,
|
|
512
|
-
y: 23,
|
|
513
|
-
label: 'C',
|
|
514
|
-
color: theme.color.accentBoldBlue
|
|
515
|
-
}, {
|
|
516
|
-
x: 67,
|
|
517
|
-
y: 89,
|
|
518
|
-
label: 'D',
|
|
519
|
-
color: theme.color.bgPositive
|
|
520
|
-
}, {
|
|
521
|
-
x: 82,
|
|
522
|
-
y: 76,
|
|
523
|
-
label: 'E',
|
|
524
|
-
color: theme.color.bgPositive
|
|
525
|
-
}, {
|
|
526
|
-
x: 34,
|
|
527
|
-
y: 91,
|
|
528
|
-
label: 'F',
|
|
529
|
-
color: theme.color.bgPositive
|
|
530
|
-
}, {
|
|
531
|
-
x: 56,
|
|
532
|
-
y: 45,
|
|
533
|
-
label: 'G',
|
|
534
|
-
color: theme.color.bgPositive
|
|
535
|
-
}, {
|
|
536
|
-
x: 19,
|
|
537
|
-
y: 12,
|
|
538
|
-
label: 'H',
|
|
539
|
-
color: theme.color.fgWarning
|
|
540
|
-
}, {
|
|
541
|
-
x: 73,
|
|
542
|
-
y: 28,
|
|
543
|
-
label: 'I',
|
|
544
|
-
color: theme.color.fgWarning
|
|
545
|
-
}, {
|
|
546
|
-
x: 91,
|
|
547
|
-
y: 54,
|
|
548
|
-
label: 'J',
|
|
549
|
-
color: theme.color.fgWarning
|
|
550
|
-
}, {
|
|
551
|
-
x: 15,
|
|
552
|
-
y: 58,
|
|
553
|
-
label: 'K',
|
|
554
|
-
color: theme.color.fgPrimary
|
|
555
|
-
}, {
|
|
556
|
-
x: 39,
|
|
557
|
-
y: 72,
|
|
558
|
-
label: 'L',
|
|
559
|
-
color: theme.color.fgPrimary
|
|
560
|
-
}, {
|
|
561
|
-
x: 88,
|
|
562
|
-
y: 15,
|
|
563
|
-
label: 'M',
|
|
564
|
-
color: theme.color.fgPrimary
|
|
565
|
-
}, {
|
|
566
|
-
x: 52,
|
|
567
|
-
y: 82,
|
|
568
|
-
label: 'N',
|
|
569
|
-
color: theme.color.fgPrimary
|
|
570
|
-
}], [theme]);
|
|
571
|
-
|
|
572
|
-
// Calculate domain based on data
|
|
573
|
-
const xValues = useMemo(() => dataPoints.map(p => p.x), [dataPoints]);
|
|
574
|
-
const yValues = useMemo(() => dataPoints.map(p => p.y), [dataPoints]);
|
|
575
|
-
const xMin = Math.min(...xValues);
|
|
576
|
-
const xMax = Math.max(...xValues);
|
|
577
|
-
const yMin = Math.min(...yValues);
|
|
578
|
-
const yMax = Math.max(...yValues);
|
|
579
|
-
|
|
580
|
-
// Custom label component that places labels to the top-right
|
|
581
|
-
const TopRightPointLabel = useCallback(_ref0 => {
|
|
582
|
-
let {
|
|
583
|
-
x,
|
|
584
|
-
y,
|
|
585
|
-
offset = 0,
|
|
586
|
-
children
|
|
587
|
-
} = _ref0;
|
|
588
|
-
return /*#__PURE__*/_jsx(ChartText, {
|
|
589
|
-
font: "label1",
|
|
590
|
-
fontWeight: 600,
|
|
591
|
-
horizontalAlignment: "left",
|
|
592
|
-
verticalAlignment: "bottom",
|
|
593
|
-
x: x + offset,
|
|
594
|
-
y: y - offset,
|
|
595
|
-
children: children
|
|
596
|
-
});
|
|
597
|
-
}, []);
|
|
598
|
-
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
599
|
-
height: 300,
|
|
600
|
-
xAxis: {
|
|
601
|
-
domain: {
|
|
602
|
-
min: xMin,
|
|
603
|
-
max: xMax
|
|
604
|
-
},
|
|
605
|
-
domainLimit: 'nice'
|
|
606
|
-
},
|
|
607
|
-
yAxis: {
|
|
608
|
-
domain: {
|
|
609
|
-
min: yMin,
|
|
610
|
-
max: yMax
|
|
611
|
-
},
|
|
612
|
-
domainLimit: 'nice'
|
|
613
|
-
},
|
|
614
|
-
children: [/*#__PURE__*/_jsx(XAxis, {
|
|
615
|
-
showGrid: true,
|
|
616
|
-
showLine: true,
|
|
617
|
-
showTickMarks: true
|
|
618
|
-
}), /*#__PURE__*/_jsx(YAxis, {
|
|
619
|
-
showGrid: true,
|
|
620
|
-
showLine: true,
|
|
621
|
-
showTickMarks: true,
|
|
622
|
-
position: "left"
|
|
623
|
-
}), dataPoints.map((point, index) => /*#__PURE__*/_jsx(Point, {
|
|
624
|
-
LabelComponent: TopRightPointLabel,
|
|
625
|
-
dataX: point.x,
|
|
626
|
-
dataY: point.y,
|
|
627
|
-
fill: point.color,
|
|
628
|
-
label: point.label,
|
|
629
|
-
labelOffset: 8,
|
|
630
|
-
radius: 5
|
|
631
|
-
}, index))]
|
|
632
|
-
});
|
|
633
|
-
});
|
|
634
|
-
const ChartStories = () => {
|
|
635
|
-
return /*#__PURE__*/_jsx(ScrollView, {
|
|
636
|
-
children: /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
637
|
-
children: [/*#__PURE__*/_jsx(Example, {
|
|
638
|
-
title: "Line Styles",
|
|
639
|
-
children: /*#__PURE__*/_jsx(LineStyles, {})
|
|
640
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
641
|
-
title: "Multiple Types",
|
|
642
|
-
children: /*#__PURE__*/_jsx(MultipleChart, {})
|
|
643
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
644
|
-
title: "Earnings History",
|
|
645
|
-
children: /*#__PURE__*/_jsx(EarningsHistory, {})
|
|
646
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
647
|
-
title: "Price With Volume",
|
|
648
|
-
children: /*#__PURE__*/_jsx(PriceWithVolume, {})
|
|
649
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
650
|
-
title: "Trading Trends",
|
|
651
|
-
children: /*#__PURE__*/_jsx(TradingTrends, {})
|
|
652
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
653
|
-
title: "Scatterplot with Custom Labels",
|
|
654
|
-
children: /*#__PURE__*/_jsx(ScatterplotWithCustomLabels, {})
|
|
655
|
-
})]
|
|
656
|
-
})
|
|
657
|
-
});
|
|
658
|
-
};
|
|
659
|
-
export default ChartStories;
|