Previous Page | Next Page

The GANNO Procedure

Example 4: Using Annotate Graphics in a Drill-Down Graph


Procedure features:

PROC GANNO statement option:

IMAGEMAP=

Sample library member: GANDRILL

This example creates essentially the same Annotate data set used in Storing Annotate Graphics. It draws four colored squares and displays the data set as a single graphics output.

[A Drill-Down Graph]

However, this time the example shows you how to use Annotate graphics to generate a drill-down graph. The example uses the HTML variable in the Annotate data set to specify linking information that defines each of the four squares as a hot zone. When the graph is viewed in a browser, you can click on a square to drill down to a related graph. For example, if you click on the green square, it drills down to a graph that confirms that you selected the green square.

[Drill-Down Target for the Green Square]

The example uses the ODS HTML destination to generate the drill-down graph. To implement the drill-down capability, the Annotate data set uses the HTML variable to provide the linking information (see HTML Variable). The presence of the HTML variable in the Annotate data set and the IMAGEMAP= option on the GANNO procedure causes the ODS HTML destination to generate an image map for the graph in the HTML output.

The example runs four GSLIDE procedures to generate the target output. Each GSLIDE procedure uses the NAME= option to name the graph it produces, ensuring that the GIF driver creates files named green.gif, blue.gif, red.gif, and gray.gif. These are the files that are referenced as targets by the strings that are specified for the Annotate data set's HTML variable.

 Note about code
/* set the graphics environment */
goptions reset=all dev=gif gunit=pct goutmode=replace border;
 Note about code
/* create the Annotate data set */
data squares;
     length function style color $ 8
            html text $ 15;
     xsys="3"; ysys="3";

        /* draw the green square */
     color="green";
     function="move"; x=10; y=65; output;
     function="bar";  x=30; y=95; style="solid";
        html="href=green.gif"; output;

        /* label green square */
     function="label"; x=10; y=63; position="6";
        style="swissb"; size=2; text="Green"; output;

        /* draw the red square */
     color="red";
     function="move"; x=60; y=65; output;
     function="bar";  x=80; y=95;
        html="href=red.gif"; output;

        /* label red square */
     function="label"; x=60; y=63; position="6";
        style="swissb"; size=2; text="Red"; output;

        /* draw the blue square */
     color="blue";
     function="move"; x=10; y=15; output;
     function="bar";  x=30; y=45;
        html="href=blue.gif"; output;

        /* label blue square */
     function="label"; x=10; y=12; position="6";
        style="swissb"; size=2; text="Blue"; output;

        /* draw the gray square */
     color="gray";
     function="move"; x=60; y=15; output;
     function="bar";  x=80; y=45;
        html="href=gray.gif"; output;

        /* label gray square and add a footnote */
     function="label"; x=60; y=12; position="6";
        style="swissb"; size=2; text="Gray"; output;

        /* draw a blue frame */
     function="frame"; color="blue"; style="empty";
        /* set null link for background area in frame */
        html=""; output;
run;
 Note about code
/* open the ODS HTML destination */
ods html body="gandrill.htm" path=".";
 Note about code
/* generate annotate graphics */
proc ganno annotate=squares
    imagemap=annomap
    description="Four squares";
run; 
 Note about code
/* generate the target output */
proc gslide wframe=4
   cframe=green name="green";
   note height=20;
   note height=10
        justify=center color=green
       "Green Grass";
run;

proc gslide wframe=4
   cframe=blue name="blue";
   note height=20;
   note height=10
        justify=center color=blue
       "Blue Sky";
run;

proc gslide wframe=4
   cframe=red name="red";
   note height=20;
   note height=10
        justify=center color=red
       "Red Wine";
run;

proc gslide wframe=4
   cframe=gray name="gray";
   note height=20;
   note height=10
        justify=center color=gray
       "Gray Mare";
run;
quit;
goptions goutmode=append;
run;

Previous Page | Next Page | Top of Page