Data visualization with SAS programming

Manage pie chart text colours

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

Manage pie chart text colours

Hi!

I would like to create a pie chart with SAS but I have special needs.

In the graph it should be possible to change the colour of the text based on an independent variable.

What I want to achieve is shown below.

pie_chart.PNG

PROC GCHART can decide if the value are shown inside or outside the graph and the colours of them.

But what about a mixture of them, Is this possible with SAS system?

Is annotation dataset the only way to solve this problem?

Thank you in advance,

Best regards

Paolo

Attachment

Accepted Solutions
Solution
‎07-13-2012 08:12 AM
SAS Employee
Posts: 977

Re: Manage pie chart text colours

One way would be to annotate the text - then you have programmatical control over exactly what the label says, and also the exact color.

To do that, you'll probably need to use the cntl2txt annotate function (in combination with others), as described here (note this example annotates both the pie, and the label):

http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#annodict-cntl2txt...

Using cntl2txt is a bit 'tricky' (I'm not very good with it, and I don't think I have any examples of using it to label a pie chart).

View solution in original post


All Replies
Solution
‎07-13-2012 08:12 AM
SAS Employee
Posts: 977

Re: Manage pie chart text colours

One way would be to annotate the text - then you have programmatical control over exactly what the label says, and also the exact color.

To do that, you'll probably need to use the cntl2txt annotate function (in combination with others), as described here (note this example annotates both the pie, and the label):

http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#annodict-cntl2txt...

Using cntl2txt is a bit 'tricky' (I'm not very good with it, and I don't think I have any examples of using it to label a pie chart).

Occasional Contributor
Posts: 9

Re: Manage pie chart text colours

Hi Robert and thank you for your fast answer!

As you said I don't think there are other ways than create an annotation dataset with all the informations about slice colors, label and everything else.

I've found this paper on the net and it seems to be a very nice starting point.

http://www.mwsug.org/proceedings/2011/coders/MWSUG-2011-CC13.pdf

Br

Paolo

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 790 views
  • 0 likes
  • 2 in conversation