![]() | ![]() | ![]() | ![]() | ![]() |
This sample uses SAS/GRAPH to create a Java Applet that displays a block chart. The sample code shows you how to use data tips, change the view of the chart, change the appearance of the chart, and change the variables, as displayed in the sample. This graph highlights many features of the Java applet.
You can use the items on the right mouse menu to modify chart features, such as the shape of the bars, the type of graph (bar, pie, etc.), and the colors used on the graph. Place your mouse on an area of the chart and click the right mouse button to display the pop-up menu. You can also rotate the chart by following these steps:
To drill down in the chart, use your mouse to click an area on the chart. To drill back up, simultaneously select the following key combination: Ctrl + Shift + left mouse button.
To change the sub-group variable to Year, select the following path from the pop-up menu:
Variables->Subgroup->Year
/* This sample contains options or statements */
/* that were not available until Release 8.2 */
/* of the SAS System. Running this sample */
/* in a prior release may not produce the */
/* expected results. */
/* NOTE: If you are accessing the jar files on a server you will need */
/* to point to the location of those files by specifying the CODEBASE= */
/* option on your ODS HTML statement. For example: */
/* */
/* ODS HTML FILE="path to html file.html" */
/* "CODEBASE"="HTTP://name-of-server/directory where applets are stored" */
/* parameters=("DRILLDOWNMODE"="LOCAL"); */
/* This is the only line you have to change */
/* to run this program. Specify the location */
/* where you want to store the HTML file. */
/* The ODS parameter DRILLDOWNMODE is set to */
/* LOCAL, which disables drilldown mode when */
/* the last level is reached. */
ods html file="path to html file.html"
parameters=("DRILLDOWNMODE"="LOCAL");
/* Assign graphics options for ODS output */
goptions reset=all
device=java
xpixels=600 ypixels=600
cback=white
border;
/* Create data set ADVERTISING */
data advertising;
format Revenue dollar12.;
input Media $ 1-15 Region $ Year Revenue Share;
datalines;
Newspapers Atlanta 1985 25170 26.6
Newspapers Atlanta 1990 32280 25.1
Newspapers Atlanta 1995 36092 22.5
Newspapers Atlanta 1996 38075 21.8
Newspapers Atlanta 1997 41341 22.1
Magazines Atlanta 1985 5155 5.4
Magazines Atlanta 1990 6803 5.3
Magazines Atlanta 1995 8580 5.3
Magazines Atlanta 1996 9010 5.2
Magazines Atlanta 1997 9821 5.3
Broadcast TV Atlanta 1985 20298 21.4
Broadcast TV Atlanta 1990 26616 20.7
Broadcast TV Atlanta 1995 32720 20.0
Broadcast TV Atlanta 1996 36046 20.6
Broadcast TV Atlanta 1997 36893 19.7
Cable Atlanta 1985 724 0.7
Cable Atlanta 1990 1789 1.4
Cable Atlanta 1995 5108 3.2
Cable Atlanta 1996 6438 3.7
Cable Atlanta 1997 7626 4.0
Radio Atlanta 1985 6490 6.8
Radio Atlanta 1990 8726 6.8
Radio Atlanta 1995 11338 7.1
Radio Atlanta 1996 12269 7.0
Radio Atlanta 1997 13491 7.2
Newspapers NYC 1985 15170 26.6
Newspapers NYC 1990 34280 25.1
Newspapers NYC 1995 36892 22.5
Newspapers NYC 1996 28075 21.8
Newspapers NYC 1997 33341 22.1
Magazines NYC 1985 4155 5.4
Magazines NYC 1990 5503 5.3
Magazines NYC 1995 6580 5.3
Magazines NYC 1996 7010 5.2
Magazines NYC 1997 8021 5.3
Broadcast TV NYC 1985 22298 21.4
Broadcast TV NYC 1990 25616 20.7
Broadcast TV NYC 1995 34720 20.0
Broadcast TV NYC 1996 36946 20.6
Broadcast TV NYC 1997 35893 19.7
Cable NYC 1985 924 0.7
Cable NYC 1990 2089 1.4
Cable NYC 1995 4508 3.2
Cable NYC 1996 5438 3.7
Cable NYC 1997 8026 4.0
Radio NYC 1985 7490 6.8
Radio NYC 1990 9026 6.8
Radio NYC 1995 10338 7.1
Radio NYC 1996 11269 7.0
Radio NYC 1997 12491 7.2
;
run;
title1 "Advertising Revenue Growth";
footnote1 "Cntl + Shift + LMB to drill up";
footnote2 "LMB = Left Mouse Button ";
pattern1 c=Cx6173A9; /* periwinkle*/
pattern2 c=CX8DA642; /* apple green */
/* Produce a block chart */
proc gchart data=advertising;
block media / subgroup=region
group=year
legend=legend1
sumvar=Revenue
discrete
coutline=black
patternid=subgroup
;
legend1 label=('Regions') frame;
run;
quit;
/* Close the HTML destination */
ods html close;
/* Open the listing destination */
ods listing;





