Skip to content

Commit

Permalink
Merge pull request #3505 from kyoto/query-browser-show-axis-seconds
Browse files Browse the repository at this point in the history
Query Browser: Show seconds on X-axis when timespan is small
  • Loading branch information
openshift-merge-robot committed Nov 24, 2019
2 parents 109032f + dc27f22 commit c71a288
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/public/components/monitoring/query-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ const Graph: React.FC<GraphProps> = React.memo(({ allSeries, disabledSeries, spa
maxY = 0;
}

const tickFormat =
const xTickFormat = span < 5 * 60 * 1000 ? twentyFourHourTimeWithSeconds : twentyFourHourTime;

const yTickFormat =
Math.abs(maxY - minY) < 0.005 ? (v) => (v === 0 ? '0' : v.toExponential(1)) : formatValue;

return (
Expand All @@ -262,8 +264,8 @@ const Graph: React.FC<GraphProps> = React.memo(({ allSeries, disabledSeries, spa
theme={chartTheme}
width={width}
>
<ChartAxis tickCount={5} tickFormat={twentyFourHourTime} />
<ChartAxis crossAxis={false} dependentAxis tickCount={6} tickFormat={tickFormat} />
<ChartAxis tickCount={5} tickFormat={xTickFormat} />
<ChartAxis crossAxis={false} dependentAxis tickCount={6} tickFormat={yTickFormat} />
<ChartGroup>
{_.map(data, (values, i) => (
<ChartLine key={i} data={values} />
Expand Down

0 comments on commit c71a288

Please sign in to comment.