Setting order of graphs via config

Normally, the chart displays graphs in the same order as they are defined in chart's graphs array.

This very simply plugin, which uses AmCharts.addInitHandler() call, pre-sorts graphs using their proprietary index property.

AmCharts.addInitHandler(function(chart) {
  // Reorder chart graph's based on their "index" value
  chart.graphs.sort(function(a, b) {
    if (a.index == b.index) {
      return 0;
    return a.index < b.index ? -1 : 1;
}, ["serial"]);