调整窗口大大后,仅加载数据
我正在使用代码上的ApexChart显示带有一些数据的图表,但是当页面加载时,我的数据不会显示,仅显示我缩放/缩小/缩小或调整窗口大小时,我发现有点奇怪。 我在Apexcharts github上找到了类似的问题,但是自2019年以来一直开放,并且并非真正活跃,所以我在这里问,也许有人有相同的问题并找到了某种方法来解决它。
这是我的ApexChart:
<v-col cols="12">
<apexchart
type="line"
height="350"
:options="chartOptions"
:series="series"
></apexchart>
</v-col>
这是我的ChartOptions:
chartOptions: {
chart: {
height: 350,
type: "line",
zoom: {
enabled: false,
},
toolbar: {
show: false,
},
},
legend: {
labels: {
colors: "#FFFFFF",
},
},
dataLabels: {
enabled: false,
},
stroke: {
curve: "straight",
},
title: {
align: "left",
},
grid: {
row: {
colors: ["#f3f3f3", "transparent"], // takes an array which will be repeated on columns
opacity: 0.5,
},
},
xaxis: {
type: "datetime",
categories: [],
labels: {
datetimeUTC: false,
style: {
colors: "#FFFFFF",
},
},
},
yaxis: [
{
title: {
text: "Energie",
style: {
color: "#FFFFFF",
},
},
labels: {
style: {
colors: "#FFFFFF",
},
},
decimalsInFloat: 1,
},
{
opposite: true,
title: {
text: "Puissance",
style: {
color: "#FFFFFF",
},
},
labels: {
style: {
colors: "#FFFFFF",
},
},
decimalsInFloat: 1,
},
],
tooltip: {
enabled: false,
},
colors: ["#8AB4F7", "#8DCD7F"],
},
I am using an apexchart on my code to display a chart with some data, however my data is not shown when the page loads, it only shows if I zoom in/zoom out or resize the window which I find kinda weird.
I've found a similar issue on the apexcharts github but it has been open since 2019 and is not really active so I'm asking here maybe someone had the same issue and found some way to fix it.
Here's my apexchart:
<v-col cols="12">
<apexchart
type="line"
height="350"
:options="chartOptions"
:series="series"
></apexchart>
</v-col>
Here's my chartOptions:
chartOptions: {
chart: {
height: 350,
type: "line",
zoom: {
enabled: false,
},
toolbar: {
show: false,
},
},
legend: {
labels: {
colors: "#FFFFFF",
},
},
dataLabels: {
enabled: false,
},
stroke: {
curve: "straight",
},
title: {
align: "left",
},
grid: {
row: {
colors: ["#f3f3f3", "transparent"], // takes an array which will be repeated on columns
opacity: 0.5,
},
},
xaxis: {
type: "datetime",
categories: [],
labels: {
datetimeUTC: false,
style: {
colors: "#FFFFFF",
},
},
},
yaxis: [
{
title: {
text: "Energie",
style: {
color: "#FFFFFF",
},
},
labels: {
style: {
colors: "#FFFFFF",
},
},
decimalsInFloat: 1,
},
{
opposite: true,
title: {
text: "Puissance",
style: {
color: "#FFFFFF",
},
},
labels: {
style: {
colors: "#FFFFFF",
},
},
decimalsInFloat: 1,
},
],
tooltip: {
enabled: false,
},
colors: ["#8AB4F7", "#8DCD7F"],
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将REF设置为图表
&lt; ApexChart Ref =“ Chart_ref”/&GT;
并调用以下行:您还可以将此行包裹在NextTick或SettimeTimeOut(0)中,如果仍在错误。
Set a ref to your chart
<apexchart ref="chart_ref"/>
and call following line:You can also wrap this line in nextTick or setTimeout (0) if still bugging.