Skip to content

Commit 3aa235e

Browse files
authored
feat(series): BubbleSeries (alpha) and markSizeAccessor (#559)
- add `BubbleSeries` (alpha), like line without the line but uses a spatial index for point selection - add `markSizeAccessor` prop to `area`, `line` and `bubble` chart types to set the mark radius
1 parent e5a206d commit 3aa235e

File tree

130 files changed

+9238
-1681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+9238
-1681
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99
/dist
1010
/coverage
1111
/.vscode
12+
src/utils/d3-delaunay/*

.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
*.md
2-
*.mdx
2+
*.mdx

NOTICE.txt

+19-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,22 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2121
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2222
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2323
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24-
SOFTWARE.
24+
SOFTWARE.
25+
26+
---
27+
This product also includes code that is adapted from [email protected],
28+
which is available under a "ISC" license.
29+
30+
Copyright 2018 Observable, Inc.
31+
32+
Permission to use, copy, modify, and/or distribute this software for any purpose
33+
with or without fee is hereby granted, provided that the above copyright notice
34+
and this permission notice appear in all copies.
35+
36+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
37+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
38+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
39+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
40+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
41+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
42+
THIS SOFTWARE.

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = {
2020
roots: ['<rootDir>/src'],
2121
preset: 'ts-jest',
2222
testEnvironment: 'jest-environment-jsdom-fourteen',
23-
setupFilesAfterEnv: ['jest-extended', '<rootDir>/scripts/setup_enzyme.ts', '<rootDir>/scripts/custom_matchers.ts'],
23+
setupFilesAfterEnv: ['<rootDir>/scripts/setup_enzyme.ts', '<rootDir>/scripts/custom_matchers.ts'],
2424
coveragePathIgnorePatterns: ['<rootDir>/src/mocks/', '<rootDir>/node_modules/'],
2525
clearMocks: true,
2626
globals: {

scripts/custom_matchers.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* under the License. */
1818

1919
import { matcherErrorMessage } from 'jest-matcher-utils';
20+
import 'jest-extended'; // require to load jest-extended matchers
2021

2122
// ensure this is parsed as a module.
2223
export {};

src/chart_types/partition_chart/layout/utils/__mocks__/d3_utils.ts

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818

1919
const module = jest.requireActual('../d3_utils.ts');
2020

21+
export const defaultColor = module.defaultColor;
22+
export const transparentColor = module.transparentColor;
23+
export const defaultD3Color = module.defaultD3Color;
24+
2125
export const stringToRGB = jest.fn(module.stringToRGB);
2226
export const validateColor = jest.fn(module.validateColor);
2327
export const argsToRGB = jest.fn(module.argsToRGB);

src/chart_types/specs.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818

1919
export {
2020
AreaSeries,
21-
BarSeries,
22-
LineSeries,
2321
Axis,
22+
BarSeries,
23+
BubbleSeries,
24+
HistogramBarSeries,
2425
LineAnnotation,
26+
LineSeries,
2527
RectAnnotation,
26-
HistogramBarSeries,
2728
} from './xy_chart/specs';
2829

2930
export * from './xy_chart/utils/specs';

src/chart_types/xy_chart/annotations/annotation_utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function scaleAndValidateDatum(dataValue: any, scale: Scale, alignWithTic
9191
const isContinuous = scale.type !== ScaleType.Ordinal;
9292
const scaledValue = scale.scale(dataValue);
9393
// d3.scale will return 0 for '', rendering the line incorrectly at 0
94-
if (isNaN(scaledValue) || (isContinuous && dataValue === '')) {
94+
if (scaledValue === null || (isContinuous && dataValue === '')) {
9595
return null;
9696
}
9797

src/chart_types/xy_chart/annotations/line_annotation_tooltip.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function computeYDomainLineAnnotationDimensions(
107107

108108
const annotationValueYposition = yScale.scale(dataValue);
109109
// avoid rendering non scalable annotation values
110-
if (isNaN(annotationValueYposition)) {
110+
if (annotationValueYposition === null) {
111111
return;
112112
}
113113

src/chart_types/xy_chart/crosshair/crosshair_utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function getSnapPosition(
3737
totalBarsInCluster = 1,
3838
): { band: number; position: number } | undefined {
3939
const position = scale.scale(value);
40-
if (position === undefined) {
40+
if (position === null) {
4141
return;
4242
}
4343

0 commit comments

Comments
 (0)