Open augnustin opened 2 years ago
Hi,
Apologies for the late response and thanks for reporting!
You actually have access to the chart container and you can manipulate this DOM element easily, adding the id to it.
Here's a code snippet:
<script>
// ...
const chartRef = ref(null);
function setIdContainer() {
const chart = chartRef.value.chart;
chart.container.setAttribute('id', 'abc');
chart.container.parentNode.setAttribute('id', 'parent-node');
}
</script>
<template>
<highcharts :options="chartOptions" ref="chartRef" />
</template>
Here's a simple demo: https://jsfiddle.net/1hkrpcby/
My Vue App has hot module reloading.
And I have a custom behavior on
load
event:But this method gets called on every component reload, hence it stores references to charts that are removed.
So I would like to being able to set a chart
id
. From multiple searches, it seems like the solution is to look at therenderTo
div
's ID. (It's a shame this doesn't belong to the Highcharts API itself but whatever).So I would like to add an extra
id
prop that would call:And would render:
Would this make sense? Would you be willing to merge that kind of request?
Cheers