Home Forums Chart Support I Want Capture a Screenshots of Whole Canvas Chart.

I Want Capture a Screenshots of Whole Canvas Chart.

Viewing 2 posts - 1 through 2 (of 2 total)
  • #36480

    Hello
    I Want Capture a Screenshots of Whole Canvas Chart Which is Scrollable.
    But if we Use export Chart Functionality than we only Capture What is shown in Current Screen not Whole Chart.

    https://jsfiddle.net/kevalpanchal/bqmg7536/5/

    Check out MY Chart
    I need to take Whole Chart Screen shot Behalf of actual view screen.

    #36485

    @keval-panchal,

    exportChart method exports the entire chart irrespective of the scrollbar. In cases where you zoom into a region of the chart (either by zooming using mouse or zooming programmatically by setting viewportMinimum and/or viewportMaximum) & try to export, it exports the entire chart with the axis-range that you have zoomed into.

    In order to show the entire viewport Range on the image while exporting, you can reset the viewportMinimum and viewportMaximum property before exporting as shown in the code-snippet below,

    document.getElementById("exportChart").addEventListener("click",function(){
      var tempViewportMinimum = chart.axisX[0].get("viewportMinimum");
      var tempViewportMaximum = chart.axisX[0].get("viewportMaximum");
    
      chart.axisX[0].set("viewportMaximum", null, false);
      chart.axisX[0].set("viewportMinimum", null);
    
      chart.exportChart({format: "jpg"});
    
      chart.axisX[0].set("viewportMinimum", tempViewportMinimum, false);
      chart.axisX[0].set("viewportMaximum", tempViewportMaximum);
    }); 

    Kindly take a look at this JSFiddle for an example on the same.


    Adithya Menon
    Team CanvasJS

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

You must be logged in to reply to this topic.