Pie Chart with Data Labels

21 views
Skip to first unread message

Greg

unread,
May 13, 2010, 2:34:52 PM5/13/10
to Entrance
I am working with a very large database that has responses from over
200 people who took a survey. I have two questions about how to
create the pie charts:
1. I am creating a pie chart from a survey. I made the
pievalues with count() and pielabels with the column name using a
group by. Is it possible to also have the labels show the count. For
example the label would say Yes(35) or No (65).

2. Is it possible to create multiple graphs in one easy step?
We have 80 questions that are all answered 1, 2, 3, or 4. All of the
columns are call Q1, Q2, etc. Is there any quick tricks to make all
the charts?

--
You received this message because you are subscribed to the Google Groups "Entrance" group.
To post to this group, send email to dbent...@googlegroups.com.
To unsubscribe from this group, send email to dbentrance+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dbentrance?hl=en.

Tod Landis

unread,
May 13, 2010, 3:18:41 PM5/13/10
to Entrance

> 1.       I am creating a pie chart from a survey.  I made the
> pievalues with count() and pielabels with the column name using a
> group by.  Is it possible to also have the labels show the count.  For
> example the label would say Yes(35) or No (65).
>

Use concat to make the labels:

plot piechart
pielabels, pievalues
select
concat(category, '(', count(*), ')'), count(*)
from myTable
group by category;


> 2.       Is it possible to create multiple graphs in one easy step?
> We have 80 questions that are all answered 1, 2, 3, or 4.  All of the
> columns are call Q1, Q2, etc.  Is there any quick tricks to make all
> the charts?

If I understand you correctly, you want to use the same chart setup
info to make 80 charts. That's enough that you will want to generate
PLOT
statements using another language. In Java, it would be something
like this:

for(i=0; i <= 80; i++) {
System.out.println(
"plot piechart\n" +
" pielabels, pievalues\n" +
"select \n" +
" category, count(*) from mytable\n"+
" where grade = " + i + ";"
}

Bash, php, perl etc. will all work too.

Route the output into a file, and run the result from
the desktop or command line to debug it. Then you have
a reusable script.

Interesting question: Would it be this simple in Excel?
- Tod

Greg

unread,
May 20, 2010, 3:34:27 PM5/20/10
to Entrance
Thanks Tod. I finally got a chance to try this, however when I run
the SQL I get this error:

SQL error near "'for(i=0' at line 1"

any suggestions how to resolve that?

Tod Landis

unread,
May 21, 2010, 3:00:39 PM5/21/10
to Entrance
Sorry, I should have been clearer: You would run
that Java outside Entrance, using a development tool
like Eclipse or NetBeans. Groovy is worth a look, too.

Entrance runs SQL, PLOT and REPORT scripts only.

Next week I'll put together an example showing how
to make "galleys' of charts that may be what you
want. More to come...
- Tod

...

Greg

unread,
May 25, 2010, 11:24:13 AM5/25/10
to Entrance
Oh, I under stand now. I was able to make it work. Thank you very
much for your help.
Reply all
Reply to author
Forward
0 new messages