Successfully!

Error!

Legend Sharing For Pie Charts

  • Last update:  2020-12-30
  • I.Overview

    1. Application scenarios


    Pie chart support each category to generate a pie chart, and these multi-category pie charts share legends, as shown in the following figure:

    1609312343732835.jpg


    2.Implementation


    After adding the chart, set the category field to generate multiple pie charts based on the category.

    Note: This method supports both cell element charts and floating element charts.


    II. Example

    1. Data preparation


    Create a new general report, create a new data set ds1, the database query statement is: SELECT * FROM Sales_Volume

    1609298775616806.png


    2.Table design


    1) Design the cell table as shown in the figure below, and drag the corresponding fields into the cells, where the B2 cell needs to be summary>sum.

    image.png

    2) Double-click cell A2, click Advanced, and set the result set filter to 3, the purpose is to only fetch the data of the first 3 salespersons in the data set, as shown in the figure below:

    1609298879418213.png

    3) Select cells A1 and A2, add a condition attribute, set the row height to 0, the purpose is to hide the content of the table when displayed on the front end, as shown in the following figure:

    1609298919706766.png

    3. Insert chart


    In the designer menu bar, click Insert>Floating Element>Insert Chart to insert the pie chart into the general report, as shown in the figure below:

    1609298959790285.png

    4. Binding data


    Select the pie chart and set the pie chart category name to cell A2, the series name to cell B1, and the value to cell B2, as shown in the following figure:

    image.png


    5. Effect preview


    1) PC terminal

    Save the report, click the Pagination Preview, the effect is as shown in the figure below:

    1609299016809322.png

    2) Mobile

    The example used is that the floating chart does not support mobile preview, but the cell element chart does.


    6.Application expansion


    If you want to achieve it through the cell element chart, you only need to change the data binding settings based on the above floating element chart settings, as shown in the following figure:

    image.png

    III. Template download

    The completed template can refer to: 

    %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc_EN\Chart\PieChart\Pie_Chart_Legend_sharing.cpt

    Click to download template:

    PieChart_LegendSharing.cpt


    Attachment List


    Theme: Chart
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback