Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1806912: Monitoring Dashboards: Fix X axis tick labels overlapping #4526

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions frontend/public/components/monitoring/dashboards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,14 +349,14 @@ const Card: React.FC<CardProps> = ({ panel }) => {
);
}

const panelSpan: number = getPanelSpan(panel);
// If panel.span is greater than 12, default colSpan to 12
const colSpan: number = panelSpan > 12 ? 12 : panelSpan;
// If colSpan is less than 7, double it for small
const colSpanSm: number = colSpan < 7 ? colSpan * 2 : colSpan;
// Our grid has 12 columns, so don't allow colSpan over 12
const colSpan = Math.min(getPanelSpan(panel), 12);

// Don't allow very narrow panels at intermediate page widths
const colSpanMd = Math.max(colSpan, 3);

return (
<div className={`col-xs-12 col-sm-${colSpanSm} col-lg-${colSpan}`}>
<div className={`col-xs-12 col-md-${colSpanMd} col-lg-${colSpan}`}>
<DashboardCard
className="monitoring-dashboards__panel"
gradient={panel.type === 'grafana-piechart-panel'}
Expand Down
14 changes: 13 additions & 1 deletion frontend/public/components/monitoring/query-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@ const Graph: React.FC<GraphProps> = React.memo(

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

let xAxisStyle;
if (width < 225) {
xAxisStyle = {
tickLabels: {
angle: 45,
fontSize: 10,
textAnchor: 'start',
verticalAnchor: 'middle',
},
};
}

const legendData = formatLegendLabel
? _.flatMap(allSeries, (series, i) =>
_.map(series, (s) => ({ name: formatLegendLabel(s[0], i) })),
Expand All @@ -283,7 +295,7 @@ const Graph: React.FC<GraphProps> = React.memo(
theme={chartTheme}
width={width}
>
<ChartAxis tickCount={5} tickFormat={xTickFormat} />
<ChartAxis style={xAxisStyle} tickCount={5} tickFormat={xTickFormat} />
<ChartAxis crossAxis={false} dependentAxis tickCount={6} tickFormat={yTickFormat} />
{isStack ? (
<ChartStack>
Expand Down