EChart¶
EChart is a powerful component that enables rendering various types of charts using the ECharts library. This component provides advanced charting capabilities with extensive customization options.
Overview¶
EChart differs from regular charts in CxReports in several ways:
- Advanced Customization: ECharts offers more options and greater control for non-standard charting requirements
- Programming Knowledge Required: Unlike regular charts, ECharts requires programming knowledge to configure
- Theming: While regular charts are better integrated with built-in theming and offer UI for configuration, ECharts can be themed through the Themes > ECharts section
Configuration¶
Data and Parameters¶
To configure your EChart:
- Set up Data Sources to pass data to the chart
- Configure Parameters for additional chart parameters
- Use the Edit Chart Configuration window to write the
option
callback function
Available Variables in Callback¶
Within the callback function, you can use the following variables to build your chart:
$data
: Access data from configured data sources$params
: Access parameters passed to the chart$dict
: Access dictionary values$theme
: Access theme settings$it
: Access iteration context$files
: Access uploaded files
File Support¶
You can enhance your charts by adding files:
- SVG Files: Passed as strings suitable for registering maps
- JSON Files: Can be used as data, geoJSON, or any other JSON-based configuration
Best Practices¶
When working with ECharts, it's important to consider the specific requirements of your visualization. For simple, theme-integrated visualizations, regular charts are often the better choice as they provide a more straightforward configuration process. However, when you need advanced customization or non-standard chart types, ECharts becomes the preferred option.
To maintain consistency across your visualizations, make use of the theme settings available in Themes > ECharts. The callback function is particularly powerful for creating dynamic charts that respond to your data and parameters, allowing for sophisticated and interactive visualizations.