Item#
- class ansys.dynamicreporting.core.Item(service: ADR = None, obj_name: str | None = 'default', source: str | None = 'ADR')#
Bases:
objectProvides 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_txtas 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:
- service
ansys.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_name
str,optional Name of the item object in the database. The default is
default.- source
str,optional Name of the source for the item in the database. The default is
"ADR".
- service
Examples
Initialize the
Serviceclass 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.
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
URL corresponding to the item
Text (HTML and LaTeX formatting)
Image object (Image and PNG binary files)
3D scene (AVZ, PLY, SCDOC, SCDOCX, GLB, and STL files)
Animation file (MP4/H.264 format files)
Table values (Must be in a numpy array)
Number format
Column labels format
Column labels
Row labels format
Row labels
Table display style
Common title
Linebarhistogrampiemarker colors
Markers
Marker text
Marker text row name
Marker size
Marker opacity
Marker scaling
Error bars
Auxiliary data 0
Auxiliary data 1
Auxiliary data 2
Auxiliary data 3
Auxiliary data 4
Auxiliary data 5
Auxiliary data 6
Auxiliary data 7
Auxiliary data 8
Auxiliary data 9
Column range minimums
Column range maximums
Line styling
Line width
Bar chart stacking Deprecated
Bar chart Histogram config mode
X axis rows
Y axis rows
Z axis rows
Color palette
Position of the colorbar
Range of the colorbar
Colorbar display
Colorbar title string
Histogram rendering threshold
Cumulative histogram
Normalize histogram
Histogram bin size
Bar charts bar gap
Chart width
Chart height
Show legend
Position the legend
Show legend border
Show plot border
Plot margins
Plot title
X axis style
Y axis style
Z axis style
X axis range
Y axis range
Z axis range
X axis text format
Y axis text format
Z axis text format
X axis title
Y axis title
Z axis title
X axis tick delta
Y axis tick delta
Z axis tick delta
Table item justification
NaN table display value
Table sorting
Table title
Column value alignment
Search values
Table paging
Table paging menu
Horizontal scrolling
Vertical scrolling
Table bordering
Table compactness
Table content wrapping
Default column labels
Table conditional formatting
List of tags for each table row
List of tags for each table column
- add_tag(tag: str = '', value: str = '') bool#
Add a tag to the item.
- Parameters:
- Returns:
- bool
Truewhen successful,Falsewhen 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:
- width
int,optional Width of the iframe object. The default is
min(Item width * 1,1, 1000). For example, if the item width is0, the default is1000.- height
int,optional Height of the iframe object. The default is
min(Item height, fixed height), where the fixed height is800for an item scene and400otherwise.
- width
- Returns:
iframeiframe object corresponding to the item. If no iframe can be generated,
Noneis 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:
strTags 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:
- tag
str,optional Tag to remove. The default is
"".
- tag
- Returns:
- bool
Truewhen successful,Falsewhen 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:
- tagstring
str,optional Tags to set on the item. Separate multiple tags with a space. The tag syntax is
tagname=value.
- tagstring
- Returns:
- bool
Truewhen successful,Falsewhen 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 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
- table_search#
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.
- new_tabbool,
- Returns:
ItemRendered 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