TreemapChart widget in Supervisely is a widget used for displaying a treemap chart. It allows users to visualize data for comparison distribution of different objects. The TreemapChart widget allows easily visualize data to determine the distribution of objects in comparison to each other.
Determines the tooltip for cells in series in TreemapChart. The tooltip should be in str format and may contain {x} and {y} placeholders. The name of the cell will be shown instead of {x} and the value of the cell will be shown instead of {y}. If not specified, the default tooltip will be used (e.g. name: value)
type:str
default value:None
tooltip ="This is the name: {x}, this is the value: {y}"chart =TreemapChart( title="Treemap Chart", tooltip=tooltip,)
# Colors are optional. If not specified, the default colors will be used.colors = ["#008FFB","#00E396","#FEB019",]# Tooltip is optional. If not specified, the default tooltip will be used.tooltip ="This is the name: {x}, this is the value: {y}"tc =TreemapChart(title="Treemap Chart", colors=colors, tooltip=tooltip)
clicked_datapoint =Text(status="info")@tc.clickdefclicked(datapoint):# Datapoint is a namedtuple with fields: series_index, data_index, data# data is a dict with fields: name, value clicked_datapoint.text = datapoint
Create app layout
Prepare a layout for the app using Card widget with the content parameter and place widget that we've just created in the Container widget.
# Creating Card widget, which will contain the Transfer widget and the Text widget.card =Card(title="TreemapChart", content=Container(widgets=[dc, clicked_datapoint]))# Creating the application layout.layout =Container(widgets=[card])
Create an app using the layout
Create an app object with the layout parameter.
# Initializing the application.app = sly.Application(layout=layout)