Data visualization with SAS programming

Resizing bar chart and customizing tool tip with imagemap

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Resizing bar chart and customizing tool tip with imagemap

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.

 


Accepted Solutions
Solution
‎01-27-2016 09:57 AM
SAS Super FREQ
Posts: 863

Re: Resizing bar chart and customizing tool tip with imagemap

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


All Replies
Grand Advisor
Posts: 16,304

Re: Resizing bar chart and customizing tool tip with imagemap

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...

Solution
‎01-27-2016 09:57 AM
SAS Super FREQ
Posts: 863

Re: Resizing bar chart and customizing tool tip with imagemap

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;

Occasional Contributor
Posts: 7

Re: Resizing bar chart and customizing tool tip with imagemap

Thank you, this worked perfectly.

Post a Question
Discussion Stats
  • 3 replies
  • 335 views
  • 0 likes
  • 3 in conversation