GridChart

Introduction

GridChart widget is used to create a grid of LineChart subplots with a given data. Users can add plots in real-time making it useful for interactive data exploration and analysis. This widget could be considered as an advanced version of a GridPlot widget with the support of ApexCharts library.

Function signature

data_1 = {
    "title": "Line 1",
    "series": [{"name": "Line 1", "data": s1}],
}

data_2 = {
    "title": "Line 2",
    "series": [{"name": "Line 2", "data": s2}],
}

data_all = {
    "title": "All lines",
    "series": [{"name": "Line 1", "data": s1}, {"name": "Line 2", "data": s2}],
}

grid_chart = GridChart(data=[data_1, data_2, data_all], columns=3)

Parameters

Parameters
Type
Description

data

List[dict or str]

List of data to display. str inputs will be recognized as a titles for empty widgets.

columns

int

Number of columns.

gap

int

Gap between widgets inside GridChart.

widget_id

str

ID of the widget

data

List of data to display on GridPlot.

type: List[Dict or str]

columns

Determine the number of columns on GridChart.

type: int

default value: 1

gap

Determine the gap between widgets on GridChart.

type: int

default value: 10

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

add_scalar(identifier: str, y, x)

Add data in GridChart.

add_scalars(plot_title: str, new_values: dict, x)

Add series of data in GridChart.

Mini App Example

You can find this example in our GitHub repository:

ui-widgets-demos/charts and plots/010_grid_chart/src/main.py

Import libraries

Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

Prepare series for plot

Initialize GridChart widget

Create app layout

Prepare a layout for an app using a Card widget with the content parameter and place widget that we've just created in the Container widget.

Create an app using a layout

Create an app object with a layout parameter.

Last updated

Was this helpful?