Back to bricks list
Introduction Version

Plotly resource

RESOURCE
Typing name :  RESOURCE.gws_core.PlotlyResource Brick :  gws_core
Parent :
Resource

Plotly resource

Resource that contains a plotly figure.

Ex : import plotly.express as px figure = px.scatter(source, x="A", y="B") resource = PlotlyResource(figure)

Views

VIEW PLOTDefault view
View interactive plotly figure
VIEW RESOURCE
View the complete resource as json

Attributes

figure: Figurename: strstyle: TypingStyletags: TagListtechnical_info: TechnicalInfoDictuid: str

Functions

__INIT__

Constructor, please do not overwrite this method, use the init method instead Leave the constructor without parameters.

Parameters:
NameTypeDefault valueDescription
figureFigure
ADD_TECHNICAL_INFO

Add technical information on the resource. Technical info are useful to set additional information on the resource.

Parameters:
NameTypeDefault valueDescription
technical_infoTechnicalInfo Technical information to add (key, value)
CHECK_RESOURCE

You can redefine this method to define custom logic to check this resource. If there is a problem with the resource, return a string that define the error, otherwise return None This method is called on output resources of a task. If there is an error returned, the task will be set to error and next proceses will not be run. It is also call when uploading a resource (usually for files or folder), if there is an error returned, the resource will not be uploaded

Return type:
Optional
CLONE

Clone the resource to create a new instance with a new id. It copies the RFields.

Return type:
ResourceType
EQUALS
Parameters:
NameTypeDefault valueDescription
otherobject
Return type:
bool
GET_DEFAULT_NAME

You can redefine this method to set a name of the resource. When saving the resource the name will be saved automatically This can be useful to distinguish this resource from another one or to search for the resource

Return type:
str
GET_FIGURE
Return type:
Figure
GET_MODEL_ID

Get the id of the resource model in the database. It is provided by the system for input resources of a task.

Return type:
str
GET_NAME_OR_DEFAULT

Get the name of the resource or the default name if the name is None

Return type:
str
GET_TECHNICAL_INFO

Get the technical information of the resource

Parameters:
NameTypeDefault valueDescription
keystr Key of the technical information
Return type:
TechnicalInfo
INIT

This can be overwritten to perform custom initialization of the resource. This method is called after the init (constructor) of the resource. The values of RFields are set when this method is called.

CLASSNAME - @classmethod

Returns the name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False True to slugify the class name if true, defaults to false , optional
snakefybool False True to snakefy the class name if true, defaults to false , optional
replace_uppercasebool False Replace upper cases by "-" if true, defaults to false , optional
Return type:
str
COPY_STYLE - @classmethod

Copy the style of the resource with the possibility to override some properties. Useful when settings the style for a task based on the resource style.

Parameters:
NameTypeDefault valueDescription
icon_technical_namestr Technical name of the icon if provided, the icon_type must also be provided, defaults to none , optional
icon_typeTypingIconType Type of the icon if provided, the icon_technical_name must also be provided, defaults to none , optional
background_colorstr Background color, defaults to none , optional
icon_colorTypingIconColor Icon color, defaults to none , optional
Return type:
TypingStyle
DECORATED_METHOD_NAMES - @classmethod
Parameters:
NameTypeDefault valueDescription
decorator_nameAny
FULL_CLASSNAME - @classmethod

Returns the full name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False Slugify the returned class name if true, defaults to false , optional
snakefybool False Snakefy the returned class name if true, defaults to false ``
Return type:
str
GET_HUMAN_NAME - @classmethod

Get the human name of the resource

Return type:
str
GET_SHORT_DESCRIPTION - @classmethod

Get the short description of the resource

Return type:
str
GET_TYPING_NAME - @classmethod

Get the typing name of the resource

Return type:
str
INHERITORS - @classmethod

Get all the classes that inherit this class

Return type:
List
METHOD_NAMES - @classmethod

Returns the list of the methods

Return type:
List
MODULE_NAME - @classmethod

Returns the module name of the class

Return type:
str
PROPERTY_METHOD_NAMES - @classmethod
PROPERTY_NAMES - @classmethod

Retrieves the property names

Parameters:
NameTypeDefault valueDescription
instancetype The s of the properties to retrieve. set `none` to retrieve all. `type` or `union[type]`
excludetype
Return type:
List