diff --git a/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.areas.test.ts.snap b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.areas.test.ts.snap new file mode 100644 index 0000000000..2b59fee909 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.areas.test.ts.snap @@ -0,0 +1,1183 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rendering points - areas Multi series area chart - linear can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 100, + "y": 75, + }, +] +`; + +exports[`Rendering points - areas Multi series area chart - linear can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 20, + ], + "mark": null, + "x": 0, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 10, + ], + "mark": null, + "x": 1, + "y": 10, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - areas Multi series area chart - ordinal can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 50, + "y": 75, + }, +] +`; + +exports[`Rendering points - areas Multi series area chart - ordinal can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 20, + ], + "mark": null, + "x": 0, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 10, + ], + "mark": null, + "x": 1, + "y": 10, + }, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering points - areas Multi series area chart - time can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 10, + ], + "mark": null, + "x": 1546300800000, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 5, + ], + "mark": null, + "x": 1546387200000, + "y": 5, + }, + "x": 100, + "y": 75, + }, +] +`; + +exports[`Rendering points - areas Multi series area chart - time can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 20, + ], + "mark": null, + "x": 1546300800000, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 10, + ], + "mark": null, + "x": 1546387200000, + "y": 10, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - areas Single series area chart - linear Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - areas Single series area chart - ordinal Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering points - areas Single series area chart - time Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 10, + ], + "mark": null, + "x": 1546300800000, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 5, + ], + "mark": null, + "x": 1546387200000, + "y": 5, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - areas Stacked areas with 0 values 1`] = ` +Array [ + Object { + "datum": Array [ + 1546300800000, + 0, + ], + "filled": undefined, + "initialY0": null, + "initialY1": 0, + "mark": null, + "x": 1546300800000, + "y0": 0, + "y1": 0, + }, + Object { + "datum": Array [ + 1546387200000, + 5, + ], + "filled": undefined, + "initialY0": null, + "initialY1": 5, + "mark": null, + "x": 1546387200000, + "y0": 0, + "y1": 0.7142857142857143, + }, +] +`; + +exports[`Rendering points - areas Stacked areas with null values 1`] = ` +Array [ + Object { + "datum": Array [ + 1546300800000, + null, + ], + "filled": undefined, + "initialY0": null, + "initialY1": null, + "mark": null, + "x": 1546300800000, + "y0": 0, + "y1": 0, + }, + Object { + "datum": Array [ + 1546387200000, + 5, + ], + "filled": undefined, + "initialY0": null, + "initialY1": 5, + "mark": null, + "x": 1546387200000, + "y0": 0, + "y1": 5, + }, +] +`; + +exports[`Rendering points - areas Stacked areas with null values 2`] = ` +Array [ + Object { + "datum": Array [ + 1546300800000, + 3, + ], + "filled": undefined, + "initialY0": null, + "initialY1": 3, + "mark": null, + "x": 1546300800000, + "y0": 0, + "y1": 3, + }, + Object { + "datum": Array [ + 1546387200000, + null, + ], + "filled": undefined, + "initialY0": null, + "initialY1": null, + "mark": null, + "x": 1546387200000, + "y0": 5, + "y1": 5, + }, +] +`; diff --git a/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bands.test.ts.snap b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bands.test.ts.snap new file mode 100644 index 0000000000..f35a61b7ad --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bands.test.ts.snap @@ -0,0 +1,780 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rendering bands - areas Single band area chart Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y0", + "datum": Array [ + 0, + 2, + 10, + ], + "mark": null, + "x": 0, + "y": 2, + }, + "x": 0, + "y": 80, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 2, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y0", + "datum": Array [ + 1, + 3, + 5, + ], + "mark": null, + "x": 1, + "y": 3, + }, + "x": 50, + "y": 70, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 3, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering bands - areas Single band area chart with null values Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": true, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 12.5, + "y": 0, + }, + "value": Object { + "accessor": "y0", + "datum": Array [ + 0, + 2, + 10, + ], + "mark": null, + "x": 0, + "y": 2, + }, + "x": 0, + "y": 80, + }, + Object { + "color": "red", + "orphan": true, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 12.5, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 2, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 12.5, + "y": 0, + }, + "value": Object { + "accessor": "y0", + "datum": Array [ + 2, + 3, + 5, + ], + "mark": null, + "x": 2, + "y": 3, + }, + "x": 50, + "y": 70, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 12.5, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 2, + 3, + 5, + ], + "mark": null, + "x": 2, + "y": 5, + }, + "x": 50, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 12.5, + "y": 0, + }, + "value": Object { + "accessor": "y0", + "datum": Array [ + 3, + 3, + 5, + ], + "mark": null, + "x": 3, + "y": 3, + }, + "x": 75, + "y": 70, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 12.5, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 3, + 3, + 5, + ], + "mark": null, + "x": 3, + "y": 5, + }, + "x": 75, + "y": 50, + }, +] +`; + +exports[`Rendering bands - areas Single series band bar chart - ordinal Can render two bars 1`] = ` +Array [ + Object { + "color": "red", + "displayValue": undefined, + "height": 80, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 2, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "width": 25, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "displayValue": undefined, + "height": 20, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 2, + 3, + 5, + ], + "mark": null, + "x": 2, + "y": 5, + }, + "width": 25, + "x": 50, + "y": 50, + }, + Object { + "color": "red", + "displayValue": undefined, + "height": 40, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{2}splitAccessors{}", + "seriesKeys": Array [ + 2, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 2, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 3, + 4, + 8, + ], + "mark": null, + "x": 3, + "y": 8, + }, + "width": 25, + "x": 75, + "y": 20, + }, +] +`; diff --git a/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bars.test.ts.snap b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bars.test.ts.snap new file mode 100644 index 0000000000..33da933b9e --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bars.test.ts.snap @@ -0,0 +1,358 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rendering bars Can render two bars within domain 1`] = ` +Array [ + Object { + "color": "red", + "displayValue": undefined, + "height": 100, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "width": 50, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "displayValue": undefined, + "height": 50, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "width": 50, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering bars Multi series bar chart - ordinal can render first spec bars 1`] = ` +Array [ + Object { + "color": "red", + "displayValue": undefined, + "height": 50, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{bar1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "bar1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "width": 25, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "displayValue": undefined, + "height": 25, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{bar1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "bar1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "width": 25, + "x": 50, + "y": 75, + }, +] +`; + +exports[`Rendering bars Multi series bar chart - ordinal can render second spec bars 1`] = ` +Array [ + Object { + "color": "blue", + "displayValue": undefined, + "height": 100, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{bar2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "bar2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 20, + ], + "mark": null, + "x": 0, + "y": 20, + }, + "width": 25, + "x": 25, + "y": 0, + }, + Object { + "color": "blue", + "displayValue": undefined, + "height": 50, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{bar2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "bar2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "seriesStyle": Object { + "displayValue": Object { + "fill": "#777", + "fontFamily": "sans-serif", + "fontSize": 8, + "fontStyle": "normal", + "offsetX": 0, + "offsetY": 0, + "padding": 0, + }, + "rect": Object { + "opacity": 1, + }, + "rectBorder": Object { + "strokeWidth": 1, + "visible": false, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 10, + ], + "mark": null, + "x": 1, + "y": 10, + }, + "width": 25, + "x": 75, + "y": 50, + }, +] +`; diff --git a/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bubble.test.ts.snap b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bubble.test.ts.snap new file mode 100644 index 0000000000..eb04608866 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.bubble.test.ts.snap @@ -0,0 +1,1269 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rendering points - bubble Multi series bubble chart - linear can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 100, + "y": 75, + }, +] +`; + +exports[`Rendering points - bubble Multi series bubble chart - linear can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 20, + ], + "mark": null, + "x": 0, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 10, + ], + "mark": null, + "x": 1, + "y": 10, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - bubble Multi series bubble chart - ordinal can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 50, + "y": 75, + }, +] +`; + +exports[`Rendering points - bubble Multi series bubble chart - ordinal can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 20, + ], + "mark": null, + "x": 0, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 10, + ], + "mark": null, + "x": 1, + "y": 10, + }, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering points - bubble Multi series bubble chart - time can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 10, + ], + "mark": null, + "x": 1546300800000, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 5, + ], + "mark": null, + "x": 1546387200000, + "y": 5, + }, + "x": 100, + "y": 75, + }, +] +`; + +exports[`Rendering points - bubble Multi series bubble chart - time can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 20, + ], + "mark": null, + "x": 1546300800000, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 10, + ], + "mark": null, + "x": 1546387200000, + "y": 10, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - bubble Remove points datum is not in domain Should render 3 points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 0, + ], + "mark": null, + "x": 0, + "y": 0, + }, + "x": 0, + "y": 99.5, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 1, + ], + "mark": null, + "x": 1, + "y": 1, + }, + "x": 50, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 2, + 10, + ], + "mark": null, + "x": 2, + "y": 10, + }, + "x": 100, + "y": -900, + }, +] +`; + +exports[`Rendering points - bubble Single series bubble chart - linear Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - bubble Single series bubble chart - ordinal Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering points - bubble Single series bubble chart - time Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 10, + ], + "mark": null, + "x": 1546300800000, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 5, + ], + "mark": null, + "x": 1546387200000, + "y": 5, + }, + "x": 100, + "y": 50, + }, +] +`; diff --git a/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.lines.test.ts.snap b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.lines.test.ts.snap new file mode 100644 index 0000000000..c81944a55e --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/rendering/__snapshots__/rendering.lines.test.ts.snap @@ -0,0 +1,1269 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Rendering points - line Multi series line chart - linear can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 100, + "y": 75, + }, +] +`; + +exports[`Rendering points - line Multi series line chart - linear can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 20, + ], + "mark": null, + "x": 0, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 10, + ], + "mark": null, + "x": 1, + "y": 10, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - line Multi series line chart - ordinal can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 50, + "y": 75, + }, +] +`; + +exports[`Rendering points - line Multi series line chart - ordinal can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 20, + ], + "mark": null, + "x": 0, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 10, + ], + "mark": null, + "x": 1, + "y": 10, + }, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering points - line Multi series line chart - time can render first spec points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 10, + ], + "mark": null, + "x": 1546300800000, + "y": 10, + }, + "x": 0, + "y": 50, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 5, + ], + "mark": null, + "x": 1546387200000, + "y": 5, + }, + "x": 100, + "y": 75, + }, +] +`; + +exports[`Rendering points - line Multi series line chart - time can render second spec points 1`] = ` +Array [ + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 20, + ], + "mark": null, + "x": 1546300800000, + "y": 20, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "blue", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{point2}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "point2", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 255, + "g": 0, + "opacity": 1, + "r": 0, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 10, + ], + "mark": null, + "x": 1546387200000, + "y": 10, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - line Removing out-of-domain points should render 3 points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 0, + ], + "mark": null, + "x": 0, + "y": 0, + }, + "x": 0, + "y": 99.5, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 1, + ], + "mark": null, + "x": 1, + "y": 1, + }, + "x": 50, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{__global__}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 2, + 10, + ], + "mark": null, + "x": 2, + "y": 10, + }, + "x": 100, + "y": -900, + }, +] +`; + +exports[`Rendering points - line Single series line chart - linear Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 100, + "y": 50, + }, +] +`; + +exports[`Rendering points - line Single series line chart - ordinal Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 0, + 10, + ], + "mark": null, + "x": 0, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 25, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1, + 5, + ], + "mark": null, + "x": 1, + "y": 5, + }, + "x": 50, + "y": 50, + }, +] +`; + +exports[`Rendering points - line Single series line chart - time Can render two points 1`] = ` +Array [ + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546300800000, + 10, + ], + "mark": null, + "x": 1546300800000, + "y": 10, + }, + "x": 0, + "y": 0, + }, + Object { + "color": "red", + "orphan": false, + "panel": Object { + "height": 100, + "left": 0, + "top": 0, + "width": 100, + }, + "radius": 2, + "seriesIdentifier": Object { + "key": "groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}", + "seriesKeys": Array [ + 1, + ], + "smHorizontalAccessorValue": undefined, + "smVerticalAccessorValue": undefined, + "specId": "spec_1", + "splitAccessors": Map {}, + "yAccessor": 1, + }, + "style": Object { + "fill": Object { + "color": Object { + "b": 255, + "g": 255, + "opacity": 1, + "r": 255, + }, + }, + "shape": "circle", + "stroke": Object { + "color": Object { + "b": 0, + "g": 0, + "opacity": 1, + "r": 255, + }, + "width": 1, + }, + }, + "transform": Object { + "x": 0, + "y": 0, + }, + "value": Object { + "accessor": "y1", + "datum": Array [ + 1546387200000, + 5, + ], + "mark": null, + "x": 1546387200000, + "y": 5, + }, + "x": 100, + "y": 50, + }, +] +`; diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts index 5ae4ce5096..cb2a5fc450 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.areas.test.ts @@ -19,8 +19,6 @@ import { Store } from 'redux'; -import { MockPointGeometry } from '../../../mocks/geometries'; -import { MockSeriesIdentifier } from '../../../mocks/series/series_identifiers'; import { MockGlobalSpec, MockSeriesSpec } from '../../../mocks/specs'; import { MockStore } from '../../../mocks/store'; import { ScaleType } from '../../../scales/constants'; @@ -107,68 +105,7 @@ describe('Rendering points - areas', () => { test('Can render two points', () => { const { points } = areaGeometry; - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: { - specId: SPEC_ID, - yAccessor: 1, - splitAccessors: new Map(), - seriesKeys: [1], - key: 'groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}', - }, - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 25, - y: 0, - }, - panel: { - width: 100, - height: 100, - top: 0, - left: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 50, - color: 'red', - seriesIdentifier: { - specId: SPEC_ID, - yAccessor: 1, - splitAccessors: new Map(), - seriesKeys: [1], - key: 'groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}', - }, - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 25, - y: 0, - }, - panel: { - width: 100, - height: 100, - top: 0, - left: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -228,135 +165,13 @@ describe('Rendering points - areas', () => { const { areas } = geometries.geometries; const [{ value: firstArea }] = areas; expect(firstArea.points.length).toEqual(2); - expect(firstArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: { - specId: 'spec_1', - yAccessor: 1, - splitAccessors: new Map(), - seriesKeys: [1], - key: 'groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}', - }, - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 25, - y: 0, - }, - panel: { - width: 100, - height: 100, - top: 0, - left: 0, - }, - }), - ); - expect(firstArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 75, - color: 'red', - seriesIdentifier: { - specId: 'spec_1', - yAccessor: 1, - splitAccessors: new Map(), - seriesKeys: [1], - key: 'groupId{group_1}spec{spec_1}yAccessor{1}splitAccessors{}', - }, - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 25, - y: 0, - }, - panel: { - width: 100, - height: 100, - top: 0, - left: 0, - }, - }), - ); + expect(firstArea.points).toMatchSnapshot(); }); test('can render second spec points', () => { const { areas } = geometries.geometries; const [, { value: secondArea }] = areas; expect(secondArea.points.length).toEqual(2); - expect(secondArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: { - specId: 'spec_2', - yAccessor: 1, - splitAccessors: new Map(), - seriesKeys: [1], - key: 'groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}', - }, - value: { - accessor: 'y1', - x: 0, - y: 20, - mark: null, - datum: [0, 20], - }, - transform: { - x: 25, - y: 0, - }, - panel: { - width: 100, - height: 100, - top: 0, - left: 0, - }, - }), - ); - expect(secondArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 50, - color: 'blue', - seriesIdentifier: { - specId: 'spec_2', - yAccessor: 1, - splitAccessors: new Map(), - seriesKeys: [1], - key: 'groupId{group_1}spec{spec_2}yAccessor{1}splitAccessors{}', - }, - value: { - accessor: 'y1', - x: 1, - y: 10, - mark: null, - datum: [1, 10], - }, - transform: { - x: 25, - y: 0, - }, - panel: { - width: 100, - height: 100, - top: 0, - left: 0, - }, - }), - ); + expect(secondArea.points).toMatchSnapshot(); }); test('has the right number of geometry in the indexes', () => { const { areas } = geometries.geometries; @@ -397,36 +212,7 @@ describe('Rendering points - areas', () => { test('Can render two points', () => { const { areas } = geometries.geometries; const [{ value: firstArea }] = areas; - expect(firstArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - }), - ); - expect(firstArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - }), - ); + expect(firstArea.points).toMatchSnapshot(); expect(geometries.geometriesIndex.size).toEqual(firstArea.points.length); }); }); @@ -482,74 +268,14 @@ describe('Rendering points - areas', () => { const { areas } = geometries.geometries; const [{ value: firstArea }] = areas; expect(firstArea.points.length).toEqual(2); - expect(firstArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec1), - - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - }), - ); - expect(firstArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec1), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - }), - ); + expect(firstArea.points).toMatchSnapshot(); expect(geometries.geometriesIndex.size).toEqual(firstArea.points.length); }); test('can render second spec points', () => { const { areas } = geometries.geometries; const [, { value: secondArea }] = areas; expect(secondArea.points.length).toEqual(2); - expect(secondArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec2), - - value: { - accessor: 'y1', - x: 0, - y: 20, - mark: null, - datum: [0, 20], - }, - }), - ); - expect(secondArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec2), - value: { - accessor: 'y1', - x: 1, - y: 10, - mark: null, - datum: [1, 10], - }, - }), - ); + expect(secondArea.points).toMatchSnapshot(); expect(geometries.geometriesIndex.size).toEqual(secondArea.points.length); }); }); @@ -585,37 +311,7 @@ describe('Rendering points - areas', () => { test('Can render two points', () => { const { areas } = geometries.geometries; const [{ value: firstArea }] = areas; - expect(firstArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec), - - value: { - accessor: 'y1', - x: 1546300800000, - y: 10, - mark: null, - datum: [1546300800000, 10], - }, - }), - ); - expect(firstArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec), - value: { - accessor: 'y1', - x: 1546387200000, - y: 5, - mark: null, - datum: [1546387200000, 5], - }, - }), - ); + expect(firstArea.points).toMatchSnapshot(); expect(geometries.geometriesIndex.size).toEqual(firstArea.points.length); }); }); @@ -653,78 +349,14 @@ describe('Rendering points - areas', () => { test('can render first spec points', () => { const { areas } = geometries.geometries; const [{ value: firstArea }] = areas; - expect(firstArea.points.length).toEqual(2); - expect(firstArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec1), - - value: { - accessor: 'y1', - x: 1546300800000, - y: 10, - mark: null, - datum: [1546300800000, 10], - }, - }), - ); - expect(firstArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec1), - - value: { - accessor: 'y1', - x: 1546387200000, - y: 5, - mark: null, - datum: [1546387200000, 5], - }, - }), - ); + expect(firstArea.points).toMatchSnapshot(); expect(geometries.geometriesIndex.size).toEqual(firstArea.points.length); }); test('can render second spec points', () => { const { areas } = geometries.geometries; const [, { value: secondArea }] = areas; - expect(secondArea.points.length).toEqual(2); - expect(secondArea.points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec2), - - value: { - accessor: 'y1', - x: 1546300800000, - y: 20, - mark: null, - datum: [1546300800000, 20], - }, - }), - ); - expect(secondArea.points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec2), - - value: { - accessor: 'y1', - x: 1546387200000, - y: 10, - mark: null, - datum: [1546387200000, 10], - }, - }), - ); + expect(secondArea.points).toMatchSnapshot(); expect(geometries.geometriesIndex.size).toEqual(secondArea.points.length); }); }); @@ -822,26 +454,7 @@ describe('Rendering points - areas', () => { const store = initStore([pointSeriesSpec1, pointSeriesSpec2]); const domains = computeSeriesDomainsSelector(store.getState()); - expect(domains.formattedDataSeries[0].data).toMatchObject([ - { - datum: [1546300800000, 0], - initialY0: null, - initialY1: 0, - x: 1546300800000, - y0: 0, - y1: 0, - mark: null, - }, - { - datum: [1546387200000, 5], - initialY0: null, - initialY1: 5, - x: 1546387200000, - y0: 0, - y1: 0.7142857142857143, - mark: null, - }, - ]); + expect(domains.formattedDataSeries[0].data).toMatchSnapshot(); }); it('Stacked areas with null values', () => { const pointSeriesSpec1: AreaSeriesSpec = MockSeriesSpec.area({ @@ -871,133 +484,7 @@ describe('Rendering points - areas', () => { const store = initStore([pointSeriesSpec1, pointSeriesSpec2]); const domains = computeSeriesDomainsSelector(store.getState()); - expect(domains.formattedDataSeries[0].data).toMatchObject([ - { - datum: [1546300800000, null], - initialY0: null, - initialY1: null, - x: 1546300800000, - y0: 0, - y1: 0, - mark: null, - }, - { - datum: [1546387200000, 5], - initialY0: null, - initialY1: 5, - x: 1546387200000, - y0: 0, - y1: 5, - mark: null, - }, - ]); - - expect(domains.formattedDataSeries[1].data).toEqual([ - { - datum: [1546300800000, 3], - initialY0: null, - initialY1: 3, - x: 1546300800000, - y0: 0, - y1: 3, - mark: null, - }, - { - datum: [1546387200000, null], - initialY0: null, - initialY1: null, - x: 1546387200000, - y0: 5, - y1: 5, - mark: null, - }, - ]); + expect(domains.formattedDataSeries[0].data).toMatchSnapshot(); + expect(domains.formattedDataSeries[1].data).toMatchSnapshot(); }); - - // describe('Error guards for scaled values', () => { - // const pointSeriesSpec: AreaSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: SPEC_ID, - // groupId: GROUP_ID, - // seriesType: SeriesType.Area, - // data: [ - // [0, 10], - // [1, 5], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Ordinal, - // yScaleType: ScaleType.Linear, - // }; - // const pointSeriesMap = [pointSeriesSpec]; - // const pointSeriesDomains = computeSeriesDomains(pointSeriesMap, new Map()); - // const xScale = computeXScale({ - // xDomain: pointSeriesDomains.xDomain, - // totalBarsInCluster: pointSeriesMap.length, - // range: [0, 100], - // }); - // const yScales = computeYScales({ yDomains: pointSeriesDomains.yDomain, range: [100, 0] }); - // let renderedArea: { - // areaGeometry: AreaGeometry; - // indexedGeometryMap: IndexedGeometryMap; - // }; - // - // beforeEach(() => { - // renderedArea = renderArea( - // 25, // adding a ideal 25px shift, generally applied by renderGeometries - // pointSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // CurveType.LINEAR, - // false, - // 0, - // LIGHT_THEME.areaSeriesStyle, - // { - // enabled: false, - // }, - // ); - // }); - // - // describe('xScale values throw error', () => { - // beforeAll(() => { - // jest.spyOn(xScale, 'scaleOrThrow').mockImplementation(() => { - // throw new Error(); - // }); - // }); - // - // test('Should include no lines nor area', () => { - // const { - // areaGeometry: { lines, area, color, seriesIdentifier, transform }, - // } = renderedArea; - // expect(lines).toHaveLength(0); - // expect(area).toBe(''); - // expect(color).toBe('red'); - // expect(seriesIdentifier.seriesKeys).toEqual([1]); - // expect(seriesIdentifier.specId).toEqual(SPEC_ID); - // expect(transform).toEqual({ x: 25, y: 0 }); - // }); - // }); - // - // describe('yScale values throw error', () => { - // beforeAll(() => { - // jest.spyOn(yScales.get(GROUP_ID)!, 'scaleOrThrow').mockImplementation(() => { - // throw new Error(); - // }); - // }); - // - // test('Should include no lines nor area', () => { - // const { - // areaGeometry: { lines, area, color, seriesIdentifier, transform }, - // } = renderedArea; - // expect(lines).toHaveLength(0); - // expect(area).toBe(''); - // expect(color).toBe('red'); - // expect(seriesIdentifier.seriesKeys).toEqual([1]); - // expect(seriesIdentifier.specId).toEqual(SPEC_ID); - // expect(transform).toEqual({ x: 25, y: 0 }); - // }); - // }); - // }); }); diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bands.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bands.test.ts index 630a89928e..12b505cd95 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bands.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bands.test.ts @@ -17,8 +17,6 @@ * under the License. */ -import { MockBarGeometry, MockPointGeometry } from '../../../mocks'; -import { MockSeriesIdentifier } from '../../../mocks/series/series_identifiers'; import { MockGlobalSpec, MockSeriesSpec } from '../../../mocks/specs'; import { MockStore } from '../../../mocks/store'; import { ScaleType } from '../../../scales/constants'; @@ -70,84 +68,7 @@ describe('Rendering bands - areas', () => { value: { points }, }, ] = areas; - expect(points.length).toBe(4); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 80, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y0', - x: 0, - y: 2, - mark: null, - datum: [0, 2, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 2, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[2]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 70, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y0', - x: 1, - y: 3, - mark: null, - datum: [1, 3, 5], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[3]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 3, 5], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); }); }); describe('Single band area chart with null values', () => { @@ -195,105 +116,7 @@ describe('Rendering bands - areas', () => { value: { points }, }, ] = areas; - expect(points.length).toBe(6); - const getPointGeo = MockPointGeometry.fromBaseline( - { - x: 0, - y: 0, - color: 'red', - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 2, 10], - }, - transform: { - x: 12.5, - y: 0, - }, - }, - 'seriesIdentifier', - ); - expect(points[0]).toMatchObject( - getPointGeo({ - x: 0, - y: 80, - value: { - accessor: 'y0', - x: 0, - y: 2, - mark: null, - datum: [0, 2, 10], - }, - // the first point is also an orphan because the next one is null - orphan: true, - }), - ); - expect(points[1]).toMatchObject( - getPointGeo({ - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 2, 10], - }, - orphan: true, - }), - ); - expect(points[2]).toMatchObject( - getPointGeo({ - x: 50, - y: 70, - value: { - accessor: 'y0', - x: 2, - y: 3, - mark: null, - datum: [2, 3, 5], - }, - }), - ); - expect(points[3]).toMatchObject( - getPointGeo({ - x: 50, - y: 50, - value: { - accessor: 'y1', - x: 2, - y: 5, - mark: null, - datum: [2, 3, 5], - }, - }), - ); - expect(points[4]).toMatchObject( - getPointGeo({ - x: 75, - y: 70, - value: { - accessor: 'y0', - x: 3, - y: 3, - mark: null, - datum: [3, 3, 5], - }, - }), - ); - expect(points[5]).toMatchObject( - getPointGeo({ - x: 75, - y: 50, - value: { - accessor: 'y1', - x: 3, - y: 5, - mark: null, - datum: [3, 3, 5], - }, - }), - ); + expect(points).toMatchSnapshot(); }); }); describe('Single series band bar chart - ordinal', () => { @@ -322,115 +145,7 @@ describe('Rendering bands - areas', () => { } = computeSeriesGeometriesSelector(store.getState()); test('Can render two bars', () => { - expect(bars.length).toBe(3); - expect(bars[0]).toEqual( - MockBarGeometry.default({ - x: 0, - y: 0, - width: 25, - height: 80, - color: 'red', - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 2, 10], - }, - seriesIdentifier: MockSeriesIdentifier.fromSpec(barSeriesSpec), - displayValue: undefined, - seriesStyle: { - displayValue: { - fill: '#777', - fontFamily: 'sans-serif', - fontSize: 8, - fontStyle: 'normal', - offsetX: 0, - offsetY: 0, - padding: 0, - }, - rect: { - opacity: 1, - }, - rectBorder: { - strokeWidth: 1, - visible: false, - }, - }, - }), - ); - expect(bars[1]).toEqual( - MockBarGeometry.default({ - x: 50, - y: 50, - width: 25, - height: 20, - color: 'red', - value: { - accessor: 'y1', - x: 2, - y: 5, - mark: null, - datum: [2, 3, 5], - }, - seriesIdentifier: MockSeriesIdentifier.fromSpec(barSeriesSpec), - displayValue: undefined, - seriesStyle: { - displayValue: { - fill: '#777', - fontFamily: 'sans-serif', - fontSize: 8, - fontStyle: 'normal', - offsetX: 0, - offsetY: 0, - padding: 0, - }, - rect: { - opacity: 1, - }, - rectBorder: { - strokeWidth: 1, - visible: false, - }, - }, - }), - ); - expect(bars[2]).toEqual( - MockBarGeometry.default({ - x: 75, - y: 20, - width: 25, - height: 40, - color: 'red', - value: { - accessor: 'y1', - x: 3, - y: 8, - mark: null, - datum: [3, 4, 8], - }, - seriesIdentifier: MockSeriesIdentifier.fromSpec(barSeriesSpec), - displayValue: undefined, - seriesStyle: { - displayValue: { - fill: '#777', - fontFamily: 'sans-serif', - fontSize: 8, - fontStyle: 'normal', - offsetX: 0, - offsetY: 0, - padding: 0, - }, - rect: { - opacity: 1, - }, - rectBorder: { - strokeWidth: 1, - visible: false, - }, - }, - }), - ); + expect(bars).toMatchSnapshot(); }); }); }); diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bars.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bars.test.ts index 14702b121e..a391806fc2 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bars.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bars.test.ts @@ -17,8 +17,6 @@ * under the License. */ -import { MockBarGeometry } from '../../../mocks'; -import { MockSeriesIdentifier } from '../../../mocks/series/series_identifiers'; import { MockGlobalSpec, MockSeriesSpec } from '../../../mocks/specs'; import { MockStore } from '../../../mocks/store'; import { ScaleType } from '../../../scales/constants'; @@ -50,39 +48,7 @@ describe('Rendering bars', () => { ); const { geometries } = computeSeriesGeometriesSelector(store.getState()); - const getBarGeometry = MockBarGeometry.fromBaseline( - { - x: 0, - y: 0, - width: 50, - height: 100, - color: 'red', - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec), - }, - 'displayValue', - ); - expect(geometries.bars[0].value[0]).toEqual(getBarGeometry()); - expect(geometries.bars[0].value[1]).toEqual( - getBarGeometry({ - x: 50, - y: 50, - width: 50, - height: 50, - value: { - x: 1, - y: 5, - datum: [1, 5], - }, - }), - ); - expect(geometries.bars[0].value.length).toBe(2); + expect(geometries.bars[0].value).toMatchSnapshot(); }); describe('Single series bar chart - ordinal', () => { @@ -246,617 +212,15 @@ describe('Rendering bars', () => { store, ); - const getBarGeometry = MockBarGeometry.fromBaseline( - { - x: 0, - y: 0, - width: 50, - height: 100, - color: 'red', - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - }, - seriesIdentifier: MockSeriesIdentifier.fromSpec(barSeriesSpec1), - }, - 'displayValue', - ); const { geometries: { bars }, } = computeSeriesGeometriesSelector(store.getState()); test('can render first spec bars', () => { - expect(bars[0].value.length).toEqual(2); - expect(bars[0].value[0]).toEqual( - getBarGeometry({ - x: 0, - y: 50, - width: 25, - height: 50, - value: { - x: 0, - y: 10, - datum: [0, 10], - }, - }), - ); - expect(bars[0].value[1]).toEqual( - getBarGeometry({ - x: 50, - y: 75, - width: 25, - height: 25, - value: { - x: 1, - y: 5, - datum: [1, 5], - }, - }), - ); + expect(bars[0].value).toMatchSnapshot(); }); test('can render second spec bars', () => { - const getBarGeometry = MockBarGeometry.fromBaseline( - { - x: 0, - y: 0, - width: 50, - height: 100, - color: 'blue', - value: { - accessor: 'y1', - x: 0, - y: 10, - }, - seriesIdentifier: MockSeriesIdentifier.fromSpec(barSeriesSpec2), - }, - 'displayValue', - ); - expect(bars[1].value.length).toEqual(2); - expect(bars[1].value[0]).toEqual( - getBarGeometry({ - x: 25, - y: 0, - width: 25, - height: 100, - value: { - x: 0, - y: 20, - datum: [0, 20], - }, - }), - ); - expect(bars[1].value[1]).toEqual( - getBarGeometry({ - x: 75, - y: 50, - width: 25, - height: 50, - value: { - x: 1, - y: 10, - datum: [1, 10], - }, - }), - ); + expect(bars[1].value).toMatchSnapshot(); }); }); - // describe('Single series bar chart - linear', () => { - // const barSeriesSpec: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: SPEC_ID, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data: [ - // [0, 10], - // [1, 5], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Linear, - // yScaleType: ScaleType.Linear, - // }; - // const barSeriesMap = [barSeriesSpec]; - // const barSeriesDomains = computeSeriesDomains(barSeriesMap, new Map()); - // const xScale = computeXScale({ - // xDomain: barSeriesDomains.xDomain, - // totalBarsInCluster: barSeriesMap.length, - // range: [0, 100], - // }); - // const yScales = computeYScales({ yDomains: barSeriesDomains.yDomain, range: [100, 0] }); - // - // test('Can render two bars', () => { - // const { barGeometries } = renderBars( - // 0, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // LIGHT_THEME.barSeriesStyle, - // ); - // const getBarGeometry = MockBarGeometry.fromBaseline( - // { - // x: 0, - // y: 0, - // width: 50, - // height: 100, - // color: 'red', - // value: { - // accessor: 'y1', - // x: 0, - // y: 10, - // mark: null, - // }, - // seriesIdentifier: { - // specId: SPEC_ID, - // key: 'spec{spec_1}yAccessor{1}splitAccessors{}', - // yAccessor: 1, - // splitAccessors: new Map(), - // seriesKeys: [1], - // }, - // }, - // 'displayValue', - // ); - // expect(barGeometries[0]).toEqual(getBarGeometry()); - // expect(barGeometries[1]).toEqual( - // getBarGeometry({ - // x: 50, - // y: 50, - // width: 50, - // height: 50, - // value: { - // x: 1, - // y: 5, - // }, - // }), - // ); - // }); - // }); - // describe('Single series bar chart - log', () => { - // const barSeriesSpec: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: SPEC_ID, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data: [ - // [1, 0], - // [2, 1], - // [3, 2], - // [4, 3], - // [5, 4], - // [6, 5], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Linear, - // yScaleType: ScaleType.Log, - // }; - // const barSeriesDomains = computeSeriesDomains([barSeriesSpec], new Map()); - // const xScale = computeXScale({ - // xDomain: barSeriesDomains.xDomain, - // totalBarsInCluster: 1, - // range: [0, 100], - // }); - // const yScales = computeYScales({ yDomains: barSeriesDomains.yDomain, range: [100, 0] }); - // - // test('Can render correct bar height', () => { - // const { barGeometries } = renderBars( - // 0, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // LIGHT_THEME.barSeriesStyle, - // ); - // expect(barGeometries.length).toBe(6); - // expect(barGeometries[0].height).toBe(0); - // expect(barGeometries[1].height).toBe(0); - // expect(barGeometries[2].height).toBeGreaterThan(0); - // expect(barGeometries[3].height).toBeGreaterThan(0); - // }); - // }); - // describe('Multi series bar chart - linear', () => { - // const spec1Id = 'bar1'; - // const spec2Id = 'bar2'; - // const barSeriesSpec1: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: spec1Id, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data: [ - // [0, 10], - // [1, 5], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Linear, - // yScaleType: ScaleType.Linear, - // }; - // const barSeriesSpec2: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: spec2Id, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data: [ - // [0, 20], - // [1, 10], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Linear, - // yScaleType: ScaleType.Linear, - // }; - // const barSeriesMap = [barSeriesSpec1, barSeriesSpec2]; - // const barSeriesDomains = computeSeriesDomains(barSeriesMap, new Map()); - // const xScale = computeXScale({ - // xDomain: barSeriesDomains.xDomain, - // totalBarsInCluster: barSeriesMap.length, - // range: [0, 100], - // }); - // const yScales = computeYScales({ yDomains: barSeriesDomains.yDomain, range: [100, 0] }); - // - // test('can render first spec bars', () => { - // const { barGeometries } = renderBars( - // 0, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // LIGHT_THEME.barSeriesStyle, - // ); - // const getBarGeometry = MockBarGeometry.fromBaseline( - // { - // x: 0, - // y: 50, - // width: 25, - // height: 50, - // color: 'red', - // value: { - // accessor: 'y1', - // x: 0, - // y: 10, - // }, - // seriesIdentifier: { - // specId: spec1Id, - // key: 'spec{bar1}yAccessor{1}splitAccessors{}', - // yAccessor: 1, - // splitAccessors: new Map(), - // seriesKeys: [1], - // }, - // }, - // 'displayValue', - // ); - // expect(barGeometries.length).toEqual(2); - // expect(barGeometries[0]).toEqual(getBarGeometry()); - // expect(barGeometries[1]).toEqual( - // getBarGeometry({ - // x: 50, - // y: 75, - // width: 25, - // height: 25, - // value: { - // x: 1, - // y: 5, - // }, - // }), - // ); - // }); - // test('can render second spec bars', () => { - // const { barGeometries } = renderBars( - // 1, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[1], - // xScale, - // yScales.get(GROUP_ID)!, - // 'blue', - // LIGHT_THEME.barSeriesStyle, - // ); - // const getBarGeometry = MockBarGeometry.fromBaseline( - // { - // x: 25, - // y: 0, - // width: 25, - // height: 100, - // color: 'blue', - // value: { - // accessor: 'y1', - // x: 0, - // y: 20, - // }, - // seriesIdentifier: { - // specId: spec2Id, - // key: 'spec{bar2}yAccessor{1}splitAccessors{}', - // yAccessor: 1, - // splitAccessors: new Map(), - // seriesKeys: [1], - // }, - // }, - // 'displayValue', - // ); - // expect(barGeometries.length).toEqual(2); - // expect(barGeometries[0]).toEqual(getBarGeometry()); - // expect(barGeometries[1]).toEqual( - // getBarGeometry({ - // x: 75, - // y: 50, - // width: 25, - // height: 50, - // color: 'blue', - // value: { - // x: 1, - // y: 10, - // }, - // }), - // ); - // }); - // }); - // describe('Multi series bar chart - time', () => { - // const spec1Id = 'bar1'; - // const spec2Id = 'bar2'; - // const barSeriesSpec1: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: spec1Id, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data: [ - // [1546300800000, 10], - // [1546387200000, 5], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Time, - // yScaleType: ScaleType.Linear, - // }; - // const barSeriesSpec2: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: spec2Id, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data: [ - // [1546300800000, 20], - // [1546387200000, 10], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Time, - // yScaleType: ScaleType.Linear, - // }; - // const barSeriesMap = [barSeriesSpec1, barSeriesSpec2]; - // const barSeriesDomains = computeSeriesDomains(barSeriesMap, new Map()); - // const xScale = computeXScale({ - // xDomain: barSeriesDomains.xDomain, - // totalBarsInCluster: barSeriesMap.length, - // range: [0, 100], - // }); - // const yScales = computeYScales({ yDomains: barSeriesDomains.yDomain, range: [100, 0] }); - // - // test('can render first spec bars', () => { - // const { barGeometries } = renderBars( - // 0, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // LIGHT_THEME.barSeriesStyle, - // ); - // const getBarGeometry = MockBarGeometry.fromBaseline( - // { - // x: 0, - // y: 50, - // width: 25, - // height: 50, - // color: 'red', - // value: { - // accessor: 'y1', - // x: 1546300800000, - // y: 10, - // }, - // seriesIdentifier: { - // specId: spec1Id, - // key: 'spec{bar1}yAccessor{1}splitAccessors{}', - // yAccessor: 1, - // splitAccessors: new Map(), - // seriesKeys: [1], - // }, - // }, - // 'displayValue', - // ); - // expect(barGeometries.length).toEqual(2); - // expect(barGeometries[0]).toEqual(getBarGeometry()); - // expect(barGeometries[1]).toEqual( - // getBarGeometry({ - // x: 50, - // y: 75, - // width: 25, - // height: 25, - // value: { - // accessor: 'y1', - // x: 1546387200000, - // y: 5, - // mark: null, - // }, - // }), - // ); - // }); - // test('can render second spec bars', () => { - // const { barGeometries } = renderBars( - // 1, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[1], - // xScale, - // yScales.get(GROUP_ID)!, - // 'blue', - // LIGHT_THEME.barSeriesStyle, - // ); - // const getBarGeometry = MockBarGeometry.fromBaseline( - // { - // x: 25, - // y: 0, - // width: 25, - // height: 100, - // color: 'blue', - // value: { - // accessor: 'y1', - // x: 1546300800000, - // y: 20, - // mark: null, - // }, - // seriesIdentifier: { - // specId: spec2Id, - // key: 'spec{bar2}yAccessor{1}splitAccessors{}', - // yAccessor: 1, - // splitAccessors: new Map(), - // seriesKeys: [1], - // }, - // }, - // 'displayValue', - // ); - // - // expect(barGeometries.length).toEqual(2); - // expect(barGeometries[0]).toEqual(getBarGeometry()); - // expect(barGeometries[1]).toEqual( - // getBarGeometry({ - // x: 75, - // y: 50, - // width: 25, - // height: 50, - // value: { - // accessor: 'y1', - // x: 1546387200000, - // y: 10, - // mark: null, - // }, - // }), - // ); - // }); - // }); - // describe('Remove points datum is not in domain', () => { - // const barSeriesSpec: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: SPEC_ID, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data: [ - // [0, 0], - // [1, 1], - // [2, 10], - // [3, 3], - // ], - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Linear, - // yScaleType: ScaleType.Linear, - // }; - // const customYDomain = new Map(); - // customYDomain.set(GROUP_ID, { - // max: 1, - // }); - // const barSeriesDomains = computeSeriesDomains([barSeriesSpec], customYDomain, [], { - // max: 2, - // }); - // const xScale = computeXScale({ - // xDomain: barSeriesDomains.xDomain, - // totalBarsInCluster: 1, - // range: [0, 100], - // }); - // const yScales = computeYScales({ yDomains: barSeriesDomains.yDomain, range: [100, 0] }); - // - // test('Can render 3 bars', () => { - // const { barGeometries, indexedGeometryMap } = renderBars( - // 0, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // LIGHT_THEME.barSeriesStyle, - // ); - // expect(barGeometries.length).toBe(3); - // // will be cut by the clipping areas in the rendering component - // expect(barGeometries[2].height).toBe(1000); - // expect(indexedGeometryMap.size).toBe(3); - // }); - // }); - // describe('Renders minBarHeight', () => { - // const minBarHeight = 8; - // const data = [ - // [1, -100000], - // [2, -10000], - // [3, -1000], - // [4, -100], - // [5, -10], - // [6, -1], - // [7, 0], - // [8, -1], - // [9, 0], - // [10, 0], - // [11, 1], - // [12, 0], - // [13, 1], - // [14, 10], - // [15, 100], - // [16, 1000], - // [17, 10000], - // [18, 100000], - // ]; - // const barSeriesSpec: BarSeriesSpec = { - // chartType: ChartType.XYAxis, - // specType: SpecType.Series, - // id: SPEC_ID, - // groupId: GROUP_ID, - // seriesType: SeriesType.Bar, - // data, - // xAccessor: 0, - // yAccessors: [1], - // xScaleType: ScaleType.Linear, - // yScaleType: ScaleType.Linear, - // minBarHeight, - // }; - // - // const customYDomain = new Map(); - // const barSeriesDomains = computeSeriesDomains([barSeriesSpec], customYDomain); - // const xScale = computeXScale({ - // xDomain: barSeriesDomains.xDomain, - // totalBarsInCluster: 1, - // range: [0, 100], - // }); - // const yScales = computeYScales({ yDomains: barSeriesDomains.yDomain, range: [100, 0] }); - // const expected = [-50, -8, -8, -8, -8, -8, 0, -8, 0, 0, 8, 0, 8, 8, 8, 8, 8, 50]; - // - // it('should render correct heights with positive minBarHeight', () => { - // const { barGeometries } = renderBars( - // 0, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // LIGHT_THEME.barSeriesStyle, - // undefined, - // undefined, - // minBarHeight, - // ); - // const barHeights = barGeometries.map(({ height }) => height); - // expect(barHeights).toEqual(expected); - // }); - // it('should render correct heights with negative minBarHeight', () => { - // const { barGeometries } = renderBars( - // 0, - // barSeriesDomains.formattedDataSeries.nonStacked[0].dataSeries[0], - // xScale, - // yScales.get(GROUP_ID)!, - // 'red', - // LIGHT_THEME.barSeriesStyle, - // undefined, - // undefined, - // -minBarHeight, - // ); - // const barHeights = barGeometries.map(({ height }) => height); - // expect(barHeights).toEqual(expected); - // }); - // }); }); diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts index 8a6060f971..7a92aa5f8a 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.bubble.test.ts @@ -17,8 +17,6 @@ * under the License. */ -import { MockPointGeometry } from '../../../mocks'; -import { MockSeriesIdentifier } from '../../../mocks/series/series_identifiers'; import { MockGlobalSpec, MockSeriesSpec } from '../../../mocks/specs'; import { MockStore } from '../../../mocks/store'; import { ScaleType } from '../../../scales/constants'; @@ -63,44 +61,7 @@ describe('Rendering points - bubble', () => { }, ] = bubbles; - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(spec), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -158,45 +119,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); }); test('can render second spec points', () => { const [ @@ -205,45 +128,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 0, - y: 20, - mark: null, - datum: [0, 20], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1, - y: 10, - mark: null, - datum: [1, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); }); }); describe('Single series bubble chart - linear', () => { @@ -280,44 +165,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -376,45 +224,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); }); test('can render second spec points', () => { const [ @@ -423,45 +233,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 0, - y: 20, - mark: null, - datum: [0, 20], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1, - y: 10, - mark: null, - datum: [1, 10], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); }); }); describe('Single series bubble chart - time', () => { @@ -498,44 +270,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1546300800000, - y: 10, - mark: null, - datum: [1546300800000, 10], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1546387200000, - y: 5, - mark: null, - datum: [1546387200000, 5], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -579,45 +314,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1546300800000, - y: 10, - mark: null, - datum: [1546300800000, 10], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1546387200000, - y: 5, - mark: null, - datum: [1546387200000, 5], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(4); }); test('can render second spec points', () => { @@ -627,45 +324,7 @@ describe('Rendering points - bubble', () => { value: { points }, }, ] = bubbles; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1546300800000, - y: 20, - mark: null, - datum: [1546300800000, 20], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1546387200000, - y: 10, - mark: null, - datum: [1546387200000, 10], - }, - transform: { - x: 0, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); }); }); describe('Single series bubble chart - y log', () => { @@ -755,39 +414,10 @@ describe('Rendering points - bubble', () => { }, ] = bubbles; // will not render the 4th point that is out of x domain - expect(points.length).toBe(3); + expect(points).toHaveLength(3); // will keep the 3rd point as an indexedGeometry expect(geometriesIndex.size).toEqual(3); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 99.5, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 0, - y: 0, - mark: null, - datum: [0, 0], - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1, - y: 1, - mark: null, - datum: [1, 1], - }, - }), - ); + expect(points).toMatchSnapshot(); }); }); }); diff --git a/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts b/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts index 86023bb0d5..22cf782127 100644 --- a/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts +++ b/packages/charts/src/chart_types/xy_chart/rendering/rendering.lines.test.ts @@ -17,8 +17,6 @@ * under the License. */ -import { MockPointGeometry } from '../../../mocks'; -import { MockSeriesIdentifier } from '../../../mocks/series/series_identifiers'; import { MockGlobalSpec, MockSeriesSpec } from '../../../mocks/specs'; import { MockStore } from '../../../mocks/store'; import { ScaleType } from '../../../scales/constants'; @@ -68,44 +66,7 @@ describe('Rendering points - line', () => { }, ] = lines; - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -165,45 +126,7 @@ describe('Rendering points - line', () => { value: { points }, }, ] = lines; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); test('can render second spec points', () => { @@ -213,45 +136,7 @@ describe('Rendering points - line', () => { value: { points }, }, ] = lines; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 0, - y: 20, - mark: null, - datum: [0, 20], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1, - y: 10, - mark: null, - datum: [1, 10], - }, - transform: { - x: 25, - y: 0, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -291,36 +176,7 @@ describe('Rendering points - line', () => { value: { points }, }, ] = lines; - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -379,37 +235,7 @@ describe('Rendering points - line', () => { value: { points }, }, ] = lines; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 0, - y: 10, - mark: null, - datum: [0, 10], - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1, - y: 5, - mark: null, - datum: [1, 5], - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); test('can render second spec points', () => { @@ -419,37 +245,7 @@ describe('Rendering points - line', () => { value: { points }, }, ] = lines; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 0, - y: 20, - mark: null, - datum: [0, 20], - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1, - y: 10, - mark: null, - datum: [1, 10], - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -489,36 +285,7 @@ describe('Rendering points - line', () => { value: { points }, }, ] = lines; - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1546300800000, - y: 10, - mark: null, - datum: [1546300800000, 10], - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1546387200000, - y: 5, - mark: null, - datum: [1546387200000, 5], - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -563,92 +330,14 @@ describe('Rendering points - line', () => { const { value: { points }, } = firstLine; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 50, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1546300800000, - y: 10, - mark: null, - datum: [1546300800000, 10], - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 75, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec1), - value: { - accessor: 'y1', - x: 1546387200000, - y: 5, - mark: null, - datum: [1546387200000, 5], - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); test('can render second spec points', () => { const { value: { points }, } = secondLine; - expect(points.length).toEqual(2); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 0, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1546300800000, - y: 20, - mark: null, - datum: [1546300800000, 20], - }, - style: { - stroke: { - color: { - r: 0, - g: 0, - b: 255, - }, - }, - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 100, - y: 50, - color: 'blue', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec2), - value: { - accessor: 'y1', - x: 1546387200000, - y: 10, - mark: null, - datum: [1546387200000, 10], - }, - style: { - stroke: { - color: { - r: 0, - g: 0, - b: 255, - }, - }, - }, - }), - ); + expect(points).toMatchSnapshot(); expect(geometriesIndex.size).toEqual(points.length); }); }); @@ -746,36 +435,7 @@ describe('Rendering points - line', () => { expect(points.length).toBe(3); // will keep the 3rd point as an indexedGeometry expect(geometriesIndex.size).toEqual(3); - expect(points[0]).toEqual( - MockPointGeometry.default({ - x: 0, - y: 99.5, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 0, - y: 0, - mark: null, - datum: [0, 0], - }, - }), - ); - expect(points[1]).toEqual( - MockPointGeometry.default({ - x: 50, - y: 0, - color: 'red', - seriesIdentifier: MockSeriesIdentifier.fromSpec(pointSeriesSpec), - value: { - accessor: 'y1', - x: 1, - y: 1, - mark: null, - datum: [1, 1], - }, - }), - ); + expect(points).toMatchSnapshot(); }); }); });