Successfully!

Error!

Line chart highlight series value comparison

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

    1. Problem

    How to compare the two series of line chart and mark the nodes that meet certain conditions?

    For example, when the sales volume in Shanghai is higher than that in Beijing, highlight the mark, as shown in the following figure:

    image.png


    2. Solution

    Use SQL to find the points that meet the conditions, and use the special effects  > Conditional display to achieve the effect.

    II. Example

    1. Design template

    1) Create a data query ds1, as the chart data source, the SQL statement is as follows:

    SELECT time,city,sum(sales) as sales 
    FROM sale
    where city in ('Shanghai','Beijing')
    and time<='2017-01-07'
    group by time,city

    image (1).png

    2) Merge cells A1 to H15 and insert a line chart, as shown in the figure below:

    image (2).png

    3) Bind chart data, as shown in the figure below:

    image (3).png

    4) Create a data query ds2 to find out the date when the sales volume in Shanghai is higher than that in Beijing. The SQL statement is as follows:

    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
    )

    image (4).png

    5) Add a marker point in the chart special effects> conditional display .

    When the series name is equal to Shanghai (string type) and the category name is in ds2.time (data column type), set the marker point to a circle and the color to be red, as shown in the following figure:

    image (5).png


    2. Effect preview

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

    image (6).png

    III. Template download

    The completed template can refer to: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc_EN\Chart\LineChart\LineChart_CompareSeries.cpt

    Click to download the template: 

    LineChart_CompareSeries.cpt


    Attachment List


    Theme: Chart
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback