diff --git a/src/components/side_panel/chart/index.ts b/src/components/side_panel/chart/index.ts index 35c31e4bde..7e262a1720 100644 --- a/src/components/side_panel/chart/index.ts +++ b/src/components/side_panel/chart/index.ts @@ -22,7 +22,6 @@ import { ScorecardChartDesignPanel } from "./scorecard_chart_panel/scorecard_cha import { SunburstChartDesignPanel } from "./sunburst_chart/sunburst_chart_design_panel"; import { TreeMapChartDesignPanel } from "./treemap_chart/treemap_chart_design_panel"; import { WaterfallChartDesignPanel } from "./waterfall_chart/waterfall_chart_design_panel"; -import { GenericZoomableChartDesignPanel } from "./zoomable_chart/design_panel"; export { BarConfigPanel } from "./bar_chart/bar_chart_config_panel"; export { GenericChartConfigPanel } from "./building_blocks/generic_side_panel/config_panel"; @@ -47,7 +46,7 @@ chartSidePanelComponentRegistry }) .add("scatter", { configuration: ScatterConfigPanel, - design: GenericZoomableChartDesignPanel, + design: ChartWithAxisDesignPanel, }) .add("bar", { configuration: BarConfigPanel, diff --git a/src/helpers/figures/charts/scatter_chart.ts b/src/helpers/figures/charts/scatter_chart.ts index 2eea428c41..0a491a3059 100644 --- a/src/helpers/figures/charts/scatter_chart.ts +++ b/src/helpers/figures/charts/scatter_chart.ts @@ -63,7 +63,6 @@ export class ScatterChart extends AbstractChart { readonly dataSetDesign?: DatasetDesign[]; readonly axesDesign?: AxesDesign; readonly showValues?: boolean; - readonly zoomable?: boolean; constructor(definition: ScatterChartDefinition, sheetId: UID, getters: CoreGetters) { super(definition, sheetId, getters); @@ -82,7 +81,6 @@ export class ScatterChart extends AbstractChart { this.dataSetDesign = definition.dataSets; this.axesDesign = definition.axesDesign; this.showValues = definition.showValues; - this.zoomable = definition.zoomable; } static validateChartDefinition( @@ -113,7 +111,6 @@ export class ScatterChart extends AbstractChart { aggregated: context.aggregated ?? false, axesDesign: context.axesDesign, showValues: context.showValues, - zoomable: context.zoomable, humanize: context.humanize, }; } @@ -148,7 +145,6 @@ export class ScatterChart extends AbstractChart { aggregated: this.aggregated, axesDesign: this.axesDesign, showValues: this.showValues, - zoomable: this.zoomable, humanize: this.humanize, }; } diff --git a/src/types/chart/scatter_chart.ts b/src/types/chart/scatter_chart.ts index 6b508e901d..6d76d5fcf7 100644 --- a/src/types/chart/scatter_chart.ts +++ b/src/types/chart/scatter_chart.ts @@ -1,7 +1,7 @@ import { LineChartDefinition, LineChartRuntime } from "./line_chart"; export interface ScatterChartDefinition - extends Omit { + extends Omit { readonly type: "scatter"; } diff --git a/tests/figures/chart/scatter_chart_plugin.test.ts b/tests/figures/chart/scatter_chart_plugin.test.ts new file mode 100644 index 0000000000..99f91313c3 --- /dev/null +++ b/tests/figures/chart/scatter_chart_plugin.test.ts @@ -0,0 +1,27 @@ +import { ChartCreationContext } from "../../../src"; +import { ScatterChart } from "../../../src/helpers/figures/charts/scatter_chart"; +import { GENERAL_CHART_CREATION_CONTEXT } from "../../test_helpers/chart_helpers"; + +describe("scatter chart", () => { + test("create scatter chart from creation context", () => { + const context: Required = { + ...GENERAL_CHART_CREATION_CONTEXT, + range: [{ dataRange: "Sheet1!B1:B4", yAxisId: "y1" }], + }; + const definition = ScatterChart.getDefinitionFromContextCreation(context); + expect(definition).toEqual({ + aggregated: true, + type: "scatter", + background: "#123456", + title: { text: "hello there" }, + dataSets: [{ dataRange: "Sheet1!B1:B4", yAxisId: "y1" }], + labelRange: "Sheet1!A1:A4", + legendPosition: "bottom", + dataSetsHaveTitle: true, + labelsAsText: true, + axesDesign: {}, + showValues: false, + humanize: false, + }); + }); +});