- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
can anyone help me out with this issue. The labels of my created pie chart overlaps. Is there any way to avoid that in a gchart?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You could try to rearrange the order of your slice in order to avoid the overlapping.
With little amount of slices you can do this manually.
legend1 label=none
shape=bar(4,1.5)
position=(top left)
offset=(5,)
across=4
mode=share;
PROC SQL;
select "'"||strip(var1)||"'" into :vars separated by ' '
from test2
;
quit;
%put &=vars;
proc gchart data=test2 ;
pie var1 / sumvar=var2
other=0
midpoints= 'BBBBBBBBBBBBB' 'GGGGGGGGGGGG' 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII' 'CCCCCCCCCCC' 'DDDDDDDDDDDD' 'HHHHHHHHHHHHH' 'AAAAAAA' 'LLLLLLLLLLLLLLLLL' 'FFFFFFFFFFFFFFF' 'EEEEEEEEEEEEE'
angle=90
value= inside
percent=arrow
slice=none
noheading
coutline=black
legend=legend1;
;
run;
quit;
- Cheers -
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you could try one of the slice-ordering options
ANGLE=degrees |
|
ASCENDING |
|
CLOCKWISE |
|
DESCENDING |
|
JSTYLE |
- Cheers -
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How many slices do you have?
Can you share your code, and output?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@GraphGuy : here is the data and code
legend1 label=none shape=bar(4,1.5) position=(top left) offset=(5,) across=4 mode=share; proc gchart data=test2 ; pie var1 / sumvar=var2 noheading coutline=black other=0 value= inside angle=-20 descending percent= arrow jstyle legend=legend1; run; quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Instead of other=0 (which shows all the slices, no matter how small they are), I recommend using other=1 so that any slice less than 1% is grouped into an 'other' slice.
It is very difficult to place labels on a lot of very small slices, and also difficult for someone viewing a pie chart to gain much value from seeing a lot of very small slices.
- Tags:
- gchart pie
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@GraphGuy thanks for that, is it also possible to create two pie charts. For example forcing certain slices( not only those with values =1) in "other slice" and displaying the values of "other slice" in a second pie chart
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
There's nothing automated to create a 2nd pie based on the values that would go in the 'other' slice. You would have to split your dataset, and run Proc Gchart or SGpie twice.
Perhaps a pie chart isn't best suited for the data you're wanting to visualize?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You could try to rearrange the order of your slice in order to avoid the overlapping.
With little amount of slices you can do this manually.
legend1 label=none
shape=bar(4,1.5)
position=(top left)
offset=(5,)
across=4
mode=share;
PROC SQL;
select "'"||strip(var1)||"'" into :vars separated by ' '
from test2
;
quit;
%put &=vars;
proc gchart data=test2 ;
pie var1 / sumvar=var2
other=0
midpoints= 'BBBBBBBBBBBBB' 'GGGGGGGGGGGG' 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII' 'CCCCCCCCCCC' 'DDDDDDDDDDDD' 'HHHHHHHHHHHHH' 'AAAAAAA' 'LLLLLLLLLLLLLLLLL' 'FFFFFFFFFFFFFFF' 'EEEEEEEEEEEEE'
angle=90
value= inside
percent=arrow
slice=none
noheading
coutline=black
legend=legend1;
;
run;
quit;
- Cheers -
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Oligolas thankyou very much. It worked