Skip to main content

Mechanical scripting interface 2026 R1

`Chart`

Last update: 09.03.2026

class Ansys.Mechanical.DataModel.Utilities.Charts.Chart

Bases: object

Chart is an object utilized by the Line Chart object to display charts and customize them with the flexibility to allow modification to the data of the chart to a certain extent.

Overview

Methods

Name Description
AddDataset Adds a dataset to a chart, provided the data is valid.
GetDisplayOptionsForDataset Returns a reference to the dataset display options for a specific dataset.
GetLabelCollectionForDataset Returns a reference to the label collection for a specific dataset.
RemoveDataset Removes a dataset from the chart.

Properties

Name Description
ChartDisplayOptions Returns a reference to the display options of a chart.
Datasets Retrieves all datasets of a chart.
NormalizeYAxis Allows a normalized display of y-axis values, usually for cases where the axis has mixed quantities.
XAxisDisplayOptions Returns a reference to the x-axis display options of a chart.
YAxisDisplayOptions Returns a reference to the y-axis display options of a chart.

Property detail

property Chart.ChartDisplayOptions : Ansys.Mechanical.DataModel.Utilities.Charts.ChartDisplayOptions | None

Returns a reference to the display options of a chart.

property Chart.Datasets : List[Ansys.Mechanical.DataModel.Utilities.Dataset.Dataset2D] | None

Retrieves all datasets of a chart.

property Chart.NormalizeYAxis : bool | None

Allows a normalized display of y-axis values, usually for cases where the axis has mixed quantities. An InvalidOperationException will be thrown if attempting to set to False, when the Y axis datasets have incompatible Quantity types and the UseAutomaticLimits property is also set to False.

property Chart.XAxisDisplayOptions : Ansys.Mechanical.DataModel.Utilities.Charts.AxisDisplayOptions | None

Returns a reference to the x-axis display options of a chart.

property Chart.YAxisDisplayOptions : Ansys.Mechanical.DataModel.Utilities.Charts.AxisDisplayOptions | None

Returns a reference to the y-axis display options of a chart.

Method detail

Chart.AddDataset(dataset: Ansys.Mechanical.DataModel.Utilities.Dataset.Dataset2D, name: str) → None

Adds a dataset to a chart, provided the data is valid.
Adding a name for the dataset is optional, the default name for the nth dataset added is “Series n”.
An InvalidOperationException is thrown if the dataset is either invalid, already added to the chart,
or contains non-positive values when the chart has IsLogarithmic enabled.

Chart.GetDisplayOptionsForDataset(dataset: Ansys.Mechanical.DataModel.Utilities.Dataset.Dataset2D) → Ansys.Mechanical.DataModel.Utilities.Charts.Dataset2DDisplayOptions

Returns a reference to the dataset display options for a specific dataset.

Chart.GetLabelCollectionForDataset(dataset: Ansys.Mechanical.DataModel.Utilities.Dataset.Dataset2D) → Ansys.Mechanical.DataModel.Utilities.Charts.LabelCollection

Returns a reference to the label collection for a specific dataset.

Chart.RemoveDataset(dataset: Ansys.Mechanical.DataModel.Utilities.Dataset.Dataset2D) → None

Removes a dataset from the chart.

Connect with Ansys