Custom Legend Content

  • Last update:December 26, 2024
  • 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.

     zzzzzzz.png

     

    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. 

     自定义图例显示内容2.png

    Example

    Data Preparation

    Choose File > New General Report, create a database query ds1and enter the SQL statement SELECT * FROM Sales_Volumeas shown in the following figure. 

    自定义图例显示内容3.png 

    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. 

     改2.png

    Data Binding

    Select the chart, and bind data to it, as shown in the following figure.

     自定义图例显示内容5.png

    After data binding, you can save the report and preview the effect. The following figure shows current effect.

    自定义图例此时的预览效果.png 

    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.

     自定义图例显示内容6.png

    After finishing the setting, preview the report again. The following figure shows the effect.

     自定义图例 再次预览.png

    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.

    自定义图例显示内容7.png 

    The following figure shows the preview effect.

    自定义图例 三次预览.png

    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.

     自定义图例 移动端预览.jpg

    Template Download

    For details, you can click to download the template Custom Legend Content.cpt


    Attachment List


    Theme: Chart
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy