Я хочу создать компонент, который показывает некоторые измерения и добавить аннотацию в виде значков.Я использую Angular с ng2-google-charts для диаграммы.Есть пример на https://developers.google.com/chart/interactive/docs/customizing_tooltip_content#annotating-data для роли столбца annontationText, я хочу сделать то же самое с аннотацией.
Но я не могу переключить аннотацию на html.Но способ, которым пример с annontationText также не будет работать для меня.Я не знаю, является ли это ошибкой из-за углового компонента или если я что-то наблюдал.
import {Component, Input, OnInit} from '@angular/core';
@Component({
selector: 'app-measurement',
templateUrl: './measurement.component.html',
styleUrls: ['./measurement.component.css']
})
export class MeasurementComponent implements OnInit {
plot;
constructor() {}
ngOnInit() {
this.createPlot('Test');
}
createPlot(title) {
this.plot = {
chartType: 'LineChart',
options:
{
title: title,
height: '600px',
curveType: 'function',
hAxis: {title: 'x'},
vAxis: { title: 'y' }
},
dataTable: [
[ { 'id': 'x', 'label': 'x','type': 'number' },
{ 'id': 'y', 'label': 'y','type': 'number' },
{'id': 'icon', 'label': 'icon', 'type': 'string', 'role': 'annotation', p: {html: true}} ],
[0.0005, 1434,null],
[0.001, 1436,null],
[0.0015, 1435, '<img src="./assets/img/icon1.svg">'],
[0.002, 1429, '<img src="./assets/img/ic_bench.svg">'],
[0.0025, 1439, null]
[0.003, 1451, null],
]
};
}
}
Но это не будет отображать изображение, а только текст HTML.