Skip to content

Commit

Permalink
Fixes bug with stack charts where chart domain is truncated (#2090)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcreasy committed Nov 10, 2023
1 parent 99cda34 commit 6858ebd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import {
import {
convertTimestamp,
createGraphMetricLine,
defaultDomainCalculator,
formatToShow,
getThresholdData,
useStableMetrics,
Expand All @@ -63,7 +62,7 @@ const MetricsChart: React.FC<MetricsChartProps> = ({
color,
metrics: unstableMetrics,
thresholds = [],
domain = defaultDomainCalculator,
domain,
toolbar,
type = MetricsChartTypes.AREA,
isStack = false,
Expand Down Expand Up @@ -189,7 +188,7 @@ const MetricsChart: React.FC<MetricsChartProps> = ({
<Chart
ariaTitle={title}
containerComponent={containerComponent}
domain={domain(maxYValue, minYValue)}
domain={domain ? domain(maxYValue, minYValue) : undefined}
height={400}
width={chartWidth}
padding={{ left: 70, right: 50, bottom: 70, top: 50 }}
Expand Down
5 changes: 0 additions & 5 deletions frontend/src/pages/modelServing/screens/metrics/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { QueryTimeframeStep } from '~/pages/modelServing/screens/const';
import {
BiasSelectOption,
DomainCalculator,
GraphMetricLine,
GraphMetricPoint,
MetricChartLine,
Expand Down Expand Up @@ -170,10 +169,6 @@ export const useStableMetrics = (
return metricsRef.current;
};

export const defaultDomainCalculator: DomainCalculator = (maxYValue) => ({
y: maxYValue === 0 ? [0, 1] : [0, maxYValue],
});

export const getBreadcrumbItemComponents = (breadcrumbItems: BreadcrumbItemType[]) =>
breadcrumbItems.map((item) => (
<BreadcrumbItem
Expand Down

0 comments on commit 6858ebd

Please sign in to comment.