Series Comparison and Mark Point Setting of Line Charts

  • Last update:January 06, 2025
  • Overview

    Problem

    How to compare two series in a line chart and mark the points satisfying the conditions?

    For example, the mark point is highlighted if the sales of Shanghai it represents is higher than those of Beijing, as shown in the following figure.

    折线图比较1.png

     

    Implementation Method

    Use the SQL statement to find the points that satisfy the conditions, and choose Special Effect > Condition Display to realize the effect.

    Example

    Template Design

    1. Create a database query ds1 as the data source of the chart with the following SQL statement: 

    SELECT time,city,sum(sales) as sales

    FROM sale

    where city in ('Shanghai','Beijing')

    and time<='2017-01-07'

    group by time,city

    折线图比较2.png

    2. Merge cells A1~D18 and insert a line chart as shown in the following figure.

     折线图比较3.png

    3. Bind the data to the chart, as shown in the following figure.

     折线图比较4.png

    4. Create a database query ds2 to filter the dates on which the sales of Shanghai are higher than those of Beijing, with the following SQL statement:

    SELECT time,city,sum(sales) as sales

    FROM sale a

    where city = 'Shanghai'

    and time<='2017-01-07' 

    group by time,city

    having sum(sales)>(select sum(sales) from sale

    where city = 'Beijing' 

    and time= a.time)

    折线图比较5.png

    5. Choose Special Effect > Condition Display, and add Condition Attribute1 for Mark Point.

    If the series name is  Shanghai (string type) and the category name is in the time column in ds2, and set  Type of Mark Point to round and Fill Color to red, as shown in the following figure.

     折线图比较6.png

    Effect Display

    PC

    Save the template and click Pagination Preview. The following figure shows the preview effect.

     折线图比较1.png

    Mobile Terminal

    The report can be previewed on both the DataAnalyst app and the HTML5 terminal. The following figure shows the effect.

     折线图比较7.jpg

    Template Download

    For details, you can download the template Series Comparison and Mark Point Setting of Line Charts.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