I'm new to HTML, Angular 2, and JavaScript so I'm not sure if this is possible. I'm using ng2-charts (which is derived from Chart.js) to create a linechart. Here's a snippet of my HTML:
<div class="col-md-6">
<base-chart id="rLineChart" class="chart"
[datasets]="rChartData"
[labels]="rChartLabels"
[colors]="rChartColours"
[legend]="rChartLegend"
[chartType]="rChartType"
(chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)">
</base-chart>
</div>
As you can see, I've given the base-chart object the id "rLineChart". I want to get this chart object in an accompanying JavaScript file. I've tried using
var myChart = document.getElementById("rLineChart");
but that returns an HTMLElement, not the actual chart. Does anyone know how to go about retrieving the actual object? My ultimate goal is to retrieve the x y values of my chart (since ng2-charts doesn't seem to have a straightforward way of doing that). I've seen a function called getPointsAtEvent which seems like it may return point data, but I need the chart object in order to use it.