Skip to content

hopsworks.core.chart_api #

ChartApi #

REST wrapper over /project/{id}/charts.

The backend returns charts as plain dicts with layout fields (width/height/x/y) that are NOT NULL; callers creating charts must supply them.

HTTP calls go through :mod:hopsworks_common.core.rest so this module does not reach into the SDK's private client surface (_send_request / _project_id).

create_chart #

create_chart(
    title: str,
    url: str,
    description: str = "",
    width: int = 6,
    height: int = 4,
    x: int = 0,
    y: int = 0,
    job_name: str | None = None,
) -> dict[str, Any]

Create a chart.

PARAMETER DESCRIPTION
title

Chart title.

TYPE: str

url

URL to render (typically a Plotly HTML asset in HopsFS).

TYPE: str

description

Free-form description.

TYPE: str DEFAULT: ''

width

Dashboard width in grid units.

TYPE: int DEFAULT: 6

height

Dashboard height in grid units.

TYPE: int DEFAULT: 4

x

Dashboard x position in grid units.

TYPE: int DEFAULT: 0

y

Dashboard y position in grid units.

TYPE: int DEFAULT: 0

job_name

Optional Hopsworks job to associate.

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION
dict[str, Any]

The created chart dict.

delete_chart #

delete_chart(chart_id: int) -> None

Delete a chart by ID.

PARAMETER DESCRIPTION
chart_id

Chart identifier.

TYPE: int

get_chart #

get_chart(chart_id: int) -> dict[str, Any]

Fetch a single chart by ID.

PARAMETER DESCRIPTION
chart_id

Chart identifier.

TYPE: int

RETURNS DESCRIPTION
dict[str, Any]

The chart dict as returned by the backend.

list_charts #

list_charts() -> list[dict[str, Any]]

Return every chart visible in the current project.

RETURNS DESCRIPTION
list[dict[str, Any]]

A list of chart dicts with fields id, title, url, …

update_chart #

update_chart(
    chart_id: int, **fields: Any
) -> dict[str, Any]

Update selected fields of a chart.

Accepts any subset of title, description, url, width, height, x, y, job as keyword arguments.

PARAMETER DESCRIPTION
chart_id

Chart identifier.

TYPE: int

RETURNS DESCRIPTION
dict[str, Any]

The updated chart dict.