New in Wolfram Mathematica 7: Automated Charting Graphics  previous | next 
Combine Labels and Legends
Combine labels and legends.
In[1]:=

Click for copyable input
countries = CountryData["G8"];

gdp = CountryData[#, {"GDP", 2006}] & /@ countries;

gdpPerCapita = CountryData[#, {"GDPPerCapita", 2006}] & /@ countries;

population = CountryData[#, {"Population", 2006}] & /@ countries;

data = Transpose[{population, gdpPerCapita}];

dollarForm[a_Real] := 

 Row[{"$", NumberForm[a, {10, 2}, NumberPadding -> {"", "0"}]}]
In[2]:=

Click for copyable input
SectorChart[data, SectorOrigin -> {Automatic, 15000}, 

 LabelingFunction -> (Placed[#, Tooltip, 

     Style[Column[{Row[{"GDP: ", dollarForm[First@#*Last@#]}], 

         Row[{"Population: ", 

           NumberForm[First@#, {10, 2}, NumberPadding -> {"", "0"}]}],

          Row[{"GDP Per Capita: ", dollarForm[First@#]}]}, 

        Alignment -> {Left, Bottom}, Frame -> True], 14, 

       FontFamily -> "Helvetica"] &] &), ChartStyle -> 2, 

 ChartLabels -> 

  Placed[countries, "RadialCallout", 

   Style[#, 12, FontFamily -> "Helvetica", Darker@Brown] &], 

 PlotLabel -> 

  Style["Visualizing GDP for the G8 Countries", 14, Bold, 

   FontFamily -> "Helvetica", Darker@Brown], PlotRange -> All, 

 ChartLegends -> 

  Placed[gdp, Right, 

   Style[dollarForm[#], FontFamily -> "Helvetica"] &]]
Out[2]=