Legend Object Members for SuiteScript Workbook Integration
Understand the properties of the Legend object in SuiteScript for workbooks, including axes and sort definitions.
The Legend object in SuiteScript provides several members that are essential for charting within workbooks. These members allow developers to manage chart axes, data dimensions, and sort definitions, enhancing visual data representation and analysis.
What Members Does the Legend Object Include?
The Legend object provides the following key members:
| Member Name | Type | Supported Script Types | Description |
|---|---|---|---|
Legend.axes | workbook.ChartAxis[] | Server scripts | Represents the axes of the legend. |
Legend.root | workbook.DataDimension | workbook.Section | Server scripts | Refers to the section or data dimension for the Y-axis. |
Legend.sortDefinitions | workbook.SortDefinition[] | Server scripts | Contains the sort definitions associated with the legend. |
Error Handling
When working with properties of the Legend object, be aware of potential errors:
- Error Code:
WRONG_PARAMETER_TYPE- Thrown If: The value specified for a property is not a valid
workbook.ChartAxis.
- Thrown If: The value specified for a property is not a valid
Code Sample
Below is an example to demonstrate how you might access the Legend.axes member of a workbook:
1// Add additional code2...3// View Legend.axes in a Chart4var myWorkbook = workbook.load({5 id: myWorkbookId6});7 8log.audit({9 title: 'Legend.axes = ',10 details: myWorkbook.charts[0].legend.axes11});12...13// Add additional codeThis example illustrates the syntax to access and log the legend axes of a chart within a workbook, enhancing your ability to customize data visualizations in NetSuite.
Additional Context
For more detailed implementations, consider referring to the N/workbook Module, where further examples and complete scripts are available.
Related Resources
- [N/workbook Module]: This module includes additional properties and methods related to workbook functionalities in SuiteScript.
- [SuiteScript 2.x Script Types]: An overview of various script types supported in SuiteScript, critical for understanding the context of the Legend object usage.
Key Takeaways
- The Legend object in SuiteScript provides essential members for charts.
- Key members include axes, root dimensions, and sort definitions.
- Proper error handling is crucial when dealing with object properties.
- Accessing Legend properties enhances the customization of data visualizations.
Frequently Asked Questions (4)
Does the Legend object support client scripts in SuiteScript?
What should I be careful of when working with Legend object properties?
Can Legend.axes represent multiple axes in a chart?
Is there an example of how to access the Legend.axes member in a script?
Was this article helpful?
More in SuiteScript
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
