Overview
Problem
The chart legend displays the series name by default, What if you want it to display other content for the legend? For example, display the corresponding sales data behind the series name, as shown in the following figure.
Implementation Method
When binding data to the chart, choose Data > Data Filter > Series, and select Formula Form for Display, as shown in the following figure.
Example
Data Preparation
Choose File > New General Report, create a database query ds1,and enter the SQL statement SELECT * FROM Sales_Volume,as shown in the following figure.
Chart Insertion
Merge required cells. Select the merged cell, click the Insert Chart icon on the upper toolbar, select Pie Chart, and click OK, as shown in the following figure.
Data Binding
Select the chart, and bind data to it, as shown in the following figure.
After data binding, you can save the report and preview the effect. The following figure shows current effect.
Series Form Setting
1. Select Data on the property panel, select Series for Data Filter, and select Formula Form from the drop-down list of Display. Click F(x), and enter the formula:
$$$+ " " + sum(value("ds1",5,4,$$$)).
$$$ refers to current values, and the following formula means to extract the corresponding sales volume of the products from ds1 and sum it up. You can refer to Value function for details.
The following figure shows the steps.
After finishing the setting, preview the report again. The following figure shows the effect.
2. The setting of Series Form takes effect for all series-related settings of the chart, not just the legend. For example, if you tick Series for Label and Prompt, they will show the same formula form.
For example, tick Series for Label and Prompt as shown in the following figure.
The following figure shows the preview effect.
Effect Display
PC
Save the report and click Pagination Preview. The section "Application Scenario" shows the effect.
Mobile Terminal
The report can be previewed on the DataAnalyst APP and HTML5 terminal, as shown in the following figure.
Template Download
For details, you can click to download the template Custom Legend Content.cpt