Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to make and image/dashborad (to export to PDF) with many VERTICAL bullet graphs gauges. And I can´t make it, in a automatic way.

In general, the questions are:

QUESTION 1: How to make a dashboard similar to this one:

enter image description here

For example, with only 3 gauges, I write this code:

GraphicsRow[
 Rotate[BulletGauge[{25, 98}, {80, 98, 107}, {0, 180}, 
   ImageSize -> Large], 90 Degree],
 Rotate[BulletGauge[{45, 62}, {20, 58, 107}, {0, 180}, 
   ImageSize -> Large], 90 Degree],
 Rotate[BulletGauge[{55, 82, 102}, {40, 88, 115}, {0, 180}, 
   ImageSize -> Large], 90 Degree]
 ]

and the result is:

enter image description here

I modified the code and put "{ }" to separate the 3 graphs, to obtain no commas between graphs, and the text "Graph..." and the brackets... but the result is so strange to me, because I can only view a little piece of the graphs.

QUESTION 2: Is this normal? How could I make my user view the entire graphs as in the previous image (without commas and "graph.." and brackets)?.

enter image description here

QUESTION 3: How I can rotate the text marks "0", "50", "150"... ?

Another way might be make automatic this individual bullet graphs, and find all I need in a PDF with LATEX, or in a similar way.

What are the best options for achieving all these things?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

For your purpose, you better use Row instead of GraphicsRow (Rotate[graphics..] is no longer graphics anyway). There is no option to set rotation of gauge tick but you could hack(?) to do that. I wrote a little function to rotate gauge and tick:

rotate[gauge_] := 
 Rotate[gauge /. Text[l_, r__] :> Text[Rotate[l, 270 Degree], r], 
  90 Degree]

rotate[BulletGauge[{25, 98}, {80, 98, 107}, {0, 180}, 
  ImageSize -> Large]]

enter image description here

Here's the result with Row:

color = {RGBColor[0.73`, 0.24506099999999992`, 0.1971`], 
   RGBColor[0.1971`, 0.5022473119339774`, 0.73`], 
   RGBColor[0.5356156238679548`, 0.73`, 0.1971`]};
Labeled[Row[
  rotate /@ {BulletGauge[{25, 98}, {80, 98, 107}, {0, 180}, 
     ImageSize -> Large], 
    BulletGauge[{45, 62}, {20, 58, 107}, {0, 180}, 
     ImageSize -> Large], 
    BulletGauge[{55, 82, 102}, {40, 88, 115}, {0, 180}, 
     ImageSize -> Large]}, Spacer[20]], 
 Row[{Style["Dashboard Example", "Subtitle", Darker[Red]], 
   SwatchLegend[color, 
    Thread[Style[{"Income", "Taxes", "blue"}, color]]]}, 
  Spacer[30]], Top]

enter image description here

Here's the code that scale gauge (but if you need very specific gauge, you might need to construct one by yourself and it could be easier than modifying built in one).

scaleRotate[g_, sc_: 1] := 
 rotate[Graphics[
   GeometricTransformation[g[[1]], ScalingTransform[{1, sc}]], 
   ImagePadding -> {{2, 2}, {15, 2}}, g[[2]]]]

Example:

color = {RGBColor[0.73`, 0.24506099999999992`, 0.1971`], 
   RGBColor[0.1971`, 0.5022473119339774`, 0.73`], 
   RGBColor[0.5356156238679548`, 0.73`, 0.1971`]};
Labeled[Row[
  scaleRotate[#, .25] & /@ 
   Table[BulletGauge[RandomInteger[{20, 100}, 3], 
     RandomInteger[{50, 120}, 3], {0, 180}, 
     ImageSize -> Large], {10}], Spacer[2]], 
 Row[{Style["Dashboard Example", "Subtitle", Darker[Red]], 
   SwatchLegend[color, 
    Thread[Style[{"Income", "Taxes", "blue"}, color]]]}, 
  Spacer[30]], Top]

enter image description here

share|improve this answer
    
perfect. Thank you. Only 2 more things. 1.- How could I obtain the thinner bullet graphs, for acomodate many many bars? (I tried with Scaled[] but have no good results) AND 2.- What do you recommend me for learning Mathematica from a basic level? Ane PDF, web, book?. I´m impressed for the knowledge of the people of the forum. In this case for you. Best Regards. –  Mika Ike Jan 11 at 14:51
2  
Here's the post that will help to learn Mathematica: Where can I find examples of good Mathematica programming practice? I also add code to scaling. –  halmir Jan 11 at 15:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.