Jump to content
  • Using the Visual.RenderSync API to export visualization with the current theme using IronPython Scripting in Spotfire®


    This example demonstrates the use of the RenderAsync API introduced in Spotfire version 7.12 to export a visualization to an image. It will allow users to export visuals with the current theme, eg:-the dark theme.

    Introduction

    This example demonstrates the use of the RenderAsync API introduced in Spotfire version 7.12 to export a visualization to an image. It will allow users to export visuals with the current theme, eg:-the dark theme.

    Code Sample

    from Spotfire.Dxp.Application.Visuals import *
    from System.Drawing import Size
    from System.Threading import CancellationToken 
    from Spotfire.Dxp.Application.Visuals import RenderResultSettings
    
    
    s=Size(500,500)
    rrs=RenderResultSettings(s)
    vrs=VisualRenderSettings()
    vrs.ShowAnnotations=Visibility.Visible
    vrs.ShowLegend=Visibility.Visible
    vrs.ShowTitle=Visibility.Visible
    ct=CancellationToken()
    #viz is a script parameter referencing the visualization to be exported
    rresult=viz.RenderAsync(rrs,vrs,ct)
    img=rresult.Result.AsImage()
    img.Save("C://temp//viz.png")
     

     

    #Note - "Execute in transaction" checkbox is unchecked before running the script

    References

    License:  TIBCO BSD-Style License

    Back to IronPython Scripting in Spotfire® Examples


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...