selected_column], borderColor: borderColors[selected_column], borderWidth: 1 };");
						mainChart.data.datasets.push(eval(selected_column));
						mainChart.update();
					}
				} else {
					if(datasetBarIndex >= 0) {
					    mainChart.data.datasets.splice(datasetBarIndex, 1);
					    mainChart.update();
					}
				}
			}
		}

		/*
		 * Function that updates the chart with the current order and direction, re-adding the existing datasets to the chart
		 */
		function updateOrder() {
			// Data collected 