0

I dynamically generate a Dygraph chart with data retrieved and formatted using a PHP script.

  var vGraph = new Dygraph(document.getElementById("dgraphChartContainer"),
     "./data_packager.php",
     {  //options
       ...
     };

My customer wants me to add a button on the Dygraph to download a CSV file of the complete raw data set returned by the PHP query. Is there a single Dygraph object I can reference of the entire RxC matrix? If not, is there a simpler or more efficient way to recreate the CSV than to perform a .getValue on each element in the data set and then export to a new CSV file per one of the solutions in How to export JavaScript array info to csv (on client side)??

Community
  • 1
  • 1
DUHdley d'Urite
  • 187
  • 3
  • 15
  • Why not download `data_packager.php`? Why do you need to have access to the data in JavaScript? – danvk Nov 29 '14 at 23:31
  • Good question, Dan. My thought was to avoid making two calls to the server if the data were already encapsulated in a Javascript object on the client. If that's not an option, and is sounds as though it isn't, then I'll compare the time to download the formatted data via PHP vs restructuring the data in Javascript. – DUHdley d'Urite Nov 30 '14 at 23:20

0 Answers0