Forum Stats

  • 3,874,265 Users
  • 2,266,717 Discussions
  • 7,911,796 Comments

Discussions

Chart region with percentage complete

SleepDeprivedInSeattle
SleepDeprivedInSeattle Member Posts: 120 Blue Ribbon
edited Mar 19, 2013 3:09PM in APEX Discussions
Using APEX 4.1.0.0.23
Oracle 11g database

I am sure the answer is really easy but I can't seem to figure out how to create this chart region.

I will have a data set which looks like this

USERID VARCHAR(30)
QUESTIONS_CORRECT NUMBER
TOTAL_QUESTIONS NUMBER

Where the data might look like
JONES, A 10 20
FLINTSTONE, F 18 20
RUBBLE, B 6 12

The page the user will be looking at will be for themselves (RUBBLE, B for example).
I want to show a region which shows their percentage correct (50%) on a pie chart - basically a visual reference instead of showing them a number.

So my query would be something like:

Select questions_correct/total_questions from userdata where userid = :P5_USERID

How do I get this represented in a chart region?

Thank you in advance!


--Seattle
Tagged:

Best Answer

  • fac586
    fac586 Senior Technical Architect Member Posts: 21,459 Red Diamond
    edited Mar 19, 2013 3:09PM Answer ✓
    SleepDeprivedInSeattle wrote:
    That is part of it - but how do I turn the percentage into a Flash (or HTML) pie chart which would show the pie chart as being 50% complete. My users are, um, computer-slow and they respond better to pictures than numbers...
    Have you tried creating a chart region?

    Edited by: fac586 on 19-Mar-2013 19:07

    One way of writing the chart series query:
    with test_data as (
      select 'JONES' userid, 10 correct, 20 questions from dual
      union all
      select 'FLINTSTONE', 18, 20 from dual
      union all
      select 'RUBBLE', 6, 12 from dual)
    select
        null link
      , 'Correct' label
      , correct / questions * 100 value
    from
        test_data
    where
        userid = :p2_userid
    union all
    select
        null
      , 'Incorrect'
      , (questions - correct) / questions * 100
    from
        test_data
    where
        userid = :p2_userid
    order by
        label

Answers

  • AquaNX4
    AquaNX4 Member Posts: 761 Silver Badge
    Seattle:

    I have a region with percentages and code is as follows:
    *ROUND(COUNT(TABLE.FIELD1)/TABLE.FIELD2*100,0) "PERCENTAGE"*
    I hope this helps.....
  • SleepDeprivedInSeattle
    SleepDeprivedInSeattle Member Posts: 120 Blue Ribbon
    That is part of it - but how do I turn the percentage into a Flash (or HTML) pie chart which would show the pie chart as being 50% complete. My users are, um, computer-slow and they respond better to pictures than numbers...

    Thank you!
  • fac586
    fac586 Senior Technical Architect Member Posts: 21,459 Red Diamond
    edited Mar 19, 2013 3:09PM Answer ✓
    SleepDeprivedInSeattle wrote:
    That is part of it - but how do I turn the percentage into a Flash (or HTML) pie chart which would show the pie chart as being 50% complete. My users are, um, computer-slow and they respond better to pictures than numbers...
    Have you tried creating a chart region?

    Edited by: fac586 on 19-Mar-2013 19:07

    One way of writing the chart series query:
    with test_data as (
      select 'JONES' userid, 10 correct, 20 questions from dual
      union all
      select 'FLINTSTONE', 18, 20 from dual
      union all
      select 'RUBBLE', 6, 12 from dual)
    select
        null link
      , 'Correct' label
      , correct / questions * 100 value
    from
        test_data
    where
        userid = :p2_userid
    union all
    select
        null
      , 'Incorrect'
      , (questions - correct) / questions * 100
    from
        test_data
    where
        userid = :p2_userid
    order by
        label
This discussion has been closed.