Refreshing chart in spreadsheet

Posted by: sinandavid on 20 February 2018, 12:01 pm EST

  • Posted 20 February 2018, 12:01 pm EST

    Hi,

    How do I refresh a chart?

    I found the “refreshContent()” method, but I dont know how I get a charts instance(of already existing charts after excel import) is there something like a “getChart(index)” method?

  • Posted 23 February 2018, 6:14 am EST

    Hello,

    You can get all charts in sheet after importing the Excel file using ‘sheet1.charts.all()’ method. Please refer to the attached sample created with below code:

    
      $("#btngetChart").click(function () {
                  var sheet1 = spread.getSheet(1);
                  var chart = sheet1.charts.all()[0];
                  var chartArea = chart.chartArea();
                  chartArea.backColor = "white";
                  chartArea.fontSize = 14;
                  chart.chartArea(chartArea);
    
                    //Configure chart title
                  var title = chart.title();
                  title.text = "Annual Sales Record";
                  title.fontFamily = "Cambria";
                  title.fontSize = 28;
                  title.color = "#696969";
                  chart.title(title);                     
             });
    
    

    Regards,

    Deepak Sharma

    SpreadJSChartGet.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels