t.substring 不是 ApexCharts 中的函数
t.substring is not a function in ApexCharts
大家喝粥,我在 ApexCharts 中遇到了一个错误。谁知道这是怎么回事?谢谢!
我的代码:
// Option Chart
var options = {
series:
[
{
name: 'Operating',
data: [1785, 1661, 1663, 1653, 1882, 1725, 6153, 1153, 6153, 6153, 6153, 1653, 1153, 1663, 1661]
}, {
name: 'Stopping',
data: [4072, 0, 0, 0, 248, 2534, 8533, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
name: 'Error',
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},{
name: 'No Sign',
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}
],
chart: {
type: 'bar',
height: heightChart,
stacked: true,
stackType: '100%'
},
responsive: [{
breakpoint: 480,
options: {
legend: {
position: 'bottom',
offsetX: -10,
offsetY: 0
}
}
}],
xaxis: {
labels: {
style: {
colors: [],
fontSize: '15px',
fontFamily: 'Helvetica, Arial, sans-serif',
fontWeight: 400,
cssClass: 'apexcharts-xaxis-label',
}
},
},
yaxis: {
labels: {
style: {
colors: [],
fontSize: '15px',
fontFamily: 'Helvetica, Arial, sans-serif',
fontWeight: 400,
cssClass: 'apexcharts-xaxis-label',
}
},
},
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
这是错误:
我试图找出这个错误,主要是由于数据错误。但我的数据是正确的。当我们将 0 替换为 1 时,此错误消失。
在创建 plot 选项后,图形生成错误:
plotOptions: {
bar: {
columnWidth: '60%',
colors: {
ranges: [{
from: 0,
to: 0,
color: ['#0000']
}],
backgroundBarColors: [],
backgroundBarOpacity: 1,
backgroundBarRadius: 0,
},
}
},
您的代码运行良好(产生如下所示的结果)并且在我这边没有产生任何错误。
您能检查一下您使用的是哪个版本的 ApexCharts 吗?
大家喝粥,我在 ApexCharts 中遇到了一个错误。谁知道这是怎么回事?谢谢!
我的代码:
// Option Chart
var options = {
series:
[
{
name: 'Operating',
data: [1785, 1661, 1663, 1653, 1882, 1725, 6153, 1153, 6153, 6153, 6153, 1653, 1153, 1663, 1661]
}, {
name: 'Stopping',
data: [4072, 0, 0, 0, 248, 2534, 8533, 0, 0, 0, 0, 0, 0, 0, 0]
}, {
name: 'Error',
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},{
name: 'No Sign',
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}
],
chart: {
type: 'bar',
height: heightChart,
stacked: true,
stackType: '100%'
},
responsive: [{
breakpoint: 480,
options: {
legend: {
position: 'bottom',
offsetX: -10,
offsetY: 0
}
}
}],
xaxis: {
labels: {
style: {
colors: [],
fontSize: '15px',
fontFamily: 'Helvetica, Arial, sans-serif',
fontWeight: 400,
cssClass: 'apexcharts-xaxis-label',
}
},
},
yaxis: {
labels: {
style: {
colors: [],
fontSize: '15px',
fontFamily: 'Helvetica, Arial, sans-serif',
fontWeight: 400,
cssClass: 'apexcharts-xaxis-label',
}
},
},
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
这是错误:
我试图找出这个错误,主要是由于数据错误。但我的数据是正确的。当我们将 0 替换为 1 时,此错误消失。 在创建 plot 选项后,图形生成错误:
plotOptions: {
bar: {
columnWidth: '60%',
colors: {
ranges: [{
from: 0,
to: 0,
color: ['#0000']
}],
backgroundBarColors: [],
backgroundBarOpacity: 1,
backgroundBarRadius: 0,
},
}
},
您的代码运行良好(产生如下所示的结果)并且在我这边没有产生任何错误。
您能检查一下您使用的是哪个版本的 ApexCharts 吗?