TimeSeries: Add support for negative Y and constant transform (#44774)

* add negative y config

* Handle negative y and constant transform in Timeseries panel

* Typechecks

* Add migration from old graph panel

* Docs update

* Revert "Add migration from old graph panel"

This reverts commit 33b5a90b66.

* Revert VizLegendItem changes

* Automatically separate positive and negative stacks within a group

* Update packages/grafana-ui/src/components/VizLegend/VizLegend.story.tsx

* Remove SeriesLabel component

* Update docs/sources/visualizations/time-series/_index.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Update docs/sources/visualizations/time-series/_index.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

* Leftover reverts

* Don't crate bands (for now0 for negative -y stack

* Add docs note about transform being only available as an override

* Fill negative bands in reversed direction

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Dominik Prokop
2022-02-08 07:27:02 -08:00
committed by GitHub
parent ea236c276e
commit ffea53f2f6
12 changed files with 204 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ import {
VisibilityMode,
StackingMode,
GraphTresholdsStyleMode,
GraphTransform,
} from '@grafana/schema';
import { graphFieldOptions, commonOptionsBuilder } from '@grafana/ui';
@@ -181,6 +182,29 @@ export function getGraphFieldConfig(cfg: GraphFieldConfig): SetFieldConfigOption
});
commonOptionsBuilder.addStackingConfig(builder, cfg.stacking, categoryStyles);
builder.addSelect({
category: categoryStyles,
name: 'Transform',
path: 'transform',
settings: {
options: [
{
label: 'Constant',
value: GraphTransform.Constant,
description: 'The first value will be shown as a constant line',
},
{
label: 'Negative Y',
value: GraphTransform.NegativeY,
description: 'Flip the results to negative values on the y axis',
},
],
isClearable: true,
},
hideFromDefaults: true,
});
commonOptionsBuilder.addAxisConfig(builder, cfg);
commonOptionsBuilder.addHideFrom(builder);