mirror of
https://github.com/apache/superset.git
synced 2026-04-18 15:44:57 +00:00
fix: annotation broken (#20651)
* fix: annotation broken * fix UT * add annotation data to mixed timeseries chart
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { isEmpty } from 'lodash';
|
||||
|
||||
import {
|
||||
Annotation,
|
||||
AnnotationData,
|
||||
@@ -30,6 +32,8 @@ import {
|
||||
isTimeseriesAnnotationResult,
|
||||
TimeseriesDataRecord,
|
||||
} from '@superset-ui/core';
|
||||
import { EchartsTimeseriesChartProps } from '../types';
|
||||
import { EchartsMixedTimeseriesProps } from '../MixedTimeseries/types';
|
||||
|
||||
export function evalFormula(
|
||||
formula: FormulaAnnotationLayer,
|
||||
@@ -130,3 +134,13 @@ export function extractAnnotationLabels(
|
||||
|
||||
return formulaAnnotationLabels.concat(timeseriesAnnotationLabels);
|
||||
}
|
||||
|
||||
export function getAnnotationData(
|
||||
chartProps: EchartsTimeseriesChartProps | EchartsMixedTimeseriesProps,
|
||||
): AnnotationData {
|
||||
const data = chartProps?.queriesData[0]?.annotation_data as AnnotationData;
|
||||
if (!isEmpty(data)) {
|
||||
return data;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user