Item#

class ansys.dynamicreporting.core.Item(service: ADR = None, obj_name: str | None = 'default', source: str | None = 'ADR')#

Bases: object

Provides for creating an object that represents an Ansys Dynamic Reporting item.

Create an instance of this class for each item in the database that you want to interact with. When the object is created, no type is set. The type, determined the first time that you set the item_* attribute, cannot be changed.

This code creates an instance with the object my_txt as a text item:

>>> my_txt = adr_service.create_item()
>>> my_txt.item_text = '<h1>The test</h1>This is a text item'

The type of the item created in the preceding code cannot be changed. However, the attributes describing the object can be reset at any time. These changes are automatically propagated into the database. The attributes described in the following “Parameters” section can be used to control the rendering of these objects.

Note

These attributes mirror the generic data item attributes described in Data Items in the documentation for Ansys Dynamic Reporting.

Parameters:
serviceansys.dynamicreporting.core.Service, optional

Ansys Dynamic Reporting object that provides the connection to the database that the item is to interact with. The default is None.

obj_namestr, optional

Name of the item object in the database. The default is default.

sourcestr, optional

Name of the source for the item in the database. The default is "ADR".

Examples

Initialize the Service class inside an Ansys Dynamic Reporting service and create an object as a text item:

import ansys.dynamicreporting.core as adr
adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v232')
adr_service.connect(url='http://localhost:8010')
my_txt = adr_service.create_item()
my_txt.item_text = '<h1>The test</h1>This is a text item'

Methods

Item.add_tag([tag, value])

Add a tag to the item.

Item.get_iframe([width, height])

Get the iframe object corresponding to the item.

Item.get_tags()

Get the tags on the item.

Item.rem_tag([tag])

Remove a tag on the item.

Item.set_tags([tagstring])

Set tags on the item.

Item.visualize([new_tab])

Render this item only.

Attributes

Item.url

URL corresponding to the item

Item.item_text

Text (HTML and LaTeX formatting)

Item.item_image

Image object (Image and PNG binary files)

Item.item_scene

3D scene (AVZ, PLY, SCDOC, SCDOCX, GLB, and STL files)

Item.item_animation

Animation file (MP4/H.264 format files)

Item.item_table

Table values (Must be in a numpy array)

Item.format

Number format

Item.format_column

Column labels format

Item.labels_column

Column labels

Item.format_row

Row labels format

Item.labels_row

Row labels

Item.plot

Table display style

Item.title

Common title

Item.line_color

Linebarhistogrampiemarker colors

Item.line_marker

Markers

Item.line_marker_text

Marker text

Item.marker_text_rowname

Marker text row name

Item.line_marker_size

Marker size

Item.line_marker_opacity

Marker opacity

Item.line_marker_scale

Marker scaling

Item.line_error_bars

Error bars

Item.line_marker_aux0

Auxiliary data 0

Item.line_marker_aux1

Auxiliary data 1

Item.line_marker_aux2

Auxiliary data 2

Item.line_marker_aux3

Auxiliary data 3

Item.line_marker_aux4

Auxiliary data 4

Item.line_marker_aux5

Auxiliary data 5

Item.line_marker_aux6

Auxiliary data 6

Item.line_marker_aux7

Auxiliary data 7

Item.line_marker_aux8

Auxiliary data 8

Item.line_marker_aux9

Auxiliary data 9

Item.column_minimum

Column range minimums

Item.column_maximum

Column range maximums

Item.line_style

Line styling

Item.line_width

Line width

Item.stacked

Bar chart stacking Deprecated

Item.bar_mode

Bar chart Histogram config mode

Item.xaxis

X axis rows

Item.yaxis

Y axis rows

Item.zaxis

Z axis rows

Item.palette

Color palette

Item.palette_position

Position of the colorbar

Item.palette_range

Range of the colorbar

Item.palette_show

Colorbar display

Item.palette_title

Colorbar title string

Item.histogram_threshold

Histogram rendering threshold

Item.histogram_cumulative

Cumulative histogram

Item.histogram_normalized

Normalize histogram

Item.histogram_bin_size

Histogram bin size

Item.bar_gap

Bar charts bar gap

Item.width

Chart width

Item.height

Chart height

Item.show_legend

Show legend

Item.legend_position

Position the legend

Item.show_legend_border

Show legend border

Item.show_border

Show plot border

Item.plot_margins

Plot margins

Item.plot_title

Plot title

Item.plot_xaxis_type

X axis style

Item.plot_yaxis_type

Y axis style

Item.plot_zaxis_type

Z axis style

Item.xrange

X axis range

Item.yrange

Y axis range

Item.zrange

Z axis range

Item.xaxis_format

X axis text format

Item.yaxis_format

Y axis text format

Item.zaxis_format

Z axis text format

Item.xtitle

X axis title

Item.ytitle

Y axis title

Item.ztitle

Z axis title

Item.xaxis_tick_delta

X axis tick delta

Item.yaxis_tick_delta

Y axis tick delta

Item.zaxis_tick_delta

Z axis tick delta

Item.item_justification

Table item justification

Item.nan_display

NaN table display value

Item.table_sort

Table sorting

Item.table_title

Table title

Item.align_column

Column value alignment

Item.table_search

Search values

Item.table_page

Table paging

Item.table_pagemenu

Table paging menu

Item.table_scrollx

Horizontal scrolling

Item.table_scrolly

Vertical scrolling

Item.table_bordered

Table bordering

Item.table_condensed

Table compactness

Item.table_wrap_content

Table content wrapping

Item.table_default_col_labels

Default column labels

Item.table_cond_format

Table conditional formatting

Item.row_tags

List of tags for each table row

Item.col_tags

List of tags for each table column

add_tag(tag: str = '', value: str = '') bool#

Add a tag to the item.

Parameters:
tagstr, optional

Tag name. The default is "".

value strstr, optional

Tag value. The default is "".

Returns:
bool

True when successful, False when failed.

Examples

import ansys.dynamicreporting.core as adr
adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v232')
ret = adr_service.connect()
my_txt = adr_service.create_item()
my_txt.item_text = '<h1>The test</h1>This is a text item'
my_txt.add_tag(tag='tagone', value='one')
align_column#

Column value alignment

Alignment of data values in each column left right center justify

bar_gap#

Bar charts bar gap

The bar gap of the bar chart float type. Range: 0 1

bar_mode#

Bar chart Histogram config mode

group=separate the barsbins stack=stack the barsbins overlay=overlay the barbins

col_tags#

List of tags for each table column

column_maximum#

Column range maximums

Scalar value or array of values used as column category maximums.

column_minimum#

Column range minimums

Scalar value or array of values used as column category minimums.

format#

Number format

scientific sigfigsX floatdotX str date_XY

format_column#

Column labels format

format for column labels scientific sigfigsX floatdotX str date_XY

format_row#

Row labels format

format for row labels scientific sigfigsX floatdotX str date_XY

get_iframe(width=0, height=0)#

Get the iframe object corresponding to the item.

Parameters:
widthint, optional

Width of the iframe object. The default is min(Item width * 1,1, 1000). For example, if the item width is 0, the default is 1000.

heightint, optional

Height of the iframe object. The default is min(Item height, fixed height), where the fixed height is 800 for an item scene and 400 otherwise.

Returns:
iframe

iframe object corresponding to the item. If no iframe can be generated, None is returned.

Examples

import ansys.dynamicreporting.core as adr
adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v232')
ret = adr_service.connect(url='http://localhost:8010')
my_txt = adr_service.create_item()
my_txt.item_text = '<h1>The test</h1>This is a text item'
item_iframe = my_txt.get_iframe()
get_tags() str#

Get the tags on the item.

Returns:
str

Tags on the item.

Examples

import ansys.dynamicreporting.core as adr
adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v232')
ret = adr_service.connect()
item_list = adr_service.query()
first_item = item_list[0]
all_tags = first_item.get_tags()
height#

Chart height

Chart height in pixels

histogram_bin_size#

Histogram bin size

The bin size of the histogram. Accepts positive integer or float types

histogram_cumulative#

Cumulative histogram

Set to 1 to cumulate the histograms. Default: 0

histogram_normalized#

Normalize histogram

Set to 1 to normalize the histograms. Default: 0

histogram_threshold#

Histogram rendering threshold

The threshold for data table columns to render as histogram. Default: 50

item_animation#

Animation file (MP4/H.264 format files)

item_image#

Image object (Image and PNG binary files)

item_justification#

Table item justification

left center or right. By default there will be no justification.

item_scene#

3D scene (AVZ, PLY, SCDOC, SCDOCX, GLB, and STL files)

item_table#

Table values (Must be in a numpy array)

item_text#

Text (HTML and LaTeX formatting)

labels_column#

Column labels

column A column B

labels_row#

Row labels

row 1 row 2

legend_position#

Position the legend

Position the legend relative to plot bounds 0 1. Example on right: 1.2 0.5

line_color#

Linebarhistogrampiemarker colors

#rrggbb #rgb @rownamenumber hexadecimal digits: #8b783f

line_error_bars#

Error bars

Scalar value or name of a row with size of error bars in Y axis units. May be a list.

line_marker#

Markers

circle square cross x triangle star diamond hash plus times open dot

line_marker_aux0#

Auxiliary data 0

Scalar value or name of a row accessible to line_marker_text as vaux0. May be a list.

line_marker_aux1#

Auxiliary data 1

Scalar value or name of a row accessible to line_marker_text as vaux1. May be a list.

line_marker_aux2#

Auxiliary data 2

Scalar value or name of a row accessible to line_marker_text as vaux2. May be a list.

line_marker_aux3#

Auxiliary data 3

Scalar value or name of a row accessible to line_marker_text as vaux3. May be a list.

line_marker_aux4#

Auxiliary data 4

Scalar value or name of a row accessible to line_marker_text as vaux4. May be a list.

line_marker_aux5#

Auxiliary data 5

Scalar value or name of a row accessible to line_marker_text as vaux5. May be a list.

line_marker_aux6#

Auxiliary data 6

Scalar value or name of a row accessible to line_marker_text as vaux6. May be a list.

line_marker_aux7#

Auxiliary data 7

Scalar value or name of a row accessible to line_marker_text as vaux7. May be a list.

line_marker_aux8#

Auxiliary data 8

Scalar value or name of a row accessible to line_marker_text as vaux8. May be a list.

line_marker_aux9#

Auxiliary data 9

Scalar value or name of a row accessible to line_marker_text as vaux9. May be a list.

line_marker_opacity#

Marker opacity

The opacity of the line marker. Default: 1.0

line_marker_scale#

Marker scaling

Apply a linear transform to marker sizes M B = Minput_sizeB. Example: 1. 0.

line_marker_size#

Marker size

The marker size in points

line_marker_text#

Marker text

Value={{vx}} Position={{vy}}

line_style#

Line styling

none solid dot dash longdash dashdot longdashdot

line_width#

Line width

The line width in pixels

marker_text_rowname#

Marker text row name

Should the row name be appended to the marker text: 0|1|undefined

nan_display#

NaN table display value

The string to be displayed for a NaN value. Default: NaN

palette#

Color palette

The name of the color palette to use with line_color row data. =invert. Example: Hot

palette_position#

Position of the colorbar

Position the colorbar center relative to plot bounds 0 1. Example on left: 0.2 0.5

palette_range#

Range of the colorbar

Minimum and maximum line_color values mapped to palette extremes. Example: 0 100

palette_show#

Colorbar display

Showhide the colorbar with the values 10. Example: 1

palette_title#

Colorbar title string

String draw to the right of the colorbar as a title. Default: none

plot#

Table display style

table bar line pie heatmap parallel sankey 3d surface polar

plot_margins#

Plot margins

Adjust plot margin sizes in pixels: left top right bottom Example: default default 5 default

plot_title#

Plot title

The title of the plot

plot_xaxis_type#

X axis style

linear log

plot_yaxis_type#

Y axis style

linear log

plot_zaxis_type#

Z axis style

linear log

rem_tag(tag: str = '') bool#

Remove a tag on the item.

Parameters:
tagstr, optional

Tag to remove. The default is "".

Returns:
bool

True when successful, False when failed.

Examples

import ansys.dynamicreporting.core as adr
adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v232')
ret = adr_service.connect()
item_list = adr_service.query()
first_item = item_list[0]
all_tags = first_item.rem_tags(tag='tagone')
row_tags#

List of tags for each table row

set_tags(tagstring: str = '') bool#

Set tags on the item.

Parameters:
tagstringstr, optional

Tags to set on the item. Separate multiple tags with a space. The tag syntax is tagname=value.

Returns:
bool

True when successful, False when failed.

Examples

import ansys.dynamicreporting.core as adr
adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v232')
ret = adr_service.connect()
my_txt = adr_service.create_item()
my_txt.item_text = '<h1>The test</h1>This is a text item'
my_txt.set_tags("tagone=1 tagtwo=two")
show_border#

Show plot border

Set to 1 to show the plot border. Default: 0

show_legend#

Show legend

Set to 0 to hide the legend. Default: 1

show_legend_border#

Show legend border

Set to 1 to display a border around the legend. Default: 0

stacked#

Bar chart stacking Deprecated

1=stack the bar charts This is a deprecated property please use bar_mode instead.

table_bordered#

Table bordering

Control visibility of table borders. Default: 1

table_cond_format#

Table conditional formatting

Specify conditional formatting rules for table cell formatting.

table_condensed#

Table compactness

Control compactness of table. Default: 0

table_default_col_labels#

Default column labels

Enabledisable default column labels. Default: 1

table_page#

Table paging

Number of rows visible per page. Default: 0 all

table_pagemenu#

Table paging menu

Options for the number of rows per page menu. Default: 10 25 50 100 1

table_scrollx#

Horizontal scrolling

Control visibility of horizontal scrollbar. Default: 1

table_scrolly#

Vertical scrolling

Control visibility and height of vertical scrollbar. Height in points Default: 0

Search values

Visibility of table value search field. Default: 0

table_sort#

Table sorting

Allow column sorting from headers: none all data Default: all

table_title#

Table title

The title of the table

table_wrap_content#

Table content wrapping

Control wrapping of content to the next line inside a table cell. Default: 0

title#

Common title

property url#

URL corresponding to the item

visualize(new_tab: bool | None = False) None#

Render this item only.

Parameters:
new_tabbool, optional

Whether to render the item in a new tab if the current environment is a Jupyter notebook. The default is False, in which case the item is rendered in the current location. If the environment is not a Jupyter notebook, the item is always rendered in a new tab.

Returns:
Item

Rendered item.

Examples

Create a text item and render it in a new tab:

import ansys.dynamicreporting.core as adr
adr_service = adr.Service(ansys_installation = r'C:\Program Files\ANSYS Inc\v232')
ret = adr_service.connect(url='http://localhost:8010')
my_txt = adr_service.create_item()
my_txt.item_text = '<h1>The test</h1>This is a text item'
my_txt.visualize(new_tab = True)
width#

Chart width

Chart width in pixels

xaxis#

X axis rows

The row numbersnames to use as the X axis values. Example: 2 Distance

xaxis_format#

X axis text format

Format for the x axis tick labels. Example: floatdot2

xaxis_tick_delta#

X axis tick delta

The delta between xradial axis ticks

xrange#

X axis range

The range for the x axis. Example: 0. 10.

xtitle#

X axis title

A title for the x axis

yaxis#

Y axis rows

The row numbersnames to use as the Y axis values. Example: 0 Pressure

yaxis_format#

Y axis text format

Format for the y axis tick labels. Example: floatdot2

yaxis_tick_delta#

Y axis tick delta

The delta between yangular axis ticks

yrange#

Y axis range

The range for the y axis. Example: 0. 10.

ytitle#

Y axis title

A title for the y axis

zaxis#

Z axis rows

The row numbersnames to use as the Z axis values. Example: 3 Pressure

zaxis_format#

Z axis text format

Format for the z axis tick labels. Example: floatdot2

zaxis_tick_delta#

Z axis tick delta

The delta between z axis ticks

zrange#

Z axis range

The range for the z axis. Example: 0. 10.

ztitle#

Z axis title

A title for the z axis