I'm currently utilizing apexcharts within a vue environment. My goal is to have the sparkline graph expand to occupy 100% of its parent's width.
Here is what I attempted:
<div>
<apexchart
:options="chartOptions"
:series="series"
height="150"
style="width: 100%"
/>
</div>
I also experimented with setting the width as a prop of the component, but encountered the same outcome.
Below are my chart options:
chartOptions: {
chart: {
type: 'area',
sparkline: {
enabled: true
}
},
dataLabels: {
enabled: false
},
stroke: {
curve: 'straight',
width: 3,
},
xaxis: {
type: 'datetime',
}
}
No extraordinary configurations here, simply borrowed from apex dashboard example. The only modification made was trying to set the width to 100%.
The issue arises where it extends beyond its parent (green) and even surpasses the parent's container (yellow) as illustrated below:
https://i.sstatic.net/9mf2M.png
Moreover, resizing the window without refreshing leads to the graph shrinking smaller than the parent:
https://i.sstatic.net/buShm.png
How can I ensure that it spans the entire width of its parent (green container) while maintaining responsiveness?
Thank you for your assistance.