lundi 4 juillet 2016

Generating google chart Treemap from xlsx file


So I try to create a google charts Treemap out of a xlsx file. I started out by hard coding everything like so, which works fine:

   google.visualization.arrayToDataTable([
      // Header
      ['Domainname', 'Parent', 'Number of Parameters', 'colour'],

      //--------------------------------First level nodes----------------------------------------------

      ['Domain',                                null,       0,  0],
      .... all the other nodes below here ....
      ]);
     tree = new google.visualization.TreeMap(document.getElementById('chart_div'));

     tree.draw(data, {
      highlightOnMouseOver: true,
      minHighlightColor: '#77b300',
      midHighlightColor: '#e6e600',
      maxHighlightColor: '#ff6600', 
      minColor: '#77b300',
      midColor: '#e6e600',
      maxColor: '#ff6600',
      headerHeight: 30,
      fontColor: 'black',
    });

Now I would love to generalize my code and hence let the DataTable be created out of a xlsx File.

Note: I can NOT use google spreadsheet due to external restrictions. However i tried to parse it into csv and use the jquery-csv library but that doesn't work. Also requesting it via DataQuery left me with 'not well formatted' in the Console although I checked my csv with csvLint beforehand. Any suggestions are welcome :)


Aucun commentaire:

Enregistrer un commentaire