Linechart is a Supervisely widget that allows for visualizing data as a line chart. It supports data in pandas dataframe format or a Python list of dictionaries with a specific structure. This widget could be considered an advanced version of a LinePlot widget with the support of ApexCharts library.
The widget allows for customization of the chart title, axis titles, and color scheme. Linechart also supports zooming, panning, and downloading the chart as png, svg, or csv. Additionally, it can detect clicks on data points and respond to them through Python code
Function signature
size1 =10x1 =list(range(size1))y1 = np.random.randint(low=10,high=148,size=size1).tolist()s1 =[{"x": x,"y": y}for x, y inzip(x1, y1)]size2 =30x2 =list(range(size2))y2 = np.random.randint(low=0,high=300,size=size2).tolist()s2 =[{"x": x,"y": y}for x, y inzip(x2, y2)]line_chart =LineChart(title="Max vs Denis",series=[{"name":"Max","data": s1},{"name":"Denis","data": s2}],xaxis_type="category",)
Parameters
Parameters
Type
Description
title
str
Line chart title
series
list
List of series including names and lists of X, Y coordinates
zoom
bool
Enable zoom on Linechart
stroke_curve
Literal["smooth", "straight"]
Set line type (straight or curved)
stroke_width
int
Set line width
markers_size
int
Set point markers size
data_labels
bool
If True it will display Y value of data for each datapoint
xaxis_type
Literal["numeric", "category", "datetime"]
Set type of divisions on X axis
xaxis_title
str
Set title for the X axis
yaxis_title
str
Set title for the Y axis
yaxis_autorescale
bool
Set autoscaling of the Y axis
height
Union[int, str]
Widget height
decimalsInFloat
int
Set number of decimals in float values of Y axis
data_type
Literal["dict", "tuple"]
The representation of xy coordinates. Default as a dictionary.
title
Line chart title
type:str
series
List of series including names and lists of X, Y coordinates
import os
import numpy as np
import supervisely as sly
from dotenv import load_dotenv
from supervisely.app.widgets import Card, Container, LineChart, Table
load_dotenv("local.env")
load_dotenv(os.path.expanduser("~/supervisely.env"))
api = sly.Api()
size1 = 10
x1 = list(range(size1))
y1 = np.random.randint(low=10, high=148, size=size1).tolist()
s1 = [{"x": x, "y": y} for x, y in zip(x1, y1)]
size2 = 30
x2 = list(range(size2))
y2 = np.random.randint(low=0, high=300, size=size2).tolist()
s2 = [{"x": x, "y": y} for x, y in zip(x2, y2)]