@mui/x-charts 9.2.0 → 9.4.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/BarChart/BarChart.js +10 -10
- package/BarChart/BarChart.mjs +10 -10
- package/BarChart/BarElement.d.mts +3 -2
- package/BarChart/BarElement.d.ts +3 -2
- package/BarChart/BarLabel/BarLabelItem.d.mts +3 -2
- package/BarChart/BarLabel/BarLabelItem.d.ts +3 -2
- package/BarChart/seriesConfig/bar/extremums.js +7 -2
- package/BarChart/seriesConfig/bar/extremums.mjs +7 -2
- package/BarChart/seriesConfig/bar/getColor.js +7 -53
- package/BarChart/seriesConfig/bar/getColor.mjs +7 -53
- package/BarChart/seriesConfig/bar/seriesProcessor.js +3 -1
- package/BarChart/seriesConfig/bar/seriesProcessor.mjs +3 -1
- package/BarChart/seriesConfig/bar/tooltip.js +4 -27
- package/BarChart/seriesConfig/bar/tooltip.mjs +4 -27
- package/CHANGELOG.md +314 -0
- package/ChartsContainer/ChartsContainer.js +30 -9
- package/ChartsContainer/ChartsContainer.mjs +30 -9
- package/ChartsLabel/ChartsLabelMark.js +1 -23
- package/ChartsLabel/ChartsLabelMark.mjs +0 -22
- package/ChartsLabel/labelMarkClasses.d.mts +0 -1
- package/ChartsLabel/labelMarkClasses.d.ts +0 -1
- package/ChartsLabel/labelMarkClasses.js +1 -2
- package/ChartsLabel/labelMarkClasses.mjs +2 -2
- package/ChartsLayerContainer/ChartsLayerContainer.js +36 -30
- package/ChartsLayerContainer/ChartsLayerContainer.mjs +36 -30
- package/ChartsLegend/chartsLegend.types.d.mts +3 -2
- package/ChartsLegend/chartsLegend.types.d.ts +3 -2
- package/ChartsLegend/piecewiseColorLegendClasses.js +8 -2
- package/ChartsLegend/piecewiseColorLegendClasses.mjs +8 -2
- package/ChartsOverlay/ChartsOverlay.d.mts +5 -4
- package/ChartsOverlay/ChartsOverlay.d.ts +5 -4
- package/ChartsReferenceLine/ChartsXReferenceLine.js +6 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.mjs +6 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +5 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.mjs +5 -0
- package/ChartsTooltip/ChartTooltip.types.d.mts +3 -2
- package/ChartsTooltip/ChartTooltip.types.d.ts +3 -2
- package/ChartsTooltip/useAxesTooltip.js +2 -2
- package/ChartsTooltip/useAxesTooltip.mjs +2 -2
- package/ChartsTooltip/useItemTooltip.js +2 -2
- package/ChartsTooltip/useItemTooltip.mjs +2 -2
- package/ChartsXAxis/ChartsXAxis.js +3 -1
- package/ChartsXAxis/ChartsXAxis.mjs +3 -1
- package/ChartsXAxis/useAxisTicksProps.d.mts +84 -3
- package/ChartsXAxis/useAxisTicksProps.d.ts +84 -3
- package/ChartsYAxis/ChartsYAxis.js +3 -1
- package/ChartsYAxis/ChartsYAxis.mjs +3 -1
- package/ChartsYAxis/useAxisTicksProps.d.mts +84 -3
- package/ChartsYAxis/useAxisTicksProps.d.ts +84 -3
- package/LineChart/AreaElement.d.mts +3 -2
- package/LineChart/AreaElement.d.ts +3 -2
- package/LineChart/LineChart.js +6 -6
- package/LineChart/LineChart.mjs +6 -6
- package/LineChart/LineElement.d.mts +3 -2
- package/LineChart/LineElement.d.ts +3 -2
- package/LineChart/LineHighlightPlot.d.mts +3 -2
- package/LineChart/LineHighlightPlot.d.ts +3 -2
- package/LineChart/LineHighlightPlot.js +65 -45
- package/LineChart/LineHighlightPlot.mjs +65 -45
- package/LineChart/MarkPlot.d.mts +3 -2
- package/LineChart/MarkPlot.d.ts +3 -2
- package/LineChart/seriesConfig/curveEvaluation.js +40 -15
- package/LineChart/seriesConfig/curveEvaluation.mjs +39 -15
- package/LineChart/seriesConfig/extremums.js +5 -1
- package/LineChart/seriesConfig/extremums.mjs +5 -1
- package/LineChart/seriesConfig/getColor.js +7 -54
- package/LineChart/seriesConfig/getColor.mjs +7 -54
- package/LineChart/seriesConfig/seriesProcessor.d.mts +2 -4
- package/LineChart/seriesConfig/seriesProcessor.d.ts +2 -4
- package/LineChart/seriesConfig/seriesProcessor.js +2 -139
- package/LineChart/seriesConfig/seriesProcessor.mjs +2 -138
- package/LineChart/seriesConfig/tooltip.js +4 -25
- package/LineChart/seriesConfig/tooltip.mjs +4 -25
- package/LineChart/useMarkPlotData.js +3 -1
- package/LineChart/useMarkPlotData.mjs +3 -1
- package/PieChart/PieArcLabelPlot.d.mts +3 -2
- package/PieChart/PieArcLabelPlot.d.ts +3 -2
- package/PieChart/PieArcPlot.d.mts +3 -2
- package/PieChart/PieArcPlot.d.ts +3 -2
- package/PieChart/PieChart.js +6 -6
- package/PieChart/PieChart.mjs +6 -6
- package/RadarChart/RadarAxis/RadarAxis.utils.d.mts +2 -2
- package/RadarChart/RadarAxis/RadarAxis.utils.d.ts +2 -2
- package/RadarChart/RadarAxis/useRadarAxis.js +1 -1
- package/RadarChart/RadarAxis/useRadarAxis.mjs +1 -1
- package/RadarChart/RadarChart.js +8 -8
- package/RadarChart/RadarChart.mjs +8 -8
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +3 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.mjs +3 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +1 -0
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +1 -0
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +1 -0
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.mjs +1 -0
- package/ScatterChart/BatchScatter.d.mts +2 -8
- package/ScatterChart/BatchScatter.d.ts +2 -8
- package/ScatterChart/BatchScatter.js +17 -12
- package/ScatterChart/BatchScatter.mjs +17 -12
- package/ScatterChart/FocusedScatterMark.js +2 -2
- package/ScatterChart/FocusedScatterMark.mjs +2 -2
- package/ScatterChart/HighlightedScatterMark.js +3 -3
- package/ScatterChart/HighlightedScatterMark.mjs +3 -3
- package/ScatterChart/Scatter.d.mts +5 -0
- package/ScatterChart/Scatter.d.ts +5 -0
- package/ScatterChart/Scatter.js +7 -2
- package/ScatterChart/Scatter.mjs +7 -2
- package/ScatterChart/ScatterChart.d.mts +2 -1
- package/ScatterChart/ScatterChart.d.ts +2 -1
- package/ScatterChart/ScatterChart.js +32 -11
- package/ScatterChart/ScatterChart.mjs +32 -11
- package/ScatterChart/ScatterMarker.types.d.mts +3 -2
- package/ScatterChart/ScatterMarker.types.d.ts +3 -2
- package/ScatterChart/ScatterPlot.d.mts +3 -2
- package/ScatterChart/ScatterPlot.d.ts +3 -2
- package/ScatterChart/ScatterPlot.js +6 -1
- package/ScatterChart/ScatterPlot.mjs +6 -1
- package/ScatterChart/seriesConfig/extremums.js +6 -0
- package/ScatterChart/seriesConfig/extremums.mjs +6 -0
- package/ScatterChart/seriesConfig/getColor.js +1 -1
- package/ScatterChart/seriesConfig/getColor.mjs +1 -1
- package/ScatterChart/seriesConfig/getMarkerSize.d.mts +18 -0
- package/ScatterChart/seriesConfig/getMarkerSize.d.ts +18 -0
- package/ScatterChart/seriesConfig/getMarkerSize.js +43 -0
- package/ScatterChart/seriesConfig/getMarkerSize.mjs +37 -0
- package/ScatterChart/seriesConfig/seriesProcessor.js +23 -8
- package/ScatterChart/seriesConfig/seriesProcessor.mjs +23 -8
- package/ScatterChart/seriesConfig/tooltip.js +2 -24
- package/ScatterChart/seriesConfig/tooltip.mjs +2 -24
- package/ScatterChart/useScatterItemPosition.d.mts +4 -0
- package/ScatterChart/useScatterItemPosition.d.ts +4 -0
- package/ScatterChart/useScatterItemPosition.js +9 -0
- package/ScatterChart/useScatterItemPosition.mjs +8 -0
- package/SparkLineChart/SparkLineChart.js +27 -27
- package/SparkLineChart/SparkLineChart.mjs +27 -27
- package/Toolbar/Toolbar.types.d.mts +3 -2
- package/Toolbar/Toolbar.types.d.ts +3 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/animation/animation.d.mts +1 -2
- package/internals/animation/animation.d.ts +1 -2
- package/internals/commonNextFocusItem.d.mts +10 -2
- package/internals/commonNextFocusItem.d.ts +10 -2
- package/internals/commonNextFocusItem.js +12 -4
- package/internals/commonNextFocusItem.mjs +12 -4
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.js +1 -1
- package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.mjs +1 -1
- package/internals/createCommonKeyboardFocusHandler.d.mts +1 -1
- package/internals/createCommonKeyboardFocusHandler.d.ts +1 -1
- package/internals/createCommonKeyboardFocusHandler.js +3 -3
- package/internals/createCommonKeyboardFocusHandler.mjs +3 -3
- package/internals/getLineLikeTooltip.d.mts +9 -0
- package/internals/getLineLikeTooltip.d.ts +9 -0
- package/internals/getLineLikeTooltip.js +38 -0
- package/internals/getLineLikeTooltip.mjs +31 -0
- package/internals/incompleteDatasetKeysError.d.mts +1 -0
- package/internals/incompleteDatasetKeysError.d.ts +1 -0
- package/internals/incompleteDatasetKeysError.js +11 -0
- package/internals/incompleteDatasetKeysError.mjs +4 -0
- package/internals/index.d.mts +5 -0
- package/internals/index.d.ts +5 -0
- package/internals/index.js +48 -0
- package/internals/index.mjs +5 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.mts +4 -2
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.ts +4 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.mjs +4 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.mts +10 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +10 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +18 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.mjs +16 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +11 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +11 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +24 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.mjs +24 -5
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.mts +1 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +46 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.mjs +47 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +46 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +46 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +2 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +6 -2
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.mjs +6 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.mts +4 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +3 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.mjs +1 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +5 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +7 -5
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +17 -3
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +17 -3
- package/internals/processLineLikeSeries.d.mts +6 -0
- package/internals/processLineLikeSeries.d.ts +6 -0
- package/internals/processLineLikeSeries.js +145 -0
- package/internals/processLineLikeSeries.mjs +138 -0
- package/internals/resolveColorProcessor.d.mts +11 -0
- package/internals/resolveColorProcessor.d.ts +11 -0
- package/internals/resolveColorProcessor.js +62 -0
- package/internals/resolveColorProcessor.mjs +56 -0
- package/internals/sizeScale.d.mts +6 -0
- package/internals/sizeScale.d.ts +6 -0
- package/internals/sizeScale.js +46 -0
- package/internals/sizeScale.mjs +38 -0
- package/models/axis.d.mts +18 -12
- package/models/axis.d.ts +18 -12
- package/models/chartsSlotsComponentsProps.d.mts +25 -0
- package/models/chartsSlotsComponentsProps.d.ts +25 -0
- package/models/chartsSlotsComponentsProps.js +5 -0
- package/models/chartsSlotsComponentsProps.mjs +1 -0
- package/models/index.d.mts +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/index.mjs +1 -0
- package/models/seriesType/line.d.mts +5 -2
- package/models/seriesType/line.d.ts +5 -2
- package/models/seriesType/scatter.d.mts +34 -2
- package/models/seriesType/scatter.d.ts +34 -2
- package/models/sizeMapping.d.mts +64 -0
- package/models/sizeMapping.d.ts +64 -0
- package/models/sizeMapping.js +5 -0
- package/models/sizeMapping.mjs +1 -0
- package/models/slots/chartsBaseSlots.d.mts +6 -5
- package/models/slots/chartsBaseSlots.d.ts +6 -5
- package/models/z-axis.d.mts +10 -1
- package/models/z-axis.d.ts +10 -1
- package/package.json +6 -6
package/ScatterChart/Scatter.mjs
CHANGED
|
@@ -46,6 +46,7 @@ function Scatter(props) {
|
|
|
46
46
|
xScale,
|
|
47
47
|
yScale,
|
|
48
48
|
colorGetter,
|
|
49
|
+
sizeGetter,
|
|
49
50
|
onItemClick,
|
|
50
51
|
classes: inClasses,
|
|
51
52
|
slots,
|
|
@@ -64,8 +65,7 @@ function Scatter(props) {
|
|
|
64
65
|
elementType: Marker,
|
|
65
66
|
externalSlotProps: slotProps?.marker,
|
|
66
67
|
additionalProps: {
|
|
67
|
-
seriesId: series.id
|
|
68
|
-
size: series.markerSize
|
|
68
|
+
seriesId: series.id
|
|
69
69
|
},
|
|
70
70
|
ownerState: {}
|
|
71
71
|
}),
|
|
@@ -84,6 +84,7 @@ function Scatter(props) {
|
|
|
84
84
|
className: clsx(classes.marker, markerProps.className),
|
|
85
85
|
dataIndex: dataPoint.dataIndex,
|
|
86
86
|
color: colorGetter(dataPoint.dataIndex),
|
|
87
|
+
size: sizeGetter(dataPoint.dataIndex),
|
|
87
88
|
isHighlighted: isItemHighlighted,
|
|
88
89
|
isFaded: isItemFaded,
|
|
89
90
|
x: dataPoint.x,
|
|
@@ -119,6 +120,10 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
119
120
|
*/
|
|
120
121
|
onItemClick: PropTypes.func,
|
|
121
122
|
series: PropTypes.object.isRequired,
|
|
123
|
+
/**
|
|
124
|
+
* Function to get the marker size of a scatter item given its data index.
|
|
125
|
+
*/
|
|
126
|
+
sizeGetter: PropTypes.func.isRequired,
|
|
122
127
|
slotProps: PropTypes.object,
|
|
123
128
|
slots: PropTypes.object,
|
|
124
129
|
xScale: PropTypes.func.isRequired,
|
|
@@ -7,6 +7,7 @@ import { type ChartsContainerProps } from "../ChartsContainer/index.mjs";
|
|
|
7
7
|
import { type ScatterSeriesType } from "../models/seriesType/scatter.mjs";
|
|
8
8
|
import { type ChartsTooltipProps } from "../ChartsTooltip/index.mjs";
|
|
9
9
|
import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.mjs";
|
|
10
|
+
import type { TooltipPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
|
|
10
11
|
import { type ChartsLegendSlotProps, type ChartsLegendSlots } from "../ChartsLegend/index.mjs";
|
|
11
12
|
import { type ChartsOverlayProps, type ChartsOverlaySlotProps, type ChartsOverlaySlots } from "../ChartsOverlay/index.mjs";
|
|
12
13
|
import { type ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.mjs";
|
|
@@ -20,7 +21,7 @@ export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotS
|
|
|
20
21
|
* Slot props for the tooltip component.
|
|
21
22
|
* @default {}
|
|
22
23
|
*/
|
|
23
|
-
tooltip?: Partial<ChartsTooltipProps<'item' | 'none'
|
|
24
|
+
tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>> & TooltipPropsOverrides;
|
|
24
25
|
}
|
|
25
26
|
export type ScatterSeries = MakeOptional<ScatterSeriesType, 'type'>;
|
|
26
27
|
export interface ScatterChartProps extends Omit<ChartsContainerProps<'scatter', ScatterChartPluginSignatures>, 'series' | 'plugins' | 'onItemClick' | 'highlightedAxis' | 'onHighlightedAxisChange'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ScatterPlotProps, 'renderer'> {
|
|
@@ -7,6 +7,7 @@ import { type ChartsContainerProps } from "../ChartsContainer/index.js";
|
|
|
7
7
|
import { type ScatterSeriesType } from "../models/seriesType/scatter.js";
|
|
8
8
|
import { type ChartsTooltipProps } from "../ChartsTooltip/index.js";
|
|
9
9
|
import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.js";
|
|
10
|
+
import type { TooltipPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
|
|
10
11
|
import { type ChartsLegendSlotProps, type ChartsLegendSlots } from "../ChartsLegend/index.js";
|
|
11
12
|
import { type ChartsOverlayProps, type ChartsOverlaySlotProps, type ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
12
13
|
import { type ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.js";
|
|
@@ -20,7 +21,7 @@ export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotS
|
|
|
20
21
|
* Slot props for the tooltip component.
|
|
21
22
|
* @default {}
|
|
22
23
|
*/
|
|
23
|
-
tooltip?: Partial<ChartsTooltipProps<'item' | 'none'
|
|
24
|
+
tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>> & TooltipPropsOverrides;
|
|
24
25
|
}
|
|
25
26
|
export type ScatterSeries = MakeOptional<ScatterSeriesType, 'type'>;
|
|
26
27
|
export interface ScatterChartProps extends Omit<ChartsContainerProps<'scatter', ScatterChartPluginSignatures>, 'series' | 'plugins' | 'onItemClick' | 'highlightedAxis' | 'onHighlightedAxisChange'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ScatterPlotProps, 'renderer'> {
|
|
@@ -199,11 +199,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
199
199
|
*/
|
|
200
200
|
highlightedItem: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
201
201
|
dataIndex: _propTypes.default.number,
|
|
202
|
-
seriesId: _propTypes.default.string.isRequired
|
|
203
|
-
type: _propTypes.default.oneOf(['scatter']).isRequired
|
|
202
|
+
seriesId: _propTypes.default.string.isRequired
|
|
204
203
|
}), _propTypes.default.shape({
|
|
205
204
|
dataIndex: _propTypes.default.number,
|
|
206
|
-
seriesId: _propTypes.default.string.isRequired
|
|
205
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
206
|
+
type: _propTypes.default.oneOf(['scatter']).isRequired
|
|
207
207
|
})]),
|
|
208
208
|
/**
|
|
209
209
|
* Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
|
|
@@ -360,11 +360,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
360
360
|
*/
|
|
361
361
|
tooltipItem: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
362
362
|
dataIndex: _propTypes.default.number.isRequired,
|
|
363
|
-
seriesId: _propTypes.default.string.isRequired
|
|
364
|
-
type: _propTypes.default.oneOf(['scatter']).isRequired
|
|
363
|
+
seriesId: _propTypes.default.string.isRequired
|
|
365
364
|
}), _propTypes.default.shape({
|
|
366
365
|
dataIndex: _propTypes.default.number.isRequired,
|
|
367
|
-
seriesId: _propTypes.default.string.isRequired
|
|
366
|
+
seriesId: _propTypes.default.string.isRequired,
|
|
367
|
+
type: _propTypes.default.oneOf(['scatter']).isRequired
|
|
368
368
|
})]),
|
|
369
369
|
/**
|
|
370
370
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -387,11 +387,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
387
387
|
*/
|
|
388
388
|
zAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
389
389
|
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
390
|
-
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
391
|
-
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
392
|
-
unknownColor: _propTypes.default.string,
|
|
393
|
-
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
394
|
-
}), _propTypes.default.shape({
|
|
395
390
|
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
396
391
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
397
392
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
@@ -400,12 +395,38 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
400
395
|
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
401
396
|
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
402
397
|
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
398
|
+
}), _propTypes.default.shape({
|
|
399
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
400
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
401
|
+
unknownColor: _propTypes.default.string,
|
|
402
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
403
403
|
})]),
|
|
404
404
|
data: _propTypes.default.array,
|
|
405
405
|
dataKey: _propTypes.default.string,
|
|
406
406
|
id: _propTypes.default.string,
|
|
407
407
|
max: _propTypes.default.number,
|
|
408
408
|
min: _propTypes.default.number,
|
|
409
|
+
sizeMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
410
|
+
interpolator: _propTypes.default.oneOf(['linear', 'log', 'sqrt']),
|
|
411
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
412
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
413
|
+
size: _propTypes.default.arrayOf(_propTypes.default.number.isRequired).isRequired,
|
|
414
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
415
|
+
}), _propTypes.default.shape({
|
|
416
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
417
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
418
|
+
size: _propTypes.default.func.isRequired,
|
|
419
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
420
|
+
}), _propTypes.default.shape({
|
|
421
|
+
sizes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
|
|
422
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
423
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
424
|
+
}), _propTypes.default.shape({
|
|
425
|
+
sizes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
|
|
426
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
427
|
+
unknownSize: _propTypes.default.number,
|
|
428
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
429
|
+
})]),
|
|
409
430
|
valueGetter: _propTypes.default.func
|
|
410
431
|
}))
|
|
411
432
|
} : void 0;
|
|
@@ -192,11 +192,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
192
192
|
*/
|
|
193
193
|
highlightedItem: PropTypes.oneOfType([PropTypes.shape({
|
|
194
194
|
dataIndex: PropTypes.number,
|
|
195
|
-
seriesId: PropTypes.string.isRequired
|
|
196
|
-
type: PropTypes.oneOf(['scatter']).isRequired
|
|
195
|
+
seriesId: PropTypes.string.isRequired
|
|
197
196
|
}), PropTypes.shape({
|
|
198
197
|
dataIndex: PropTypes.number,
|
|
199
|
-
seriesId: PropTypes.string.isRequired
|
|
198
|
+
seriesId: PropTypes.string.isRequired,
|
|
199
|
+
type: PropTypes.oneOf(['scatter']).isRequired
|
|
200
200
|
})]),
|
|
201
201
|
/**
|
|
202
202
|
* Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
|
|
@@ -353,11 +353,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
353
353
|
*/
|
|
354
354
|
tooltipItem: PropTypes.oneOfType([PropTypes.shape({
|
|
355
355
|
dataIndex: PropTypes.number.isRequired,
|
|
356
|
-
seriesId: PropTypes.string.isRequired
|
|
357
|
-
type: PropTypes.oneOf(['scatter']).isRequired
|
|
356
|
+
seriesId: PropTypes.string.isRequired
|
|
358
357
|
}), PropTypes.shape({
|
|
359
358
|
dataIndex: PropTypes.number.isRequired,
|
|
360
|
-
seriesId: PropTypes.string.isRequired
|
|
359
|
+
seriesId: PropTypes.string.isRequired,
|
|
360
|
+
type: PropTypes.oneOf(['scatter']).isRequired
|
|
361
361
|
})]),
|
|
362
362
|
/**
|
|
363
363
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -380,11 +380,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
380
380
|
*/
|
|
381
381
|
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
382
382
|
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
383
|
-
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
384
|
-
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
385
|
-
unknownColor: PropTypes.string,
|
|
386
|
-
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
387
|
-
}), PropTypes.shape({
|
|
388
383
|
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
389
384
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
390
385
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -393,12 +388,38 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
393
388
|
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
394
389
|
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
395
390
|
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
391
|
+
}), PropTypes.shape({
|
|
392
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
393
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
394
|
+
unknownColor: PropTypes.string,
|
|
395
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
396
396
|
})]),
|
|
397
397
|
data: PropTypes.array,
|
|
398
398
|
dataKey: PropTypes.string,
|
|
399
399
|
id: PropTypes.string,
|
|
400
400
|
max: PropTypes.number,
|
|
401
401
|
min: PropTypes.number,
|
|
402
|
+
sizeMap: PropTypes.oneOfType([PropTypes.shape({
|
|
403
|
+
interpolator: PropTypes.oneOf(['linear', 'log', 'sqrt']),
|
|
404
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
405
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
406
|
+
size: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired,
|
|
407
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
408
|
+
}), PropTypes.shape({
|
|
409
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
410
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
411
|
+
size: PropTypes.func.isRequired,
|
|
412
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
413
|
+
}), PropTypes.shape({
|
|
414
|
+
sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
415
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
416
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
417
|
+
}), PropTypes.shape({
|
|
418
|
+
sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
419
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
420
|
+
unknownSize: PropTypes.number,
|
|
421
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
422
|
+
})]),
|
|
402
423
|
valueGetter: PropTypes.func
|
|
403
424
|
}))
|
|
404
425
|
} : void 0;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
2
|
import type { ScatterMarkerProps } from "./ScatterMarker.mjs";
|
|
3
|
+
import type { MarkerPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
|
|
3
4
|
export interface ScatterMarkerSlots {
|
|
4
5
|
/**
|
|
5
6
|
* The component that renders the marker for a scatter point.
|
|
6
7
|
* @default ScatterMarker
|
|
7
8
|
*/
|
|
8
|
-
marker?: React.JSXElementConstructor<ScatterMarkerProps>;
|
|
9
|
+
marker?: React.JSXElementConstructor<ScatterMarkerProps & MarkerPropsOverrides>;
|
|
9
10
|
}
|
|
10
11
|
export interface ScatterMarkerSlotProps {
|
|
11
|
-
marker?: ScatterMarkerProps;
|
|
12
|
+
marker?: Partial<ScatterMarkerProps> & MarkerPropsOverrides;
|
|
12
13
|
}
|
|
13
14
|
export interface ScatterMarkerSlotExtension {
|
|
14
15
|
/**
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
2
|
import type { ScatterMarkerProps } from "./ScatterMarker.js";
|
|
3
|
+
import type { MarkerPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
|
|
3
4
|
export interface ScatterMarkerSlots {
|
|
4
5
|
/**
|
|
5
6
|
* The component that renders the marker for a scatter point.
|
|
6
7
|
* @default ScatterMarker
|
|
7
8
|
*/
|
|
8
|
-
marker?: React.JSXElementConstructor<ScatterMarkerProps>;
|
|
9
|
+
marker?: React.JSXElementConstructor<ScatterMarkerProps & MarkerPropsOverrides>;
|
|
9
10
|
}
|
|
10
11
|
export interface ScatterMarkerSlotProps {
|
|
11
|
-
marker?: ScatterMarkerProps;
|
|
12
|
+
marker?: Partial<ScatterMarkerProps> & MarkerPropsOverrides;
|
|
12
13
|
}
|
|
13
14
|
export interface ScatterMarkerSlotExtension {
|
|
14
15
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ScatterProps, type ScatterSlotProps, type ScatterSlots } from "./Scatter.mjs";
|
|
3
|
+
import type { ScatterPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
|
|
3
4
|
export interface ScatterPlotSlots extends ScatterSlots {
|
|
4
|
-
scatter?: React.JSXElementConstructor<ScatterProps>;
|
|
5
|
+
scatter?: React.JSXElementConstructor<ScatterProps & ScatterPropsOverrides>;
|
|
5
6
|
}
|
|
6
7
|
export interface ScatterPlotSlotProps extends ScatterSlotProps {
|
|
7
|
-
scatter?: Partial<ScatterProps
|
|
8
|
+
scatter?: Partial<ScatterProps> & ScatterPropsOverrides;
|
|
8
9
|
}
|
|
9
10
|
export type RendererType = 'svg-single' | 'svg-batch';
|
|
10
11
|
export interface ScatterPlotProps extends Pick<ScatterProps, 'onItemClick' | 'classes'> {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ScatterProps, type ScatterSlotProps, type ScatterSlots } from "./Scatter.js";
|
|
3
|
+
import type { ScatterPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
|
|
3
4
|
export interface ScatterPlotSlots extends ScatterSlots {
|
|
4
|
-
scatter?: React.JSXElementConstructor<ScatterProps>;
|
|
5
|
+
scatter?: React.JSXElementConstructor<ScatterProps & ScatterPropsOverrides>;
|
|
5
6
|
}
|
|
6
7
|
export interface ScatterPlotSlotProps extends ScatterSlotProps {
|
|
7
|
-
scatter?: Partial<ScatterProps
|
|
8
|
+
scatter?: Partial<ScatterProps> & ScatterPropsOverrides;
|
|
8
9
|
}
|
|
9
10
|
export type RendererType = 'svg-single' | 'svg-batch';
|
|
10
11
|
export interface ScatterPlotProps extends Pick<ScatterProps, 'onItemClick' | 'classes'> {
|
|
@@ -17,6 +17,7 @@ var _useScatterSeries = require("../hooks/useScatterSeries");
|
|
|
17
17
|
var _hooks = require("../hooks");
|
|
18
18
|
var _useZAxis = require("../hooks/useZAxis");
|
|
19
19
|
var _seriesConfig = require("./seriesConfig");
|
|
20
|
+
var _getMarkerSize = _interopRequireDefault(require("./seriesConfig/getMarkerSize"));
|
|
20
21
|
var _BatchScatter = require("./BatchScatter");
|
|
21
22
|
var _scatterClasses = require("./scatterClasses");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -79,14 +80,17 @@ function ScatterPlot(props) {
|
|
|
79
80
|
id,
|
|
80
81
|
xAxisId,
|
|
81
82
|
yAxisId,
|
|
83
|
+
colorAxisId,
|
|
82
84
|
zAxisId,
|
|
85
|
+
sizeAxisId,
|
|
83
86
|
color,
|
|
84
87
|
hidden
|
|
85
88
|
} = series[seriesId];
|
|
86
89
|
if (hidden) {
|
|
87
90
|
return null;
|
|
88
91
|
}
|
|
89
|
-
const colorGetter = _seriesConfig.scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
|
|
92
|
+
const colorGetter = _seriesConfig.scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[colorAxisId ?? zAxisId ?? defaultZAxisId]);
|
|
93
|
+
const sizeGetter = (0, _getMarkerSize.default)(series[seriesId], zAxis[sizeAxisId ?? defaultZAxisId]);
|
|
90
94
|
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
91
95
|
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
92
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterItems, (0, _extends2.default)({
|
|
@@ -94,6 +98,7 @@ function ScatterPlot(props) {
|
|
|
94
98
|
yScale: yScale,
|
|
95
99
|
color: color,
|
|
96
100
|
colorGetter: colorGetter,
|
|
101
|
+
sizeGetter: sizeGetter,
|
|
97
102
|
series: series[seriesId],
|
|
98
103
|
onItemClick: onItemClick,
|
|
99
104
|
slots: slots,
|
|
@@ -10,6 +10,7 @@ import { useScatterSeriesContext } from "../hooks/useScatterSeries.mjs";
|
|
|
10
10
|
import { useXAxes, useYAxes } from "../hooks/index.mjs";
|
|
11
11
|
import { useZAxes } from "../hooks/useZAxis.mjs";
|
|
12
12
|
import { scatterSeriesConfig } from "./seriesConfig/index.mjs";
|
|
13
|
+
import getMarkerSize from "./seriesConfig/getMarkerSize.mjs";
|
|
13
14
|
import { BatchScatter } from "./BatchScatter.mjs";
|
|
14
15
|
import { useUtilityClasses } from "./scatterClasses.mjs";
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -72,14 +73,17 @@ function ScatterPlot(props) {
|
|
|
72
73
|
id,
|
|
73
74
|
xAxisId,
|
|
74
75
|
yAxisId,
|
|
76
|
+
colorAxisId,
|
|
75
77
|
zAxisId,
|
|
78
|
+
sizeAxisId,
|
|
76
79
|
color,
|
|
77
80
|
hidden
|
|
78
81
|
} = series[seriesId];
|
|
79
82
|
if (hidden) {
|
|
80
83
|
return null;
|
|
81
84
|
}
|
|
82
|
-
const colorGetter = scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
|
|
85
|
+
const colorGetter = scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[colorAxisId ?? zAxisId ?? defaultZAxisId]);
|
|
86
|
+
const sizeGetter = getMarkerSize(series[seriesId], zAxis[sizeAxisId ?? defaultZAxisId]);
|
|
83
87
|
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
84
88
|
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
85
89
|
return /*#__PURE__*/_jsx(ScatterItems, _extends({
|
|
@@ -87,6 +91,7 @@ function ScatterPlot(props) {
|
|
|
87
91
|
yScale: yScale,
|
|
88
92
|
color: color,
|
|
89
93
|
colorGetter: colorGetter,
|
|
94
|
+
sizeGetter: sizeGetter,
|
|
90
95
|
series: series[seriesId],
|
|
91
96
|
onItemClick: onItemClick,
|
|
92
97
|
slots: slots,
|
|
@@ -17,6 +17,9 @@ const getExtremumX = params => {
|
|
|
17
17
|
if (!Object.hasOwn(series, seriesId)) {
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
20
23
|
const axisId = series[seriesId].xAxisId;
|
|
21
24
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
22
25
|
continue;
|
|
@@ -59,6 +62,9 @@ const getExtremumY = params => {
|
|
|
59
62
|
if (!Object.hasOwn(series, seriesId)) {
|
|
60
63
|
continue;
|
|
61
64
|
}
|
|
65
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
62
68
|
const axisId = series[seriesId].yAxisId;
|
|
63
69
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
64
70
|
continue;
|
|
@@ -11,6 +11,9 @@ export const getExtremumX = params => {
|
|
|
11
11
|
if (!Object.hasOwn(series, seriesId)) {
|
|
12
12
|
continue;
|
|
13
13
|
}
|
|
14
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
14
17
|
const axisId = series[seriesId].xAxisId;
|
|
15
18
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
16
19
|
continue;
|
|
@@ -52,6 +55,9 @@ export const getExtremumY = params => {
|
|
|
52
55
|
if (!Object.hasOwn(series, seriesId)) {
|
|
53
56
|
continue;
|
|
54
57
|
}
|
|
58
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
55
61
|
const axisId = series[seriesId].yAxisId;
|
|
56
62
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
57
63
|
continue;
|
|
@@ -25,7 +25,7 @@ const getColor = (series, xAxis, yAxis, zAxis) => {
|
|
|
25
25
|
const color = value === null ? getSeriesColor({
|
|
26
26
|
value,
|
|
27
27
|
dataIndex
|
|
28
|
-
}) : zColorScale(value.z);
|
|
28
|
+
}) : zColorScale(value.colorValue ?? value.z);
|
|
29
29
|
if (color === null) {
|
|
30
30
|
return getSeriesColor({
|
|
31
31
|
value,
|
|
@@ -19,7 +19,7 @@ const getColor = (series, xAxis, yAxis, zAxis) => {
|
|
|
19
19
|
const color = value === null ? getSeriesColor({
|
|
20
20
|
value,
|
|
21
21
|
dataIndex
|
|
22
|
-
}) : zColorScale(value.z);
|
|
22
|
+
}) : zColorScale(value.colorValue ?? value.z);
|
|
23
23
|
if (color === null) {
|
|
24
24
|
return getSeriesColor({
|
|
25
25
|
value,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.mjs";
|
|
2
|
+
import { type ZAxisDefaultized } from "../../models/z-axis.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the marker size of a scatter item given its data index.
|
|
5
|
+
* @param {number} dataIndex The index of the scatter item.
|
|
6
|
+
* @returns {number} The marker size in pixels.
|
|
7
|
+
*/
|
|
8
|
+
export type ScatterSizeGetter = (dataIndex: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a getter returning the marker size of each scatter item.
|
|
11
|
+
*
|
|
12
|
+
* When the size axis defines a `sizeMap`, the size is computed by mapping a value
|
|
13
|
+
* through the resulting `sizeScale`. The mapped value is taken from the size axis
|
|
14
|
+
* `data` when available, otherwise from the `sizeValue` of the scatter point.
|
|
15
|
+
* It falls back to the series `markerSize` when no size can be computed.
|
|
16
|
+
*/
|
|
17
|
+
declare const getMarkerSize: (series: DefaultizedScatterSeriesType, sizeZAxis?: ZAxisDefaultized) => ScatterSizeGetter;
|
|
18
|
+
export default getMarkerSize;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.js";
|
|
2
|
+
import { type ZAxisDefaultized } from "../../models/z-axis.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the marker size of a scatter item given its data index.
|
|
5
|
+
* @param {number} dataIndex The index of the scatter item.
|
|
6
|
+
* @returns {number} The marker size in pixels.
|
|
7
|
+
*/
|
|
8
|
+
export type ScatterSizeGetter = (dataIndex: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a getter returning the marker size of each scatter item.
|
|
11
|
+
*
|
|
12
|
+
* When the size axis defines a `sizeMap`, the size is computed by mapping a value
|
|
13
|
+
* through the resulting `sizeScale`. The mapped value is taken from the size axis
|
|
14
|
+
* `data` when available, otherwise from the `sizeValue` of the scatter point.
|
|
15
|
+
* It falls back to the series `markerSize` when no size can be computed.
|
|
16
|
+
*/
|
|
17
|
+
declare const getMarkerSize: (series: DefaultizedScatterSeriesType, sizeZAxis?: ZAxisDefaultized) => ScatterSizeGetter;
|
|
18
|
+
export default getMarkerSize;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the marker size of a scatter item given its data index.
|
|
9
|
+
* @param {number} dataIndex The index of the scatter item.
|
|
10
|
+
* @returns {number} The marker size in pixels.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Builds a getter returning the marker size of each scatter item.
|
|
15
|
+
*
|
|
16
|
+
* When the size axis defines a `sizeMap`, the size is computed by mapping a value
|
|
17
|
+
* through the resulting `sizeScale`. The mapped value is taken from the size axis
|
|
18
|
+
* `data` when available, otherwise from the `sizeValue` of the scatter point.
|
|
19
|
+
* It falls back to the series `markerSize` when no size can be computed.
|
|
20
|
+
*/
|
|
21
|
+
const getMarkerSize = (series, sizeZAxis) => {
|
|
22
|
+
const sizeScale = sizeZAxis?.sizeScale;
|
|
23
|
+
if (!sizeScale) {
|
|
24
|
+
return () => series.markerSize;
|
|
25
|
+
}
|
|
26
|
+
return dataIndex => {
|
|
27
|
+
if (sizeZAxis?.data?.[dataIndex] !== undefined) {
|
|
28
|
+
const size = sizeScale(sizeZAxis.data[dataIndex]);
|
|
29
|
+
if (size != null && !Number.isNaN(size)) {
|
|
30
|
+
return size;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const value = series.data[dataIndex];
|
|
34
|
+
if (value != null) {
|
|
35
|
+
const size = sizeScale(value.sizeValue);
|
|
36
|
+
if (size != null && !Number.isNaN(size)) {
|
|
37
|
+
return size;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return series.markerSize;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var _default = exports.default = getMarkerSize;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the marker size of a scatter item given its data index.
|
|
3
|
+
* @param {number} dataIndex The index of the scatter item.
|
|
4
|
+
* @returns {number} The marker size in pixels.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Builds a getter returning the marker size of each scatter item.
|
|
9
|
+
*
|
|
10
|
+
* When the size axis defines a `sizeMap`, the size is computed by mapping a value
|
|
11
|
+
* through the resulting `sizeScale`. The mapped value is taken from the size axis
|
|
12
|
+
* `data` when available, otherwise from the `sizeValue` of the scatter point.
|
|
13
|
+
* It falls back to the series `markerSize` when no size can be computed.
|
|
14
|
+
*/
|
|
15
|
+
const getMarkerSize = (series, sizeZAxis) => {
|
|
16
|
+
const sizeScale = sizeZAxis?.sizeScale;
|
|
17
|
+
if (!sizeScale) {
|
|
18
|
+
return () => series.markerSize;
|
|
19
|
+
}
|
|
20
|
+
return dataIndex => {
|
|
21
|
+
if (sizeZAxis?.data?.[dataIndex] !== undefined) {
|
|
22
|
+
const size = sizeScale(sizeZAxis.data[dataIndex]);
|
|
23
|
+
if (size != null && !Number.isNaN(size)) {
|
|
24
|
+
return size;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const value = series.data[dataIndex];
|
|
28
|
+
if (value != null) {
|
|
29
|
+
const size = sizeScale(value.sizeValue);
|
|
30
|
+
if (size != null && !Number.isNaN(size)) {
|
|
31
|
+
return size;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return series.markerSize;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default getMarkerSize;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
var
|
|
9
|
+
var _incompleteDatasetKeysError = require("../../internals/incompleteDatasetKeysError");
|
|
10
10
|
const seriesProcessor = ({
|
|
11
11
|
series,
|
|
12
12
|
seriesOrder
|
|
@@ -15,18 +15,33 @@ const seriesProcessor = ({
|
|
|
15
15
|
const datasetKeys = seriesData?.datasetKeys;
|
|
16
16
|
const missingKeys = ['x', 'y'].filter(key => typeof datasetKeys?.[key] !== 'string');
|
|
17
17
|
if (seriesData?.datasetKeys && missingKeys.length > 0) {
|
|
18
|
-
|
|
18
|
+
(0, _incompleteDatasetKeysError.incompleteDatasetKeysError)('Scatter', seriesId, missingKeys);
|
|
19
19
|
}
|
|
20
20
|
let data;
|
|
21
21
|
if (seriesData.valueGetter) {
|
|
22
22
|
data = dataset?.map(seriesData.valueGetter) ?? [];
|
|
23
23
|
} else if (datasetKeys) {
|
|
24
|
-
data = dataset?.map(d =>
|
|
25
|
-
x
|
|
26
|
-
y
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
data = dataset?.map(d => {
|
|
25
|
+
const x = d[datasetKeys.x];
|
|
26
|
+
const y = d[datasetKeys.y];
|
|
27
|
+
const rep = {
|
|
28
|
+
x,
|
|
29
|
+
y
|
|
30
|
+
};
|
|
31
|
+
if (datasetKeys.colorValue !== undefined) {
|
|
32
|
+
rep.colorValue = d[datasetKeys.colorValue];
|
|
33
|
+
}
|
|
34
|
+
if (datasetKeys.sizeValue !== undefined) {
|
|
35
|
+
rep.sizeValue = d[datasetKeys.sizeValue];
|
|
36
|
+
}
|
|
37
|
+
if (datasetKeys.z !== undefined) {
|
|
38
|
+
rep.z = d[datasetKeys.z];
|
|
39
|
+
}
|
|
40
|
+
if (datasetKeys.id !== undefined) {
|
|
41
|
+
rep.id = d[datasetKeys.id];
|
|
42
|
+
}
|
|
43
|
+
return rep;
|
|
44
|
+
}) ?? [];
|
|
30
45
|
} else {
|
|
31
46
|
data = seriesData.data ?? [];
|
|
32
47
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import
|
|
2
|
+
import { incompleteDatasetKeysError } from "../../internals/incompleteDatasetKeysError.mjs";
|
|
3
3
|
const seriesProcessor = ({
|
|
4
4
|
series,
|
|
5
5
|
seriesOrder
|
|
@@ -8,18 +8,33 @@ const seriesProcessor = ({
|
|
|
8
8
|
const datasetKeys = seriesData?.datasetKeys;
|
|
9
9
|
const missingKeys = ['x', 'y'].filter(key => typeof datasetKeys?.[key] !== 'string');
|
|
10
10
|
if (seriesData?.datasetKeys && missingKeys.length > 0) {
|
|
11
|
-
|
|
11
|
+
incompleteDatasetKeysError('Scatter', seriesId, missingKeys);
|
|
12
12
|
}
|
|
13
13
|
let data;
|
|
14
14
|
if (seriesData.valueGetter) {
|
|
15
15
|
data = dataset?.map(seriesData.valueGetter) ?? [];
|
|
16
16
|
} else if (datasetKeys) {
|
|
17
|
-
data = dataset?.map(d =>
|
|
18
|
-
x
|
|
19
|
-
y
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
data = dataset?.map(d => {
|
|
18
|
+
const x = d[datasetKeys.x];
|
|
19
|
+
const y = d[datasetKeys.y];
|
|
20
|
+
const rep = {
|
|
21
|
+
x,
|
|
22
|
+
y
|
|
23
|
+
};
|
|
24
|
+
if (datasetKeys.colorValue !== undefined) {
|
|
25
|
+
rep.colorValue = d[datasetKeys.colorValue];
|
|
26
|
+
}
|
|
27
|
+
if (datasetKeys.sizeValue !== undefined) {
|
|
28
|
+
rep.sizeValue = d[datasetKeys.sizeValue];
|
|
29
|
+
}
|
|
30
|
+
if (datasetKeys.z !== undefined) {
|
|
31
|
+
rep.z = d[datasetKeys.z];
|
|
32
|
+
}
|
|
33
|
+
if (datasetKeys.id !== undefined) {
|
|
34
|
+
rep.id = d[datasetKeys.id];
|
|
35
|
+
}
|
|
36
|
+
return rep;
|
|
37
|
+
}) ?? [];
|
|
23
38
|
} else {
|
|
24
39
|
data = seriesData.data ?? [];
|
|
25
40
|
}
|