Search code examples
zingchart

Changing csv url in zingchart


I have a page that clients can upload their csv files, save it to the server, then ajax will pass the location of the csv.

Question is I can't find a way for zingchart to reload with a new csv url, tried many ways in the document, below is my uncomplete code, don't know if there is any method in zingchart.exec can achieve this. Thanks for any suggestions or help

   $.ajax({
               type: 'POST',
                url: '/upload_csv',
                data: form_data,
                contentType: false,
                cache: false,
                processData: false,
                
                success: function(data) {
                    zingchart.exec('chartjs-line', 'modifyplot', {
                       data:{
                          csv: {
                            url: data.csv_url,
                             verticalLabels: true,
                           }
                       };
                     }
                 });
            
      });

Solution

  • You should be able to do this with the modify function, the same way you have it set up currently. modifyplot targets the plot object within your graph object; csv should be a member of your graph object.

    If you have any other issues, the fastest way to get support is emailing [email protected] or starting a chat with us on our site!