ChartAxis Object Members for SuiteScript Customization
The ChartAxis object enables customization of chart axes in SuiteScript, enhancing data visualization for reports and dashboards.
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.
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 SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
- Enhancements to SuiteScript User Role Context Clarification
SuiteScript updates clarify the user and role contexts for script executions, improving deployment understanding and management.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category