Skip to content

Commit

Permalink
feat(series): BubbleSeries (alpha) and markSizeAccessor (opensearch-p…
Browse files Browse the repository at this point in the history
…roject#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
  • Loading branch information
nickofthyme authored Apr 21, 2020
1 parent e2444ef commit 85d9bda
Show file tree
Hide file tree
Showing 130 changed files with 9,238 additions and 1,681 deletions.
1 change: 1 addition & 0 deletions packages/osd-charts/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/dist
/coverage
/.vscode
src/utils/d3-delaunay/*
2 changes: 1 addition & 1 deletion packages/osd-charts/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.md
*.mdx
*.mdx
20 changes: 19 additions & 1 deletion packages/osd-charts/NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,22 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.

---
This product also includes code that is adapted from [email protected],
which is available under a "ISC" license.

Copyright 2018 Observable, Inc.

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/osd-charts/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
roots: ['<rootDir>/src'],
preset: 'ts-jest',
testEnvironment: 'jest-environment-jsdom-fourteen',
setupFilesAfterEnv: ['jest-extended', '<rootDir>/scripts/setup_enzyme.ts', '<rootDir>/scripts/custom_matchers.ts'],
setupFilesAfterEnv: ['<rootDir>/scripts/setup_enzyme.ts', '<rootDir>/scripts/custom_matchers.ts'],
coveragePathIgnorePatterns: ['<rootDir>/src/mocks/', '<rootDir>/node_modules/'],
clearMocks: true,
globals: {
Expand Down
1 change: 1 addition & 0 deletions packages/osd-charts/scripts/custom_matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License. */

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

// ensure this is parsed as a module.
export {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

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

export const defaultColor = module.defaultColor;
export const transparentColor = module.transparentColor;
export const defaultD3Color = module.defaultD3Color;

export const stringToRGB = jest.fn(module.stringToRGB);
export const validateColor = jest.fn(module.validateColor);
export const argsToRGB = jest.fn(module.argsToRGB);
Expand Down
7 changes: 4 additions & 3 deletions packages/osd-charts/src/chart_types/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@

export {
AreaSeries,
BarSeries,
LineSeries,
Axis,
BarSeries,
BubbleSeries,
HistogramBarSeries,
LineAnnotation,
LineSeries,
RectAnnotation,
HistogramBarSeries,
} from './xy_chart/specs';

export * from './xy_chart/utils/specs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export function scaleAndValidateDatum(dataValue: any, scale: Scale, alignWithTic
const isContinuous = scale.type !== ScaleType.Ordinal;
const scaledValue = scale.scale(dataValue);
// d3.scale will return 0 for '', rendering the line incorrectly at 0
if (isNaN(scaledValue) || (isContinuous && dataValue === '')) {
if (scaledValue === null || (isContinuous && dataValue === '')) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function computeYDomainLineAnnotationDimensions(

const annotationValueYposition = yScale.scale(dataValue);
// avoid rendering non scalable annotation values
if (isNaN(annotationValueYposition)) {
if (annotationValueYposition === null) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function getSnapPosition(
totalBarsInCluster = 1,
): { band: number; position: number } | undefined {
const position = scale.scale(value);
if (position === undefined) {
if (position === null) {
return;
}

Expand Down
Loading

0 comments on commit 85d9bda

Please sign in to comment.