mirror of https://github.com/apache/superset.git
Add annotation information to ChartMetadata (#6136)
* add annotations information to ChartMetadata * rename fields
This commit is contained in:
parent
d662e36442
commit
9d01af201e
|
@ -2,10 +2,15 @@ import ChartPlugin from '../core/models/ChartPlugin';
|
|||
import ChartMetadata from '../core/models/ChartMetadata';
|
||||
import transformProps from './transformProps';
|
||||
import thumbnail from './images/thumbnail.png';
|
||||
import { ANNOTATION_TYPES } from '../../modules/AnnotationTypes';
|
||||
|
||||
const metadata = new ChartMetadata({
|
||||
name: 'Table',
|
||||
description: '',
|
||||
canBeAnnotationTypes: [
|
||||
ANNOTATION_TYPES.EVENT,
|
||||
ANNOTATION_TYPES.INTERVAL,
|
||||
],
|
||||
thumbnail,
|
||||
});
|
||||
|
||||
|
|
|
@ -2,14 +2,26 @@ export default class ChartMetadata {
|
|||
constructor({
|
||||
name,
|
||||
credits = [],
|
||||
description,
|
||||
thumbnail,
|
||||
description = '',
|
||||
show = true,
|
||||
canBeAnnotationTypes = [],
|
||||
supportedAnnotationTypes = [],
|
||||
thumbnail,
|
||||
}) {
|
||||
this.name = name;
|
||||
this.credits = credits;
|
||||
this.description = description;
|
||||
this.thumbnail = thumbnail;
|
||||
this.show = show;
|
||||
this.canBeAnnotationTypesLookup = canBeAnnotationTypes.reduce((prev, type) => {
|
||||
const lookup = prev;
|
||||
lookup[type] = true;
|
||||
return lookup;
|
||||
}, {});
|
||||
this.supportedAnnotationTypes = supportedAnnotationTypes;
|
||||
this.thumbnail = thumbnail;
|
||||
}
|
||||
|
||||
canBeAnnotationType(type) {
|
||||
return this.canBeAnnotationTypesLookup[type] || false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,16 @@ import ChartPlugin from '../../core/models/ChartPlugin';
|
|||
import ChartMetadata from '../../core/models/ChartMetadata';
|
||||
import transformProps from '../transformProps';
|
||||
import thumbnail from './images/thumbnail.png';
|
||||
import { ANNOTATION_TYPES } from '../../../modules/AnnotationTypes';
|
||||
|
||||
const metadata = new ChartMetadata({
|
||||
name: 'Area Chart',
|
||||
description: '',
|
||||
credits: ['http://nvd3.org'],
|
||||
supportedAnnotationTypes: [
|
||||
ANNOTATION_TYPES.INTERVAL,
|
||||
ANNOTATION_TYPES.EVENT,
|
||||
],
|
||||
thumbnail,
|
||||
});
|
||||
|
||||
|
|
|
@ -2,11 +2,16 @@ import ChartPlugin from '../../core/models/ChartPlugin';
|
|||
import ChartMetadata from '../../core/models/ChartMetadata';
|
||||
import transformProps from '../transformProps';
|
||||
import thumbnail from './images/thumbnail.png';
|
||||
import { ANNOTATION_TYPES } from '../../../modules/AnnotationTypes';
|
||||
|
||||
const metadata = new ChartMetadata({
|
||||
name: 'Time-series Bar Chart',
|
||||
description: 'A bar chart where the x axis is time',
|
||||
credits: ['http://nvd3.org'],
|
||||
supportedAnnotationTypes: [
|
||||
ANNOTATION_TYPES.INTERVAL,
|
||||
ANNOTATION_TYPES.EVENT,
|
||||
],
|
||||
thumbnail,
|
||||
});
|
||||
|
||||
|
|
|
@ -2,11 +2,21 @@ import ChartPlugin from '../../core/models/ChartPlugin';
|
|||
import ChartMetadata from '../../core/models/ChartMetadata';
|
||||
import transformProps from '../transformProps';
|
||||
import thumbnail from './images/thumbnail.png';
|
||||
import { ANNOTATION_TYPES } from '../../../modules/AnnotationTypes';
|
||||
|
||||
const metadata = new ChartMetadata({
|
||||
name: 'Line Chart',
|
||||
description: '',
|
||||
credits: ['http://nvd3.org'],
|
||||
canBeAnnotationTypes: [
|
||||
ANNOTATION_TYPES.TIME_SERIES,
|
||||
],
|
||||
supportedAnnotationTypes: [
|
||||
ANNOTATION_TYPES.TIME_SERIES,
|
||||
ANNOTATION_TYPES.INTERVAL,
|
||||
ANNOTATION_TYPES.EVENT,
|
||||
ANNOTATION_TYPES.FORMULA,
|
||||
],
|
||||
thumbnail,
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue