Babbul
Babbul

Reputation: 23

How to Create Dynamic Multi Series Line chart in Oracle-APEX?

I need a line chart that will have dynamic series (lines).

I have a table that have data like this:

Target_Percentage   DEPARTMENT_NAME    REPORT_DATE     USERID
    7.5                    ECONOMICS    11/1/2016      jdavid
    6.5                    ECONOMICS    12/1/2016      jdavid
    3.5                    ECONOMICS    1/1/2017       jdavid
    9.5                    ECONOMICS    2/1/2017       jdavid
    2.5                    ECONOMICS    3/1/2017       jdavid
    7.5                    ECONOMICS    4/1/2017       jdavid
   20.2                    LIBERAL ARTS 11/1/2016      adam
   20.2                    LIBERAL ARTS 12/1/2016      adam
   20.2                    LIBERAL ARTS 1/1/2017       adam
   20.2                    LIBERAL ARTS 2/1/2017       adam
   20.2                    LIBERAL ARTS 3/1/2017       adam
   20.2                    LIBERAL ARTS 4/1/2017       adam
   10.4                    GEOGRAPHY    11/1/2016      jdavid
   10.4                    GEOGRAPHY    12/1/2016      jdavid
   10.4                    GEOGRAPHY    1/1/2017       jdavid
   10.4                    GEOGRAPHY    2/1/2017       jdavid
   10.4                    GEOGRAPHY    3/1/2017       jdavid
   10.4                    GEOGRAPHY    4/1/2017       jdavid
   12.0                    ENGLISH      11/1/2016      adam
   12.0                    ENGLISH      12/1/2016      adam
   12.0                    ENGLISH      1/1/2017       adam
   12.0                    ENGLISH      2/1/2017       adam
   12.0                    ENGLISH      3/1/2017       adam
   12.0                    ENGLISH      4/1/2017       adam
   10.4                    SPORTS       11/1/2016      alan
   10.4                    SPORTS       12/1/2016      alan
   10.4                    SPORTS       1/1/2017       alan
   10.4                    SPORTS       2/1/2017       alan
   10.4                    SPORTS       3/1/2017    alan
   10.4                    SPORTS       4/1/2017    alan

Each user have access to certain dept names and some target percentage for six months. So when jdavid logs in into application he should see two lines 1 for ECONOMICS and 1 for GEOGRAPHY plotting Target_Percentage against each month.

like this:

Sample chart Pic

I need to do this in apex charts only, cannot use c3js and d3js charts no permission to do them.

Upvotes: 2

Views: 4663

Answers (1)

Tony Andrews
Tony Andrews

Reputation: 132570

You can create an APEX chart with a series for each department, each series having a query like this (the series named "Economics"):

select department_name, report_date, target_percentage from t1
 where userid=:APP_USER
   and department_name = 'ECONOMICS'
 order by report_date;

At runtime, only the series that return any data will be displayed giving you a result like: enter image description here

Upvotes: 1

Related Questions