BubbleChart Text Tooltip's

9

5

Is it possible to display "name" in the tooltip? It won't chart the full dataset, so I can't make a custom labeling function that takes it in.

data3 = {{"acerbic",3,5,1.3*10^6},
{"acetic",3,7,213000},{"acetonic",1,4,2000},{"achromatic",3,6,16000},
{"acidic",3,6,500},{"acoustic",3,7,2000},{"acrobatic",3,6,3000},
{"acrostic",4,8,Null},{"acrylic",3,5,220000},{"acyclic",6,8,270000},
{"adiabatic",6,7,40000},{"aerobatic",3,6,2000},{"aerobic",7,4,1.6*10^6},
{"aerodynamic",7,7,160000},{"aeronautic",2,2,5000},{"aesthetic",5,3,500},
{"agnostic",3,5,5000},{"agoraphobic",7,3,200000},{"agronomic",3,5,5000},
{"alcoholic",2,1,1000},{"alembic",2,1,20000},{"algebraic",6,3,5000},
{"algorithmic",5,2,2500.},{"aliphatic",7,2,13000},{"allegoric",5,2,1000},
{"allelic",8,5,2400.},{"allergenic",8,5,48000},{"allergic",8,3,1000},
{"allotropic",7,6,3000},{"almanac",6,7,Null},{"alphabetic",7,2,Null},
{"alphanumeric",6,7,1000},{"altruistic",4,7,7000},{"amnesiac",5,6,4000},
{"amnesic",6,5,500},{"amniotic",4,2,500},{"amoebic",2,1,1000},
{"anabolic",4,7,Null},{"anachronistic",4,7,1500.},{"anaerobic",3,5,10000},
{"anagrammatic",8,10,Null},{"analgesic",3,7,60000},{"analytic",7,7,3000},
{"anamorphic",2,6,3000},{"anapestic",3,5,90000},
{"anaphoric",6,4,1000000},{"anarchic",7,5,12000000},
{"anarchistic",4,4,50000},{"anatomic",2,2,30000},
{"androgenic",2,4,60000},{"anechoic",3,4,50000},{"anemic",2,1,200000},
{"anesthetic",2,6,40000},{"angelic",3,6,44000},{"anharmonic",4,7,Null},
{"animistic",3,5,100000},{"anionic",3,7,2.2*10^6},
{"anisotropic",3,6,2.8*10^6},{"anorectic",6,1,60000},
{"anorexic",5,6,4000},{"antagonistic",1,5,550000},
{"antarctic",3,4,320000},{"anthropic",5,5,8000},
{"anthropocentric",2,5,10000000},{"anthropogenic",1,5,12000000},
{"anthropometric",3,6,103000},{"anthropomorphic","","",Null},
{"antibiotic","","",Null},{"antic","","",Null},
{"anticlimactic","","",Null},{"anticyclonic","","",Null},
{"antidemocratic","","",Null}};

labelingfunc[v : {x_, y_, w_}, i_, ___] := 
 Placed[Grid[{{"Name"}, {"Usability ", x}, {"Relevancy", 
     y}, {"Market Size", w}}, Frame -> All, Alignment -> Left], 
  Tooltip]

BubbleChart[data3[[All, 2 ;; 4]], ChartStyle -> 24, 
 LabelingFunction -> labelingfunc]

bubble chart

Mr. Demetrius Michael

Posted 2012-07-28T15:18:01.483

Reputation: 1 181

1Glad I could help, and thanks for the edit. Don't be too quick to Accept an answer: if you wait a few hours first you may get additional useful or outright better answers. – Mr.Wizard – 2012-07-28T15:50:45.050

Thanks for the note! Will do. – Mr. Demetrius Michael – 2012-07-28T15:54:23.497

Answers

14

Actually, as we can use Tooltip on elements directly this is a cleaner method:

label =
  Tooltip[{##2},
    Grid[{
      {"Name", #},
      {"Usability ", #2},
      {"Relevancy", #3},
      {"Market Size", #4}
      }, Frame -> All, Alignment -> Left
  ]] &;

BubbleChart[
 label @@@ data3,
 ChartStyle -> 24
]

How about this?

labelingfunc[{x_, y_, w_}, {_, j_}, ___] :=
 Placed[Grid[{
    {"Name", data3[[j, 1]]},
    {"Usability ", x},
    {"Relevancy", y},
    {"Market Size", w}
   }, Frame -> All, Alignment -> Left
 ], Tooltip]

BubbleChart[data3[[All, 2 ;; 4]],
  ChartStyle -> 24, 
  LabelingFunction -> labelingfunc ]

Mr.Wizard

Posted 2012-07-28T15:18:01.483

Reputation: 259 163