Skip to content

Commit

Permalink
fix aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
matewilk committed Apr 25, 2024
1 parent f896f45 commit d09b8fc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions visualizations/store-map-viz/utils/customIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function aggregateStatusCounts(locations: any[]): ClusterStatusCounts {
function generatePieStyle(
clusterStatusBreakdown: ClusterStatusCounts,
totalLocations: number,
customColors: any,
customColors: any
): string {
let pieStyle = `background: ${customColors[Status.CLUSTER].borderColor};`;
const totalStatus =
Expand All @@ -38,10 +38,10 @@ function generatePieStyle(

if (totalStatus > 0) {
const criticalDegree = Math.floor(
(clusterStatusBreakdown.CRITICAL / totalLocations) * 360,
(clusterStatusBreakdown.CRITICAL / totalLocations) * 360
);
const warningDegree = Math.floor(
(clusterStatusBreakdown.WARNING / totalLocations) * 360,
(clusterStatusBreakdown.WARNING / totalLocations) * 360
);

pieStyle = `background: conic-gradient(${
Expand Down Expand Up @@ -83,7 +83,7 @@ function calculateAggregatedLabel(cluster, aggregationMode) {
cluster_label_precision,
} = child.options.children.props.location;

total += value;
total += Number(value);
minValue = Math.min(minValue, value);
maxValue = Math.max(maxValue, value);

Expand Down Expand Up @@ -116,15 +116,15 @@ function calculateAggregatedLabel(cluster, aggregationMode) {
export const createClusterCustomIcon = (
cluster,
customColors,
aggregationMode,
aggregationMode
) => {
const locations = cluster.getAllChildMarkers();
const clusterStatusBreakdown = aggregateStatusCounts(locations);

let pieStyle = generatePieStyle(
clusterStatusBreakdown,
locations.length,
customColors,
customColors
);

let clusterLabel = calculateAggregatedLabel(cluster, aggregationMode);
Expand Down

0 comments on commit d09b8fc

Please sign in to comment.