データグラフ化(プロセスバー/レベル)

  • 作成者:ayuan0625
  • 編集回数:26次
  • 最終更新:FRInternational 于 2021-04-14
  • I. Overview

    1. Expected effect

    In the report, in order to analyze the data and see the trend and bottleneck of the data, the statistical graph is often used to display the data, because the graphical method is more intuitive than the numerical method.

    For example, the sales volume of each salesperson, the user evaluation level, etc., it is hoped that a progress bar or other graphic signs will be displayed directly in the cell to indicate the data or level, as shown in the following figure:

    1) Special symbols

    1.png

    2) Progress bar

    2.png


    2. Realization ideas

    There are two ways to achieve the above effects:

    1) Realized by plugin, please refer to: Cell progress bar plugin for details

    2) Through HTML implementation, this article will introduce this production method in detail.

    II. Example 1: Display data with special characters

    1. Create report

    Create a new normal report, create a new built-in dataset ds1, as shown in the following table:

    3.png


    2. Design report

    The report body style, as shown in the figure below:

    4.png

    The specific settings of data columns and cells are shown in the following table:

    CellInsert elementContentFont color
    A3Data columnds1.NameBlack
    B3Data columnds1.Professional scoreBlack
    C3Formula=repeat("|",B3*2)Blue
    D3Data columnds1.Performance scoreBlack
    E3Formula=repeat("|",D3*2)Green
    F3Formula=(B3+D3)/2Black
    G3Formula=repeat("★",F3)Red
    Note: =repeat("★", F3): If the value of F3 is 3, the asterisk will be displayed 3 times.

             For the specific usage of the Repeat function, please refer to: Repeat function


    3. Effect preview

    Save the template, clickpagination preview, the effect is as shown in the figure below:

    5.png

    III. Example 2: Progress bar displays data

    1. Create report

    Create a new normal report, create a new built-in dataset ds1, as shown in the following table:

    6.png


    2. Design report

    The report body style, as shown in the figure below:

    7.png

    In cell C7, enter the formula:

    "<table width=" + ROUND(B7 * 200 / sum(B7[!0;!0]), 2) + "% border=0 cellspacing=0 cellpadding=0> <tr> <td bgcolor=#0000FF><div color=#ffffff align=right>" + B7 + "</div></td> </tr> </table>"

    The definition of the formula is shown in the following table:

    CodeDefinition
    "<table width=" + ROUND(B7 * 200 / sum(B7[!0;!0]), 2) Set width
    border=0The border width is 0, which means no border
    cellspacing=0Cell spacing is set to 0
    cellpadding=0The distance between the content of the cell and the border is 0
    bgcolor=#00E3E3Set the background color of the cell to #00E3E3
    color=#ffffffSet the content color of the cell to #ffffff
    align=rightSet the content position of the cell to the right

    Note: The length of the progress bar is determined by the width, and the calculation of the width is a value that needs to be observed (such as: the proportion of a person's value in the entire staff or a certain attribute value of a person) multiplied or divided by one The ratio, such as 200 in the example. Similar effects can be achieved by using ROUND(B7 * 200, 2) or B7 * 200 in this example.


    3. Set cell attributes

    1) Select cell C7, click Cell Attributes> Style> Alignment, and set the Text Style to Single Line(Adjust Font), as shown in the figure below:

    8.png

    2) Select cell C7, click Cell Attributes> Other, and set Display Content to Display by HTML, as shown in the following figure:

    9.png


    4. Effect preview

    Save the template, click pagination preview, the effect is as shown in the figure below:

    10.png

    IV. Template download

    Refer to the completed template%FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\BasicApplication\bar.cpt

    Click to download: 

    bar.cpt


    Attachment List


    Theme: FineReport 帳票実例
    既に最初
    既に最後
    • Helpful
    • Not helpful
    • Only read