Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
format
  • Loading branch information
mindspank committed Dec 11, 2025
commit 24ce0c1801d44241ae127fa51ec8d3d0deb89b1c
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,25 @@ export class DotPlotChartComponent extends BaseChart<DotPlotCanvasChartSpec> {
(d) => d.type === MetricsViewSpecDimensionType.DIMENSION_TYPE_CATEGORICAL,
);

const randomMeasure = measures.length > 0
? measures[Math.floor(Math.random() * measures.length)]?.name
: undefined;
const randomMeasure =
measures.length > 0
? measures[Math.floor(Math.random() * measures.length)]?.name
: undefined;

const randomYDimension = dimensions.length > 0
? dimensions[Math.floor(Math.random() * dimensions.length)]?.name
: undefined;
const randomYDimension =
dimensions.length > 0
? dimensions[Math.floor(Math.random() * dimensions.length)]?.name
: undefined;

const remainingDimensions = dimensions.filter(
(d) => d.name !== randomYDimension,
);
const randomDetailDimension = remainingDimensions.length > 0
? remainingDimensions[Math.floor(Math.random() * remainingDimensions.length)]?.name
: undefined;
const randomDetailDimension =
remainingDimensions.length > 0
? remainingDimensions[
Math.floor(Math.random() * remainingDimensions.length)
]?.name
: undefined;

return {
metrics_view: metricsViewName,
Expand Down Expand Up @@ -178,4 +183,3 @@ export class DotPlotChartComponent extends BaseChart<DotPlotCanvasChartSpec> {
return this.provider.getChartDomainValues();
}
}

12 changes: 10 additions & 2 deletions web-common/src/features/canvas/components/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,17 @@ export function createComponent(
const ComponentClass =
COMPONENT_CLASS_MAP[type as keyof typeof COMPONENT_CLASS_MAP];
if (ComponentClass) {
return new ComponentClass(resource, parent, path) as BaseCanvasComponent<ComponentSpec>;
return new ComponentClass(
resource,
parent,
path,
) as BaseCanvasComponent<ComponentSpec>;
}
return new CartesianChartComponent(resource, parent, path) as BaseCanvasComponent<ComponentSpec>;
return new CartesianChartComponent(
resource,
parent,
path,
) as BaseCanvasComponent<ComponentSpec>;
}

export function isCanvasComponentType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,4 +329,3 @@ export class DotPlotChartProvider {
}
}
}

5 changes: 3 additions & 2 deletions web-common/src/features/components/charts/dot-plot/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export function generateVLDotPlotSpec(
data: ChartDataResult,
): VisualizationSpec {
if (!config.y?.field || !config.x?.field) {
throw new Error("Dot plot requires both y (dimension) and x (measure) fields");
throw new Error(
"Dot plot requires both y (dimension) and x (measure) fields",
);
}

const spec = createMultiLayerBaseSpec();
Expand Down Expand Up @@ -227,4 +229,3 @@ export function generateVLDotPlotSpec(

return spec;
}

Loading