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
- API Reference:RenderResultSettings
- API Reference:VisualRenderSettings
- API Reference:RenderAsync
License: TIBCO BSD-Style License
Recommended Comments
There are no comments to display.