ChartAxis Object Members for SuiteScript Customization

The ChartAxis object allows customization of workbook charts in SuiteScript, enhancing data visualization capabilities.

·2 min read·View Oracle Docs

The ChartAxis object is essential for creating and manipulating chart axes in a workbook within NetSuite's SuiteScript environment. This article outlines the members of the ChartAxis object, highlighting its key property, and providing code samples to illustrate its usage.

What is the ChartAxis Object?

The ChartAxis object is used to define either category or legend axes in charts created via SuiteScript. It plays a vital role in enhancing data visualization in reports and dashboards. To create an instance of this object, utilize the workbook.createChartAxis(options) method.

ChartAxis Members

The ChartAxis object includes the following members:

Member NameTypeDescriptionSupported Script Types
ChartAxis.titlestringSpecifies the title of the chart axisServer scripts

Using the ChartAxis Title Property

The title property of the ChartAxis object is a string that defines what is displayed as the title for the axis. This property is crucial for providing context and meaning to the data represented in your charts.

Syntax for ChartAxis Title

The example below demonstrates how to create a ChartAxis and set the title property:

suitescript
1// Create a ChartAxis with a title
2var myChartAxis = workbook.createChartAxis({
3 title: 'My ChartAxis'
4});
5
6// Load a workbook and retrieve the chart axis title
7var myWorkbook = workbook.load({
8 id: myWorkbookId
9});
10var myCategoryChartAxis = myWorkbook.charts[0].category.axis;
11
12log.audit({
13 title: 'Category ChartAxis title = ',
14 details: myCategoryChartAxis.title
15});
16
17var myLegendChartAxis = myWorkbook.charts[0].legend.axes[0];
18
19log.audit({
20 title: 'Legend ChartAxis title = ',
21 details: myLegendChartAxis.title
22});

Error Handling

When using the ChartAxis.title property, ensure that the value provided is a string. An invalid type will result in an error code:

  • Error Code: WRONG_PARAMETER_TYPE
  • Thrown If: The value for this property is not a string.

Best Practices

  • Always check for data type correctness when setting properties to avoid runtime errors.
  • Use descriptive titles for chart axes to enhance user understanding of chart data.

Who This Affects

This information is particularly useful for:

  • Developers: Customizing chart functionality in SuiteScript.
  • Administrators: Managing and setting up reporting tools that leverage charting.

Key Takeaways

  • The ChartAxis object is crucial for defining chart axes in SuiteScript.
  • Use the title property to enhance the interpretability of charts.
  • Ensure correct data types are used to avoid errors during execution.

Source: This article is based on Oracle's official NetSuite documentation.

Frequently Asked Questions (4)

How can I create a ChartAxis in SuiteScript for my workbook chart?
Use the `workbook.createChartAxis(options)` method to create an instance of the ChartAxis object. This allows you to define axes, setting properties like the title for further customization.
What script types support the 'ChartAxis.title' property?
The 'ChartAxis.title' property is supported in server scripts only within the SuiteScript environment.
What error might I encounter if I provide a non-string value to the ChartAxis.title property?
If a non-string value is provided to the 'ChartAxis.title' property, the error code 'WRONG_PARAMETER_TYPE' will be thrown, indicating an incorrect data type was used.
How do I retrieve the title of an existing chart axis in a loaded workbook?
After loading a workbook, access the chart axis title using code such as `myWorkbook.charts[0].category.axis.title` to retrieve the title for the category axis.
Source: ChartAxis Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in Platform

View all Platform articles →