Method Signature
Description
ThegetOption() method returns the current option object of the chart. This is useful for retrieving the current state of the chart configuration, including any modifications made through user interactions or programmatic updates.
Parameters
This method takes no parameters.Return Value
The complete current chart option object, including all configurations for series, axes, components, and other settings.
Examples
Basic Usage
Modifying and Reapplying Options
Saving Chart State
Inspecting Series Data
Conditional Updates Based on Current State
Debugging Chart Configuration
Important Notes
The returned option object is the processed and merged result of all
setOption calls. It may differ from the original options you passed to setOption due to:- Default values being applied
- Option normalization
- Dynamic calculations
- User interactions (if interactive features are enabled)
The
getOption() method returns the option managed by the chart’s internal model. This means it reflects the current state after all transformations, defaults, and preprocessing have been applied.Use Cases
- State Management - Save and restore chart configurations
- Configuration Inspection - Debug or validate chart settings
- Incremental Updates - Retrieve current state before making targeted changes
- Data Export - Export chart configuration for later use
- Feature Detection - Check which features are currently enabled
- User Preferences - Store user customizations
Related Methods
- setOption() - Configure chart options and update the visualization
- resize() - Resize the chart
- ECharts Instance - Instance methods including clear()
Source Reference
Implementation:src/core/echarts.ts:799-801