【发布时间】:2021-04-17 09:09:44
【问题描述】:
我已经成功添加了低值和高值,但是,我仍然在为代表中间值的线苦苦挣扎。到目前为止,这是我的代码:
const schema = [
{
"name": "Date",
"type": "date",
"format": "%Y-%m-%d",
},
{
"name": "Low",
"type": "number",
},
{
"name": "High",
"type": "number",
},
];
type dataProperties = {Date: string, Low: number, High: number};
type lineProperties = {value: number};
let graphData: dataProperties[] = [];
let lineData: lineProperties[] = [];
let jsonData: dataProperties;
// Create an array of JSON objects from the data
for (let i = 1; i < data.EVI.length; i++) {
jsonData = {
Date: data.x[i],
Low: data.EVI[i][2],
High: data.EVI[i][0],
};
graphData.push(jsonData);
lineData.push({value: data.EVI[i][1]});
}
this.variationOverTime = {
chart: {},
dataset: [
{
"seriesName": "Mid",
"renderAs": "line",
"data": lineData // I'm guessing this is where I'm doing something wrong
}
],
caption: {
text: "Vigour Block and Variation Over Time"
},
yaxis: [
{
"plot": {
"value": {
high: "High",
low: "Low"
},
"type": "area-range",
"name": "area-range"
}
}
],
};
const fusionDataStore = new FusionCharts.DataStore();
const fusionTable = fusionDataStore.createDataTable(graphData, schema);
this.variationOverTime.data = fusionTable;
我查看了 JSFiddle (https://jsfiddle.net/73xgmacm/249/) 上的另一个示例,试图将其合并到区域范围图中。目前这条线只是没有显示。我也没有看到任何可能有助于解决问题的错误。任何帮助将不胜感激!
【问题讨论】:
标签: javascript angular fusioncharts