Skip to content

Commit ffb8f4e

Browse files
authored
Transformations: Rename Regression Analysis to Trendline (#108631)
* Rename regression analysis transformation * fix a couple translations * remove extra word * Fix tests * Change frame name to use regression
1 parent 814fccb commit ffb8f4e

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

docs/sources/panels-visualizations/query-transform-data/transform-data/index.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,17 +1483,19 @@ If you have multiple types it will default to string type.
14831483

14841484
{{< figure src="/media/docs/grafana/transformations/screenshot-grafana-11-2-transpose-transformation.png" class="docs-image--no-shadow" max-width= "1100px" alt="Before and after transpose transformation" >}}
14851485

1486-
### Regression analysis
1486+
### Trendline
14871487

14881488
Use this transformation to create a new data frame containing values predicted by a statistical model. This is useful for finding a trend in chaotic data. It works by fitting a mathematical function to the data, using either linear or polynomial regression. The data frame can then be used in a visualization to display a trendline.
14891489

14901490
There are two different models:
14911491

1492-
- **Linear regression** - Fits a linear function to the data.
1492+
- **Linear** - Fits a linear function to the data.
14931493
{{< figure src="/static/img/docs/transformations/linear-regression.png" class="docs-image--no-shadow" max-width= "1100px" alt="A time series visualization with a straight line representing the linear function" >}}
1494-
- **Polynomial regression** - Fits a polynomial function to the data.
1494+
- **Polynomial** - Fits a polynomial function to the data.
14951495
{{< figure src="/static/img/docs/transformations/polynomial-regression.png" class="docs-image--no-shadow" max-width= "1100px" alt="A time series visualization with a curved line representing the polynomial function" >}}
14961496

1497+
> **Note:** This transformation was previously called regression analysis.
1498+
14971499
[Table panel]: ref:table-panel
14981500
[Calculation types]: ref:calculation-types
14991501
[sparkline cell type]: ref:sparkline-cell-type

public/app/features/transformers/docs/content.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,25 +1584,27 @@ ${buildImageContent(
15841584
},
15851585
},
15861586
regression: {
1587-
name: 'Regression analysis',
1587+
name: 'Trendline',
15881588
getHelperDocs: function (imageRenderType: ImageRenderType = ImageRenderType.ShortcodeFigure) {
15891589
return `
15901590
Use this transformation to create a new data frame containing values predicted by a statistical model. This is useful for finding a trend in chaotic data. It works by fitting a mathematical function to the data, using either linear or polynomial regression. The data frame can then be used in a visualization to display a trendline.
15911591
15921592
There are two different models:
15931593
1594-
- **Linear regression** - Fits a linear function to the data.
1594+
- **Linear** - Fits a linear function to the data.
15951595
${buildImageContent(
15961596
'/static/img/docs/transformations/linear-regression.png',
15971597
imageRenderType,
15981598
'A time series visualization with a straight line representing the linear function'
15991599
)}
1600-
- **Polynomial regression** - Fits a polynomial function to the data.
1600+
- **Polynomial** - Fits a polynomial function to the data.
16011601
${buildImageContent(
16021602
'/static/img/docs/transformations/polynomial-regression.png',
16031603
imageRenderType,
16041604
'A time series visualization with a curved line representing the polynomial function'
16051605
)}
1606+
1607+
> **Note:** This transformation was previously called regression analysis.
16061608
`;
16071609
},
16081610
},

public/app/features/transformers/regression/regression.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
import { ModelType, getRegressionTransformer, RegressionTransformerOptions } from './regression';
1212

13-
describe('Regression transformation', () => {
13+
describe('Trendline transformation', () => {
1414
const RegressionTransformer = getRegressionTransformer();
1515

1616
it('it should predict a linear regression to exactly fit the data when the data is f(x) = x', () => {
@@ -47,7 +47,7 @@ describe('Regression transformation', () => {
4747
name: 'Linear regression',
4848
fields: [
4949
{ name: 'time', type: FieldType.time, values: [0, 1, 2, 3, 4, 5], config: {} },
50-
{ name: 'value predicted', type: FieldType.number, values: [0, 1, 2, 3, 4, 5], config: {} },
50+
{ name: 'value', type: FieldType.number, values: [0, 1, 2, 3, 4, 5], config: {} },
5151
],
5252
length: 6,
5353
}),
@@ -88,7 +88,7 @@ describe('Regression transformation', () => {
8888
name: 'Linear regression',
8989
fields: [
9090
{ name: 'time', type: FieldType.time, values: [0, 1, 2, 3, 4, 5], config: {} },
91-
{ name: 'value predicted', type: FieldType.number, values: [1, 1, 1, 1, 1, 1], config: {} },
91+
{ name: 'value', type: FieldType.number, values: [1, 1, 1, 1, 1, 1], config: {} },
9292
],
9393
length: 6,
9494
}),

public/app/features/transformers/regression/regression.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const DEGREES = [
3737

3838
export const getRegressionTransformer: () => SynchronousDataTransformerInfo<RegressionTransformerOptions> = () => ({
3939
id: DataTransformerID.regression,
40-
name: t('transformers.regression.name.regression-analysis', 'Regression analysis'),
40+
name: t('transformers.regression.name.trendline', 'Trendline'),
4141
description: t(
4242
'transformers.regression.description.create-new-data-frame',
4343
'Create a new data frame containing values predicted by a statistical model.'
@@ -129,7 +129,7 @@ export const getRegressionTransformer: () => SynchronousDataTransformerInfo<Regr
129129
fields: [
130130
{ name: xField.name, type: xField.type, values: predictionPoints, config: {} },
131131
{
132-
name: `${getFieldDisplayName(yField, predictFromFrame, frames)} predicted`,
132+
name: `${getFieldDisplayName(yField, predictFromFrame, frames)}`,
133133
type: yField.type,
134134
values: predictionPoints.map((x) => result.predict(x - normalizationSubtrahend)),
135135
config: {},

public/app/features/transformers/regression/regressionEditor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,6 @@ export const getRegressionTransformerRegistryItem: () => TransformerRegistryItem
171171
help: getTransformationContent(DataTransformerID.regression).helperDocs,
172172
imageDark: darkImage,
173173
imageLight: lightImage,
174+
tags: new Set([t('transformers.regression-transformer-editor.tags.regression-analysis', 'Regression analysis')]),
174175
};
175176
};

public/locales/en-US/grafana.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13443,7 +13443,7 @@
1344313443
"create-new-data-frame": "Create a new data frame containing values predicted by a statistical model."
1344413444
},
1344513445
"name": {
13446-
"regression-analysis": "Regression analysis"
13446+
"trendline": "Trendline"
1344713447
}
1344813448
},
1344913449
"regression-transformer-editor": {
@@ -13465,6 +13465,9 @@
1346513465
}
1346613466
},
1346713467
"regression": "regression",
13468+
"tags": {
13469+
"regression-analysis": "Regression analysis"
13470+
},
1346813471
"tooltip-number-of-xy-points-to-predict": "Number of X,Y points to predict"
1346913472
},
1347013473
"rename-by-regex-transformer": {

0 commit comments

Comments
 (0)