Skip to content

Commit

Permalink
refactor: series identifications throughout library (#419)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `GeometryId` is now `SeriesIdentifier`. `customSeriesColors` prop on `SeriesSpec` which used to take a `CustomSeriesColorsMap`, now expects a `CustomSeriesColors` type. `LegendItemListener` now passes the `SeriesIdentifier` type as the first callback argument.
  • Loading branch information
nickofthyme authored and markov00 committed Dec 2, 2019
1 parent 3013c41 commit 66a48ff
Show file tree
Hide file tree
Showing 73 changed files with 2,824 additions and 1,698 deletions.
11 changes: 0 additions & 11 deletions .storybook/utils.ts

This file was deleted.

2 changes: 2 additions & 0 deletions integration/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ function requireAllStories() {

function encodeString(string: string) {
return string
.replace(/-/g, ' ')
.replace(/\w-\w/g, ' ')
.replace(/\//gi, ' ')
.replace(/-/g, ' ')
.replace(/[^a-z|A-Z|0-9|\s|\/]+/gi, '')
Expand Down
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"ts-loader": "^6.1.2",
"ts-prune": "^0.3.0",
"typescript": "^3.6.3",
"utility-types": "^3.8.0",
"utility-types": "^3.9.0",
"webpack": "^4.29.5",
"webpack-cli": "^3.3.1",
"webpack-dev-server": "^3.3.1"
Expand Down
186 changes: 124 additions & 62 deletions src/chart_types/xy_chart/domains/y_domain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand Down Expand Up @@ -58,22 +62,28 @@ describe('Y Domain', () => {
const dataSeries1: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
const dataSeries2: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 10 }, { x: 2, y1: 10 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
];
Expand Down Expand Up @@ -123,22 +133,28 @@ describe('Y Domain', () => {
const dataSeries1: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
const dataSeries2: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 10 }, { x: 2, y1: 10 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
];
Expand Down Expand Up @@ -181,22 +197,28 @@ describe('Y Domain', () => {
const dataSeries1: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
const dataSeries2: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 10 }, { x: 2, y1: 10 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
];
Expand Down Expand Up @@ -239,22 +261,28 @@ describe('Y Domain', () => {
const dataSeries1: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: new Array(maxValues).fill(0).map((d, i) => ({ x: i, y1: i })),
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: new Array(maxValues).fill(0).map((d, i) => ({ x: i, y1: i })),
},
];
const dataSeries2: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: new Array(maxValues).fill(0).map((d, i) => ({ x: i, y1: i })),
},
];
Expand Down Expand Up @@ -460,14 +488,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand All @@ -494,14 +526,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand Down Expand Up @@ -540,14 +576,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand Down Expand Up @@ -586,14 +626,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand Down Expand Up @@ -628,14 +672,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand Down Expand Up @@ -674,14 +722,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand Down Expand Up @@ -714,22 +766,28 @@ describe('Y Domain', () => {
const dataSeries1: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
const dataSeries2: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 10 }, { x: 2, y1: 10 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
];
Expand Down Expand Up @@ -774,14 +832,18 @@ describe('Y Domain', () => {
const dataSeries: RawDataSeries[] = [
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 2, y1: 2 }, { x: 3, y1: 2 }, { x: 4, y1: 5 }],
},
{
specId: 'a',
key: [''],
seriesColorKey: '',
yAccessor: 'y1',
splitAccessors: new Map(),
seriesKeys: [''],
key: '',
data: [{ x: 1, y1: 2 }, { x: 4, y1: 7 }],
},
];
Expand Down
Loading

0 comments on commit 66a48ff

Please sign in to comment.