score:2

Accepted answer

grouped categories plugin expects format of categories that is not supported directly by highcharts. data module is highcharts official plugin, so it will not work like that by default or by using some available settings. parsing csv data - creating series data array and categories object could be the way to resolve the problem.

here is example of what that parser might look like: http://jsfiddle.net/vboak5hr/

  $.get('data.csv', function(data) {
    // split the lines
    var lines = data.split('\n');
    var series = [];

    // iterate over the lines and add categories or series
    $.each(lines, function(lineno, line) {
      var items = line.split(';'),
        hasthiscategory = false,
        categoryindex = -1,
        categorypath = options.xaxis.categories;

            //add data point to series data
      options.series[0].data.push(parseint(items[3]));

            // i. level of categories
      highcharts.each(categorypath, function(category, i) {
        if (category.name === items[0]) {
          hasthiscategory = true;
          categoryindex = i;
        }
      });
      if (!hasthiscategory) {
        categorypath.push({
          name: items[0],
          categories: []
        });
      }
      if (categoryindex === -1) categoryindex = categorypath.length - 1;

            // ii. level of categories
      categorypath = categorypath[categoryindex].categories;
      hasthiscategory = false;
      categoryindex = -1;

      highcharts.each(categorypath, function(category, i) {
        if (category.name === items[1]) {
          hasthiscategory = true;
          categoryindex = i;
        }
      });
      if (!hasthiscategory) {
        categorypath.push({
          name: items[1],
          categories: []
        });
      }
      if (categoryindex === -1) categoryindex = categorypath.length - 1;

            // iii. level of categories
      categorypath = categorypath[categoryindex].categories;
      hasthiscategory = false;
      categoryindex = -1;

      highcharts.each(categorypath, function(category, i) {
        if (category === items[2]) {
          hasthiscategory = true;
        }
      });
      if (!hasthiscategory) {
        categorypath.push(items[2]);
      }

    });

    // create the chart
    var chart = new highcharts.chart(options);
  });

Related Query

More Query from same tag