Html 角度9中的顶点图表
我在angular 9中使用apex图表时遇到一些问题,基本上我可以在模拟第一个屏幕截图中的数据时看到图表(折线图),但我无法从REST API中获取数据,我的意思是图表消失了。 这是包含图表的方法:Html 角度9中的顶点图表,html,angular,typescript,apexcharts,Html,Angular,Typescript,Apexcharts,我在angular 9中使用apex图表时遇到一些问题,基本上我可以在模拟第一个屏幕截图中的数据时看到图表(折线图),但我无法从REST API中获取数据,我的意思是图表消失了。 这是包含图表的方法: drawGraph(){ this.projectService.getLineChartData(this.getID()).then((data) =>{ for(let i = 0; i<data.resourceListSize;
drawGraph(){
this.projectService.getLineChartData(this.getID()).then((data) =>{
for(let i = 0; i<data.resourceListSize; i++){
this.chartOptions = {
series: [
{
name: "data",
data: [28, 29, 33, 36, 32, 32, 33]
},
{
name: "Low - 2013",
data: [12, 11, 14, 18, 17, 13, 13]
}
],
chart: {
height: 350,
type: "line",
dropShadow: {
enabled: true,
color: "#000",
top: 18,
left: 7,
blur: 10,
opacity: 0.2
},
toolbar: {
show: false
}
},
colors: ["#77B6EA", "#545454"],
dataLabels: {
enabled: true
},
stroke: {
curve: "smooth"
},
title: {
text: "Average High & Low Temperature",
align: "left"
},
grid: {
borderColor: "#e7e7e7",
row: {
colors: ["#f3f3f3", "transparent"], // takes an array which will be repeated on columns
opacity: 0.5
}
},
markers: {
size: 1
},
xaxis: {
categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"],
title: {
text: "Month"
}
},
yaxis: {
title: {
text: "Temperature"
},
min: 5,
max: 40
},
legend: {
position: "top",
horizontalAlign: "right",
floating: true,
offsetY: -25,
offsetX: -5
}
};
}
})
}
drawGraph(){
this.projectService.getLineChartData(this.getID())。然后((数据)=>{
对于(设i=0;i步骤1,
使用以下数据设置配置(最低配置)
}
步骤2:
来自api响应的数据,并设置为“chartoptions”变量
this.chartOptions.series=[{
name: "data",
data: [28, 29, 33, 36, 32, 32, 33]
}, {
name: "Low - 2013",
data: [12, 11, 14, 18, 17, 13, 13]
}
];
this.chartOptions.xaxis=
{
categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"]
}
步骤1,
使用以下数据设置配置(最低配置)
}
步骤2:
来自api响应的数据,并设置为“chartoptions”变量
this.chartOptions.series=[{
name: "data",
data: [28, 29, 33, 36, 32, 32, 33]
}, {
name: "Low - 2013",
data: [12, 11, 14, 18, 17, 13, 13]
}
];
this.chartOptions.xaxis=
{
categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"]
}
我认为您可以首先过滤掉要在图表上表示的数据,然后使用api提供的数据呈现图表。我认为您可以首先过滤掉要在图表上表示的数据,然后使用api提供的数据呈现图表