ECharts Function
setOption(options)
is the main function from the Apache ECharts library. You need to call this function to build any chart with Apache ECharts Panel.
This function has the only required options
parameter that you can use to specify the chart configuration in the JSON format.

Options
You need to specify the options
parameter in the Monaco Code editor in the right part of the screen where the Apache ECharts panel resides.

In the Function text area, you can specify the function for chart generation. This function can take different parameters from Grafana. You can find the full list of parameters in the following table.
The options
parameter is the only parameter that is passed from this function to the setOption()
function. In the screenshot above, see the return
statement that specifies the look of the chart.
Parameters
Parameter | Description |
---|---|
data | Object containing a time range, series, and request information. |
echarts | ECharts library. |
echartsInstance | Instance of the ECharts library. See the example in the screenshot above. |
ecStat | A statistical and data mining tool for Apache ECharts. |
eventBus | Publish and subscribe to application events. |
locationService | Works with browser location and history. |
notifyError(['Header', 'Error Message']) | Display error notifications. |
notifySuccess(['Header', 'Message']) | Display success notifications. |
replaceVariables | Function to interpolate variables. |
theme | Theme object. |
To inspect the used parameters, use the browser's developer console.
console.error(
data,
theme,
echartsInstance,
echarts,
replaceVariables,
locationService
);
Notifications
You can display success and error notifications when handling specific events.
notifySuccess(["Update", "Values updated successfully."]);
notifyError(["Update", `An error occurred while updating values.`]);