Get Image for Sparkline cell

Posted by: mhill on 21 July 2021, 6:56 am EST

    • Post Options:
    • Link

    Posted 21 July 2021, 6:56 am EST

    Hi,

    I am trying to create a function that will render a SpreadJs spreadsheet in HTML, including displaying PieSparklines. To achive that, I’d like to grab an image of the PieSparkline and inject the image into the HTML myself.

    Question: Is it possible to get access to the PieSparkline image from the canvas? If not, can access the sparkline object, and calls its own paint method onto my own canvas and grab an image from there?

    Thanks!

  • Posted 21 July 2021, 7:13 am EST

    Please note that I am able to do this for line, column and winloss. How might I achieve the same thing for a PieSparkline?

            
    var cellr = new GC.Spread.Sheets.Range(0, 0, 1, 5);
            var ex = new GC.Spread.Sheets.Sparklines.SparklineSetting();
            ex.options.SeriesColor  = "Aquamarine";
            activeSheet.setValue(1, 0, 2);
            activeSheet.setValue(1, 1, 5);
            activeSheet.setValue(1, 2, 4);
            activeSheet.setValue(1, 3, -1);
            activeSheet.setValue(1, 4, 3);
            activeSheet.setSparkline(1, 5, cellr, GC.Spread.Sheets.Sparklines.DataOrientation.horizontal, GC.Spread.Sheets.Sparklines.SparklineType.column, ex);
            let s1 = activeSheet.getSparkline(1, 5);
            s1.paintSparkline( ctx, 0, 0, 100, 100 );
            alert( canvas.toDataURL() );
    
    
  • Posted 23 July 2021, 12:58 am EST

    Hi,

    We are sorry but this is currently not supported but we escalated this issue to the Dev team and asked them regarding the same. We will update you once we get any information from the team. The internal ID for this issue will be SJS-9401.

    Regards

    Avinash

Need extra support?

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

Learn More

Forum Channels