s removal affected it
						if (datasetIndex < datasetLineIndex){
							datasetLineIndex = datasetLineIndex - 1;
						}
					}

					// In case there is a 'line' dataset
					if(datasetLineIndex >= 0) {
						// Remove the existing 'line' dataset
						mainChart.data.datasets.splice(datasetLineIndex, 1);
						mainChart.update();

						// If value is different than 'none', then add the new dataset
						if (selected_item.value != "none"){
							for (let i = 0; i < Math.min(quantity_data_shown, data_list