File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
src/components/containers Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -4,24 +4,33 @@ import {PanelMessage} from './PanelEmpty';
44import PropTypes from 'prop-types' ;
55import React , { Component } from 'react' ;
66import { connectAnnotationToLayout } from 'lib' ;
7+ import { templateString } from 'plotly.js/src/lib' ;
78
89const AnnotationFold = connectAnnotationToLayout ( PlotlyFold ) ;
910
1011class AnnotationAccordion extends Component {
1112 render ( ) {
1213 const {
13- layout : { annotations = [ ] } ,
14+ layout : { annotations = [ ] , meta = [ ] } ,
1415 localize : _ ,
1516 } = this . context ;
1617 const { canAdd, children} = this . props ;
1718
1819 const content =
1920 annotations . length &&
20- annotations . map ( ( ann , i ) => (
21- < AnnotationFold key = { i } annotationIndex = { i } name = { ann . text } canDelete = { canAdd } >
22- { children }
23- </ AnnotationFold >
24- ) ) ;
21+ annotations . map ( ( ann , i ) => {
22+ const textPostTemplate = templateString ( ann . text , { meta} ) ;
23+ return (
24+ < AnnotationFold
25+ key = { i }
26+ annotationIndex = { i }
27+ name = { textPostTemplate === '' ? ann . text : textPostTemplate }
28+ canDelete = { canAdd }
29+ >
30+ { children }
31+ </ AnnotationFold >
32+ ) ;
33+ } ) ;
2534
2635 const addAction = {
2736 label : _ ( 'Annotation' ) ,
You can’t perform that action at this time.
0 commit comments