Hi Syncfusion, I am trying to add my own html code to the 'content' property of the annotation used in LinearGaugeComponent. However, the annotation doesn't seem to render properly (I don't see item.date being display). My code is as shown below. Your help is really appreciated. Thank you.
const content = '<div class="horizontal-timeline-annotation">' + item.date + '</div>';
<AnnotationDirective
content={content}
axisIndex={0}
axisValue={item.interval_value}
x={9}
zIndex="1"
y={5}
key={'cdl' + index}
/>
My package version:
"@syncfusion/ej2-base": "^19.2.55",
"@syncfusion/ej2-data": "^19.2.55",
"@syncfusion/ej2-react-buttons": "^19.2.55",
"@syncfusion/ej2-react-charts": "^19.2.55",
"@syncfusion/ej2-react-circulargauge": "^19.2.55",
"@syncfusion/ej2-react-dropdowns": "^19.2.55",
"@syncfusion/ej2-react-grids": "^19.2.55",
"@syncfusion/ej2-react-inputs": "^19.2.55",
"@syncfusion/ej2-react-layouts": "19.2.55",
"@syncfusion/ej2-react-lineargauge": "^19.2.55",
"@syncfusion/ej2-react-lists": "^19.2.55",
"@syncfusion/ej2-react-popups": "^19.2.55",
"@syncfusion/ej2-react-progressbar": "^19.2.55",
"@syncfusion/ej2-react-richtexteditor": "^19.2.59",
"@syncfusion/ej2-react-navigations": "^19.3.45",
"@syncfusion/ej2-react-splitbuttons": "^19.2.55",
|
var pointerArrayValues = [0, 20, 40, 50, 80];
var pointerValue =
pointerArrayValues[Math.floor(Math.random() * pointerArrayValues.length)];
annotationTemplate() {
return <div class="horizontal-timeline-annotation"> {pointerValue} </div>;
}
template = this.annotationTemplate;
render() { <LinearGaugeComponent> <Inject services={[Annotations]} />
<AnnotationsDirective>
<AnnotationDirective
content={this.template}
axisIndex={0}
axisValue={pointerValue}
x={-5}
zIndex="1"
y={2}
></AnnotationDirective>
</AnnotationsDirective>
</LinearGaugeComponent> }); |
Hi,
I have tried your solution but now I am getting an error:
Case.tsx:62 Uncaught (in promise) Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
I am writing a react functional component, not in class form.
Thank you