使用数据加载器Amcharts的多个数据集-未定义

时间:2019-02-26 11:51:46

标签: javascript amcharts

我正在制作一个具有多个轴的图表,以在一个图中显示不同的数据。我使用数据加载器制作了多个数据集,并设置了图形的valuefield,但是它不起作用。这是我的数据集的代码:

 "dataSets" : [
         {
		title: "Glucose",
		fieldMappings: [ {
			fromField: "Historie glucose (mg/dL)",
			toField: "Historie glucose (mg/dL)"
		}],
		dataLoader: {
            "url": "datafiles/dateParsed.json",
        "format": "json",
        "showErrors": true,
        "noStyles": true,
        "async": true
		},
		categoryField: "Tijd"
	}, {
		title: "Voeding",
		fieldMappings: [ {
			fromField: "Ingeschatte hoeveelheid koolhydraten",
			toField: "Ingeschatte hoeveelheid koolhydraten"
		}, {
			fromField: "Aantal eenheden insuline",
			toField: "Aantal eenheden insuline"
		} ],
		dataLoader: {
                    "url": "datafiles/voedingsdagboek.json",
                    "format": "json",
                    "showErrors": true,
                    "noStyles": true,
                    "async": true
		},
		categoryField: "Tijd"
	}

这是该图的其余代码:

 "type": "serial",
    "theme": "none",
    "marginLeft": 70,
    "synchronizeGrid": true,
    "dataDateFormat": "DD-MM-YYYY JJ:NN",
        "valueAxes": [{
            "id": "v1",
            "axisColor": "#000000",
            "axisThickness": 2,
            "axisAlpha": 1,
            "position": "left"
        }, {
            "id": "v2",
            "axisColor": "red",
            "axisThickness": 2,
            "axisAlpha": 1,
            "position": "right"
        }],
    "graphs": [{
            "valueAxis": "v1",
            "bullet": "round",
            "bulletBorderAlpha": 1,
            "bulletColor": "#FFFFFF",
            "bulletSize": 5,
            "hideBulletsCount": 50,
            "lineThickness": 2,
            "lineColor": "#000000",
            "title": "red line",
            "useLineColorForBulletBorder": true,
            "title": "Glucose values",
            "valueField": "Historie glucose (mg/dL)"
  }
        , {
                "valueAxis": "v2",
                "balloonText": "[Voeding: [[Voeding], Drank: [Drank]]",
                "columnWidth": 20,
                "title": "Food",
                "valueField": "Ingeschatte hoeveelheid koolhydraten"
          }
        ],
    "chartCursor": {
        "categoryBalloonEnabled": false
    },
    "categoryField": "Tijd",
    "categoryAxis": {
        "parseDates": true,
        "minPeriod": "hh",
        "dashLength": 1,
        "minorGridEnabled": true,
        "labelsEnabled": true,
        "tickLength": 0
    },
    "valueAxes": [{
        "ignoreAxisWidth": true
  }],
    guides: [{
        //value axis guide
        value: 100,
        toValue: 200,
        fillAlpha: .40,
        fillColor: "#008000"
}, {
        value: 0,
        toValue: 100,
        fillAlpha: 0.40,
        fillColor: "#0000FF"
}, {
        value: 200,
        toValue: 10000,
        fillAlpha: 0.40,
        fillColor: "#FF0000"
}]
};

我真的不知道如何使用多个数据集+多个轴来实现这种图形。我确实找不到太多文档,所以我真的被困在这里。 有人看到问题了吗?

0 个答案:

没有答案