mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
fix: Timeseries annotation layers (#34709)
This commit is contained in:
committed by
GitHub
parent
3a007f6284
commit
fc95c4fc89
@@ -17,7 +17,6 @@
|
||||
* under the License.
|
||||
*/
|
||||
import {
|
||||
AnnotationData,
|
||||
AnnotationLayer,
|
||||
AnnotationOpacity,
|
||||
AnnotationSourceType,
|
||||
@@ -128,21 +127,7 @@ describe('extractAnnotationLabels', () => {
|
||||
showLabel: true,
|
||||
},
|
||||
];
|
||||
const results: AnnotationData = {
|
||||
'My Interval': {
|
||||
records: [{ col: 1 }],
|
||||
},
|
||||
'My Line': [
|
||||
{ key: 'Line 1', values: [] },
|
||||
{ key: 'Line 2', values: [] },
|
||||
],
|
||||
};
|
||||
|
||||
expect(extractAnnotationLabels(layers, results)).toEqual([
|
||||
'My Formula',
|
||||
'Line 1',
|
||||
'Line 2',
|
||||
]);
|
||||
expect(extractAnnotationLabels(layers)).toEqual(['My Formula', 'My Line']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -282,30 +282,13 @@ const mockTimeseriesAnnotationLayer: TimeseriesAnnotationLayer = {
|
||||
};
|
||||
|
||||
const mockTimeseriesAnnotationData: AnnotationData = {
|
||||
'Timeseries annotation layer': [
|
||||
{
|
||||
key: 'Key 1',
|
||||
values: [
|
||||
{
|
||||
x: 10,
|
||||
y: 12,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'Key 2',
|
||||
values: [
|
||||
{
|
||||
x: 12,
|
||||
y: 15,
|
||||
},
|
||||
{
|
||||
x: 15,
|
||||
y: 20,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
'Timeseries annotation layer': {
|
||||
records: [
|
||||
{ x: 10, y: 12 },
|
||||
{ x: 12, y: 15 },
|
||||
{ x: 15, y: 20 },
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
describe('transformTimeseriesAnnotation', () => {
|
||||
@@ -319,8 +302,8 @@ describe('transformTimeseriesAnnotation', () => {
|
||||
CategoricalColorNamespace.getScale(''),
|
||||
).map(annotation => annotation.data),
|
||||
).toEqual([
|
||||
[[10, 12]],
|
||||
[
|
||||
[10, 12],
|
||||
[12, 15],
|
||||
[15, 20],
|
||||
],
|
||||
@@ -339,8 +322,8 @@ describe('transformTimeseriesAnnotation', () => {
|
||||
OrientationType.Horizontal,
|
||||
).map(annotation => annotation.data),
|
||||
).toEqual([
|
||||
[[12, 10]],
|
||||
[
|
||||
[12, 10],
|
||||
[15, 12],
|
||||
[20, 15],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user