Multiple datasets with dataloader Amcharts - undefined

爷,独闯天下 提交于 2019-12-25 01:21:43

问题


I'm making a chart with multiple axes to show different data in one graph. I made multiple datasets with dataloader and set the valuefield of the graphs, but it doesn't work. Here is the code for my datasets:

 "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"
	}

Here is the rest of my code for the graph:

 "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"
}]
};

I don't really know how to implement such a graph with multiple datasets + multiple axes. I don't really find much documentation so i'm really stuck here. Someone sees the problem?

来源:https://stackoverflow.com/questions/54884920/multiple-datasets-with-dataloader-amcharts-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!