TimeSeries: Fix y-axis Yes/No and On/Off boolean units (#61207)

This commit is contained in:
Leon Sorokin
2023-01-09 23:04:50 -07:00
committed by GitHub
parent da18c89e91
commit a1609230f8
3 changed files with 664 additions and 227 deletions
File diff suppressed because it is too large Load Diff
@@ -73,7 +73,7 @@ export function getDisplayProcessor(options?: DisplayProcessorOptions): DisplayP
}
const hasCurrencyUnit = unit?.startsWith('currency');
const hasBoolUnit = unit === 'bool';
const hasBoolUnit = isBooleanUnit(unit);
const isNumType = field.type === FieldType.number;
const isLocaleFormat = unit === 'locale';
const canTrimTrailingDecimalZeros =
@@ -130,6 +130,7 @@ export class UPlotAxisBuilder extends PlotConfigBuilder<AxisProps, Axis> {
const gridColor = theme.isDark ? 'rgba(240, 250, 255, 0.09)' : 'rgba(0, 10, 23, 0.09)';
// TODO: this is pretty flimsy now that scaleKey is composed from multiple parts :/
if (isBooleanUnit(scaleKey)) {
splits = [0, 1];
}