mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
This commit is contained in:
parent
4016572ba5
commit
2d5fe0c123
1 changed files with 9 additions and 1 deletions
|
@ -111,6 +111,10 @@ const createItemsFormatter = (
|
|||
});
|
||||
};
|
||||
|
||||
const seriesHasLessThen2DataPoints = (series: InfraDataSeries): boolean => {
|
||||
return series.data.length < 2;
|
||||
};
|
||||
|
||||
export class ChartSection extends React.PureComponent<Props> {
|
||||
public render() {
|
||||
const { crosshairValue, section, metric, onCrosshairUpdate } = this.props;
|
||||
|
@ -137,6 +141,10 @@ export class ChartSection extends React.PureComponent<Props> {
|
|||
if (!metric) {
|
||||
chartProps.statusText = 'Missing data';
|
||||
}
|
||||
if (metric.series.some(seriesHasLessThen2DataPoints)) {
|
||||
chartProps.statusText =
|
||||
'Not enough data points to render chart, try increasing the time range.';
|
||||
}
|
||||
const formatter = get(visConfig, 'formatter', InfraFormatterType.number);
|
||||
const formatterTemplate = get(visConfig, 'formatterTemplate', '{{value}}');
|
||||
const formatterFunction = getFormatter(formatter, formatterTemplate);
|
||||
|
@ -164,7 +172,7 @@ export class ChartSection extends React.PureComponent<Props> {
|
|||
/>
|
||||
{metric &&
|
||||
metric.series.map(series => {
|
||||
if (!series) {
|
||||
if (!series || series.data.length < 2) {
|
||||
return null;
|
||||
}
|
||||
const data = series.data.map(d => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue