BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
olsengf
Fluorite | Level 6

I have a bar chart using gchart within a stored process displayed within a portlet in SAS Information Delivery Portal 9.4, using this code (within a larger stored process):

 

goptions reset=all;

ods graphics on / imagemap=on height=3in width=3in border=off;

axis1 label=none;
axis2 label=none;
legend1 label=none;
title height=10pt 'FACR Generated and Recovered - Fiscal YTD' ;
proc gchart data=FACR_TotalYTD_Display;
vbar FiscalYear / noframe sumvar=FACRSum discrete subgroup=FACRType nostats maxis=axis1 raxis=axis2 legend=legend1 ;
format FACRSum DOLLAR14.2;
run;

quit;

 

 

Adding "ods graphics on / imagemap=on height=3in width=3in border=off;" does resize the bar chart, but the graph seems distorted and if I change the values for height and width it doesn't affect the size of the displayed chart. And when I add that line, the hover tip disappears. I've tried to add the hover tip back in with this code:
ROLENAME=(Year=FiscalYear) TIP=(Year Y ) tiplabel=(Year="Fiscal Year" Y="FACR YTD")

within the proc gchart, but it doesn't work. I want to customize the displayed text for the hover text on the chart.

 

1 ACCEPTED SOLUTION

Accepted Solutions
DanH_sas
SAS Super FREQ

I looks like you are mixing GTL (graph template language) syntax into your GCHART syntax. Also, the ODS GRAPHICS statement applies only to GTL and SG procedure output.

 

To change the size of GCHART output, you should use the XPIXELS and YPIXELS (or HSIZE and VSIZE) options on the GOPTIONS statement. To do imagemaps in SAS/Graph, you have to create a column in your data that contains the correct HTML syntax for the imagemap. Then, refer to that variable using the HTML option on the VBAR statement.

 

As Reeza said, you might want to consider creating this chart using SGPLOT, as it will be a lot easier to create the imagemap. The equivalent SGPLOT code to your example would look something like the following:

 

ods graphics on / imagemap=on height=3in width=3in border=off;

title height=10pt 'FACR Generated and Recovered - Fiscal YTD' ;
proc sgplot data=FACR_TotalYTD_Display noborder; 

xaxis display=(nolabel);
yaxis display=(nolabel);

vbar FiscalYear / response=FACRSum group=FACRType;
format FACRSum DOLLAR14.2;
run;

View solution in original post

3 REPLIES 3
Reeza
Super User

Do you have the option to switch to SG Procedures?

Also, what image type are you using? Have you made sure it's SVG?

 

http://support.sas.com/documentation/cdl/en/lrcon/65287/HTML/default/viewer.htm#n0ezld96mjxs08n1lvoj...

DanH_sas
SAS Super FREQ

I looks like you are mixing GTL (graph template language) syntax into your GCHART syntax. Also, the ODS GRAPHICS statement applies only to GTL and SG procedure output.

 

To change the size of GCHART output, you should use the XPIXELS and YPIXELS (or HSIZE and VSIZE) options on the GOPTIONS statement. To do imagemaps in SAS/Graph, you have to create a column in your data that contains the correct HTML syntax for the imagemap. Then, refer to that variable using the HTML option on the VBAR statement.

 

As Reeza said, you might want to consider creating this chart using SGPLOT, as it will be a lot easier to create the imagemap. The equivalent SGPLOT code to your example would look something like the following:

 

ods graphics on / imagemap=on height=3in width=3in border=off;

title height=10pt 'FACR Generated and Recovered - Fiscal YTD' ;
proc sgplot data=FACR_TotalYTD_Display noborder; 

xaxis display=(nolabel);
yaxis display=(nolabel);

vbar FiscalYear / response=FACRSum group=FACRType;
format FACRSum DOLLAR14.2;
run;

olsengf
Fluorite | Level 6

Thank you, this worked perfectly.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1415 views
  • 0 likes
  • 3 in conversation