Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
How to adapt a custom extension to the current theme
Solution:
You can use the Document.GetStyle() method to get the style properties of elements in the user interface. There are various related classes such as StyleProperties, ColorInfo, FontStyle, FontWeight etc. See the attached image (Filename:Styling API.png) to get a brief idea about these classes.
In the RenderCore() of the CustomVisualization you can use the Document.GetStyle() to get the current theme of the Analysis and then use this in the visual to adapt.
Example:
var visualContentStyle = document.GetStyle(StyleElement.VisualContent); var backgroundColor = visualContentStyle.GetEffectiveBackgroundColor(); using (Brush backgroundBrush = new SolidBrush(backgroundColor)) using (Pen backgroundPen = new Pen(backgroundColor)) { renderArgs.Graphics.DrawRectangle(backgroundPen, renderArgs.Bounds); renderArgs.Graphics.FillRectangle(backgroundBrush, renderArgs.Bounds); }Refer to the RenderCore() in the TrafficLightchart.cs or CustomScatterPlot.cs of the CustomVisualsExample available with the SDK on how to manage the visualizations to blend in with the theme in the analysis. Documentation:
- https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/?topic=html/M_Spotfire_Dxp_Application_Document_GetStyle.htm
- https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/?topic=html/T_Spotfire_Dxp_Application_StyleElement.htm
- https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/TIB_sfire-analyst_api/?topic=html/T_Spotfire_Dxp_Framework_Styles_StyleProperties.htm
Comments
0 comments
Article is closed for comments.