ChartAxis Object Members for SuiteScript Customization
The ChartAxis object allows customization of workbook charts in SuiteScript, enhancing data visualization capabilities.
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 Name | Type | Description | Supported Script Types |
|---|---|---|---|
ChartAxis.title | string | Specifies the title of the chart axis | Server 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:
1// Create a ChartAxis with a title2var myChartAxis = workbook.createChartAxis({3 title: 'My ChartAxis'4});5 6// Load a workbook and retrieve the chart axis title7var myWorkbook = workbook.load({8 id: myWorkbookId9});10var myCategoryChartAxis = myWorkbook.charts[0].category.axis;11 12log.audit({13 title: 'Category ChartAxis title = ',14 details: myCategoryChartAxis.title15});16 17var myLegendChartAxis = myWorkbook.charts[0].legend.axes[0];18 19log.audit({20 title: 'Legend ChartAxis title = ',21 details: myLegendChartAxis.title22});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
ChartAxisobject is crucial for defining chart axes in SuiteScript. - Use the
titleproperty 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?
What script types support the 'ChartAxis.title' property?
What error might I encounter if I provide a non-string value to the ChartAxis.title property?
How do I retrieve the title of an existing chart axis in a loaded workbook?
Was this article helpful?
More in Platform
- Style Object Members for Workbook API in NetSuite
The Style object provides customizable properties for workbook formatting in NetSuite, enhancing report and visualization functionality.
- Asynchronous HTTP Requests with SuiteScript Promises
Use SuiteScript to send asynchronous HTTP requests with promises for efficient error handling and response processing.
- Setting Sublist Field Values in SuiteScript
Set values for sublist fields in SuiteScript using the setSublistValue method. Understand required parameters and error handling.
- In This Help Topic
Explore N/log module guidelines, log levels, and script execution logs for efficient logging in SuiteScript.
Advertising
Reach Platform Professionals
Put your product in front of NetSuite experts who work with Platform every day.
Sponsor This Category