简体   繁体   English

ORACLE APEX 18 JET图表动态系列

[英]ORACLE APEX 18 JET Chart Dynamic Series

I was using AnyChart for all my chart in Apex 5. Now that I upgraded to 18.2, AnyChart is now "legacy". 我在Apex 5中为所有图表使用AnyChart。现在,我升级到18.2,AnyChart现在是“旧版”。 So, I wanted to update my chart to use JET Chart. 因此,我想更新图表以使用JET图表。

My chart used "PL/SQL Function Body returning SQL Query". 我的图表使用“返回SQL查询的PL / SQL函数体”。 My PL/SQL Function body build my query dynamicaly and my number of series displayed may varied. 我的PL / SQL函数主体动态地建立了我的查询,并且显示的序列数可能有所不同。 As I don't know how many series I will have, I'm not able to set my series in my chart. 我不知道会有多少个系列,因此无法在图表中设置系列。

Here's my PL/SQL Function Body: 这是我的PL / SQL函数体:

DECLARE
  l_selected  APEX_APPLICATION_GLOBAL.VC_ARR2;
  l_sql       VARCHAR2(4000) := '';
BEGIN
  --
  -- Convert the colon separated string of values into a PL/SQL array 
  l_sql := l_sql || 'SELECT NULL       link  ';
  l_sql := l_sql || '      ,year_month label ';
  l_selected := APEX_UTIL.STRING_TO_TABLE(:P16_SELECT_LIST);
  --
  -- Loop over array to insert department numbers and sysdate
  IF l_selected.count = 0 THEN
    l_sql := l_sql || '      ,NULL "no data" ';
  ELSE
    FOR i IN 1..l_selected.count LOOP
      l_sql := l_sql || ',MIN(DECODE(sqn, '''||l_selected(i)||''', srt_cnt, NULL)) "'||l_selected(i)|| CASE WHEN REGEXP_LIKE(TRIM(l_selected(i)), '^[[:digit:]]') THEN ' Sqn' ELSE NULL END||'"';
    END LOOP;
  END IF;
  l_sql := l_sql || '  FROM flight_and_mmh t ';
  l_sql := l_sql || ' WHERE snapshot_fk = :P27_SNAPSHOT_LIST ';
  l_sql := l_sql || '   AND INSTR('':'' || :P16_SELECT_LIST || '':'' , '':'' || sqn || '':'') > 0 ';
  l_sql := l_sql || ' GROUP BY t.year_month ';
  l_sql := l_sql || ' ORDER BY t.year_month ';
  RETURN l_sql;
END;

Column Mapping of my serie 我的系列的列映射

Theres no need to use dynamic sql for multiple series in apex nowadays. 如今,无需在顶点中对多个系列使用动态sql。

  1. In the series region select: series => Source => Region Source 在系列区域中选择:series => Source => Region Source

  2. Then put your sql query in the main region source code. 然后将您的sql查询放入主区域源代码中。

  3. Back in the series => Column Maping, u need to choose the VALUE , the LABEL and the SERIES NAME with the respective columns of your query. 回到系列=>列映射中,您需要选择VALUELABELSERIES NAME以及查询的相应列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM