Home Forums Chart Support test series

test series

Viewing 4 posts - 1 through 4 (of 4 total)
  • #35097

    data for msem

    #35102

    Sorry please ignore this

    #35099

    Sorry I’m having difficulty in posting my question as I couldn’t find my topic after the first post, and when creating again it says duplicate detected so I will post my question here.

    My question is how do I Export Multi Series Graph as CSV Data?

    I am using this https://jsfiddle.net/canvasjs/317xw25f/ as a reference however it is only designed for single series graph and I do not understand most of the codes.
    Would anyone be able to modify a new fiddle based on the above for a multi series graph CSV export function?

    This is what my graph looks like graph

    Thank you

    #35177

    @sptrainee31,

    It is possible to convert chart data into comma-separated CSV and download it with a few lines of code. Please find the code snippet for the same below,

    function convertChartDataToCSV(args) {
      var result = '',
          ctr, keys, columnDelimiter, lineDelimiter, data;
    
      data = args.data || null;
      if (data == null || !data.length) {
        return null;
      }
    
      columnDelimiter = args.columnDelimiter || ',';
      lineDelimiter = args.lineDelimiter || '\n';
    
      var mergedData = mergeData(data);
    
      keys = Object.keys(mergedData[0]);
      result = '';
      result += keys.join(columnDelimiter);
      result += lineDelimiter;
    
      mergedData.forEach(function (item) {
        ctr = 0;
        keys.forEach(function (key) {
          if (ctr > 0) result += columnDelimiter;
          result += (typeof (item[key]) != undefined ? item[key] : "");
          ctr++;
        });
        result += lineDelimiter;
      });
      return result;
    }

    Please take a look at this JSFiddle for working code. Also take a look at this 3rd party plugin, which seems to be working with multi-series chart as well.

    Considering this thread as a duplicate of Question about Multi Series Graph CSV Export and hence closing the same.


    Adithya Menon
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.