mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TimeSeries: don't auto-disable fill of fillBelowTo targets (#43165)
This commit is contained in:
parent
1a762083d7
commit
8fdbc6cc20
@ -1991,7 +1991,7 @@
|
|||||||
"axisLabel": "",
|
"axisLabel": "",
|
||||||
"axisPlacement": "auto",
|
"axisPlacement": "auto",
|
||||||
"drawStyle": "line",
|
"drawStyle": "line",
|
||||||
"fillOpacity": 29,
|
"fillOpacity": 0,
|
||||||
"gradientMode": {
|
"gradientMode": {
|
||||||
"label": "None",
|
"label": "None",
|
||||||
"value": "none"
|
"value": "none"
|
||||||
|
@ -1346,7 +1346,7 @@
|
|||||||
"axisPlacement": "auto",
|
"axisPlacement": "auto",
|
||||||
"drawStyle": "line",
|
"drawStyle": "line",
|
||||||
"fillGradient": "hue",
|
"fillGradient": "hue",
|
||||||
"fillOpacity": 25,
|
"fillOpacity": 0,
|
||||||
"hideFrom": {
|
"hideFrom": {
|
||||||
"graph": false,
|
"graph": false,
|
||||||
"legend": false,
|
"legend": false,
|
||||||
|
@ -307,7 +307,6 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<{ sync: DashboardCursor
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stackingGroups.size !== 0) {
|
if (stackingGroups.size !== 0) {
|
||||||
builder.setStacking(true);
|
|
||||||
for (const [_, seriesIds] of stackingGroups.entries()) {
|
for (const [_, seriesIds] of stackingGroups.entries()) {
|
||||||
const seriesIdxs = orderIdsByCalcs({ ids: seriesIds, legend, frame });
|
const seriesIdxs = orderIdsByCalcs({ ids: seriesIds, legend, frame });
|
||||||
for (let j = seriesIdxs.length - 1; j > 0; j--) {
|
for (let j = seriesIdxs.length - 1; j > 0; j--) {
|
||||||
|
@ -548,7 +548,6 @@ describe('UPlotConfigBuilder', () => {
|
|||||||
describe('Stacking', () => {
|
describe('Stacking', () => {
|
||||||
it('allows stacking config', () => {
|
it('allows stacking config', () => {
|
||||||
const builder = new UPlotConfigBuilder();
|
const builder = new UPlotConfigBuilder();
|
||||||
builder.setStacking();
|
|
||||||
builder.addSeries({
|
builder.addSeries({
|
||||||
drawStyle: GraphDrawStyle.Line,
|
drawStyle: GraphDrawStyle.Line,
|
||||||
scaleKey: 'scale-x',
|
scaleKey: 'scale-x',
|
||||||
|
@ -40,7 +40,6 @@ export class UPlotConfigBuilder {
|
|||||||
private scales: UPlotScaleBuilder[] = [];
|
private scales: UPlotScaleBuilder[] = [];
|
||||||
private bands: Band[] = [];
|
private bands: Band[] = [];
|
||||||
private cursor: Cursor | undefined;
|
private cursor: Cursor | undefined;
|
||||||
private isStacking = false;
|
|
||||||
private select: uPlot.Select | undefined;
|
private select: uPlot.Select | undefined;
|
||||||
private hasLeftAxis = false;
|
private hasLeftAxis = false;
|
||||||
private hooks: Hooks.Arrays = {};
|
private hooks: Hooks.Arrays = {};
|
||||||
@ -122,10 +121,6 @@ export class UPlotConfigBuilder {
|
|||||||
this.select = select;
|
this.select = select;
|
||||||
}
|
}
|
||||||
|
|
||||||
setStacking(enabled = true) {
|
|
||||||
this.isStacking = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
addSeries(props: SeriesProps) {
|
addSeries(props: SeriesProps) {
|
||||||
this.series.push(new UPlotSeriesBuilder(props));
|
this.series.push(new UPlotSeriesBuilder(props));
|
||||||
}
|
}
|
||||||
@ -224,24 +219,8 @@ export class UPlotConfigBuilder {
|
|||||||
config.tzDate = this.tzDate;
|
config.tzDate = this.tzDate;
|
||||||
config.padding = this.padding;
|
config.padding = this.padding;
|
||||||
|
|
||||||
if (this.isStacking) {
|
if (this.bands.length) {
|
||||||
// Let uPlot handle bands and fills
|
|
||||||
config.bands = this.bands;
|
config.bands = this.bands;
|
||||||
} else {
|
|
||||||
// When fillBelowTo option enabled, handle series bands fill manually
|
|
||||||
if (this.bands?.length) {
|
|
||||||
config.bands = this.bands;
|
|
||||||
const killFill = new Set<number>();
|
|
||||||
for (const b of config.bands) {
|
|
||||||
killFill.add(b.series[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 1; i < config.series.length; i++) {
|
|
||||||
if (killFill.has(i)) {
|
|
||||||
config.series[i].fill = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
@ -213,7 +213,6 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn<BarChartOptions> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stackingGroups.size !== 0) {
|
if (stackingGroups.size !== 0) {
|
||||||
builder.setStacking(true);
|
|
||||||
for (const [_, seriesIds] of stackingGroups.entries()) {
|
for (const [_, seriesIds] of stackingGroups.entries()) {
|
||||||
const seriesIdxs = orderIdsByCalcs({ ids: seriesIds, legend, frame });
|
const seriesIdxs = orderIdsByCalcs({ ids: seriesIds, legend, frame });
|
||||||
for (let j = seriesIdxs.length - 1; j > 0; j--) {
|
for (let j = seriesIdxs.length - 1; j > 0; j--) {
|
||||||
|
Loading…
Reference in New Issue
Block a user