stacked bar chart

(2 posts) (2 voices)

Tags:

No tags yet.

  1. ken@pesttrend.com, Member

    Having a problem trying to setup a stacked bar chart.

    My source data is:
    SELECT
    groupname,
    SUM(groupopenactions) AS groupopenactions,
    SUM(notservicedinyear) AS notservicedinyear,
    SUM(stationsnotactive) AS stationsnotactive,
    SUM(highriskstations) AS highriskstations
    FROM
    .....BIG LONG QUERY

    I know for a Multi series the syntax is

    select Series (x), Category (label), Value (y)
    from

    but I cannot find example which would show a stacked chart where my
    series = groupname and the stack beside it would show the total of all the sums and each segment labeled

    groupname1 |groupopenactions value|notservicedinyear value|stationsnotactive value|highriskstations value|

    Can you point me to any examples of this type please.

    Regards
    Ken

  2. myDBR Team, Key Master

    Convert the data to the format used by the dbr.chart-command.

    create temporary table tmp_data
    as
    create temporary table tmp_data
    SELECT
    groupname,
    SUM(groupopenactions) AS groupopenactions,
    SUM(notservicedinyear) AS notservicedinyear,
    SUM(stationsnotactive) AS stationsnotactive,
    SUM(highriskstations) AS highriskstations
    FROM
    .....BIG LONG QUERY SELECT 'dbr.chart', 'stackedbar'; select groupname, 'groupopenactions', groupopenactions from tmp_data
    union
    select groupname, 'notservicedinyear', notservicedinyear from tmp_data
    union
    select groupname, 'stationsnotactive', stationsnotactive from tmp_data
    union
    select groupname, 'highriskstations', highriskstations from tmp_data
    ;

    --
    myDRR Team


Reply

You must log in to post.