So I have been building a chart system for a while now for my client, and I am currently encountering a very odd situation, if I pass more than one data point into a stacked line then sometimes they will simply be in the same locations as one another, but if I use the legend to hide the one, the other will move to it's correct location, here's a gif to show:

And here is the code I am using to generate it.
- function BuildChart(widgetID, data, Settings) {
- ConvertDataTypes(data, Settings);
- var newtype = chartTypeData[Settings.tableindex].Id;
- if (Settings.xindexs.length > 1) {
- newtype = 'Stacking' + newtype;
- }
- var newseries = [];
- for (var i = 0; i < Settings.xindexs.length; i++) {
- var colname = Settings.xindexs[i].column;
- if (Settings.xindexs[i].columnType == 'number' && Settings.xindexs[i].aggregateoption != null) {
- colname = Settings.xindexs[i].displaytext;
- }
- var newdata = {
- dataSource: data, xName: Settings.yindex.column, yName: colname,
- //Series type as stacked column
- type: newtype,
- name: colname,
- }
- newseries.push(newdata);
- }
-
- var xaxistype = Settings.yindex.columnType;
- var primaryX = {
- title: Settings.yindex.column,
- rangePadding: 'Round'
- };
- switch (xaxistype) {
- case ('date'):
- xaxistype = 'DateTime'
- primaryX.labelFormat = 'yyyy/MMM/dd'
- primaryX.rangePadding = 'Additional'
- break;
- case ('number'):
- xaxistype = 'Double'
- break;
- default:
- xaxistype = 'Category';
- break;
- }
- primaryX.valueType = xaxistype;
- primaryX.edgeLabelPlacement = 'Shift';
- var chart = new ej.charts.Chart({
- width: 'inherit', height: 'inherit',
- canResize: true,
- primaryXAxis: primaryX,
- primaryYAxis: {
- title: Settings.xindexs[0].column,
- labelFormat: '{value}'
- },
- commonSeriesOptions: {
- enableAnimation: false
- },
- series: newseries,
- tooltip: { enable: true },
- });
- chart.appendTo('#' + widgetID);
- var tempobject = {
- width: 'inherit', height: 'inherit',
- canResize: true,
- primaryXAxis: primaryX,
- primaryYAxis: {
- title: Settings.xindexs[0].column,
- labelFormat: '{value}'
- },
- commonSeriesOptions: {
- enableAnimation: false
- },
- series: newseries,
- tooltip: { enable: true }
- };
- var debugoutput = JSON.stringify(tempobject);
- return chart;
- //console.log(chart);
- }
The data is user supplied so it varies, however here is the json object of the debug object declared at the bottom:
https://jsoneditoronline.org/#left=cloud.1450686424d847208b3608be4e18650eNow there is also even more odd behaviour if I add three options:

I have no idea what is going on here, here is the debug json object:
https://jsoneditoronline.org/#left=cloud.ef667a5f62634c1ab9b3f65641d52ac4Also on the json objects, just click tree and it will show you the data I put into the tables. Thanks!
Edit: How do I post code in a better format? I see your official posts with clean code formatting and I'd like to be able to do that.
Edit 2: Found a solution, leaving this here for future users,
Don't set lines to stacked.