TreemapChart
Introduction
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.
Function signature
TreemapChart(
title="Treemap Chart",
colors=None,
tooltip=None,
)
Parameters
title
str
TreemapChart title
colors
List[str]
Determines colors for cells in series in TreemapChart
tooltip
str
Determines tooltip for cells in series in TreemapChart
title
Determines TreemapChart title.
type: str
colors
Determines colors for cells in series in TreemapChart. The colors should be in hex format (e.g. #ff0000).
type: List[str]
default value: None
tooltip
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
Methods and attributes
add_series(names: List[str], values: List[Union[int, float]])
Adds a new series to the TreemapChart widget.
set_series(names: List[str], values: List[Union[int, float]])
Sets a series to the TreemapChart widget, removing all previous series.
get_series(index: int))
Returns a series from the TreemapChart widget by index.
delete_series(index: int)
Deletes a series from the TreemapChart widget by index.
get_clicked_datapoint()
Returns the clicked datapoint from the TreemapChart widget as namedtuple.
Mini app example
You can find this example in our GitHub repository:
supervisely-ecosystem/ui-widgets-demos/charts-and-plots/008_treemap_chart/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize TreemapChart widget
Prepare names and values for series
Set series to TreemapChart widget
Using @click event
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.
Create an app using the layout
Create an app object with the layout parameter.

Last updated
Was this helpful?