Jump to content
The ibi Community has moved to a new platform: Please Sign In and choose Forgot Password to continue

Steps to output a chart to a PDF?


Todd Van Valkenburg

Recommended Posts

Using InfoAssist 8207.28, I created a line graph. I would like to output this to a PDF instead of JSCHART (ON GRAPH PCHOLD FORMAT JSCHART). I am playing around with the code but I cannot get it working (either I am not getting any output or the styling is ignored and the graph looks awful).

So, my guess is there some code that I can add using the text editor to allow the flexibility to either output this chart to a JSCHART or PDF based on user selection that would preserve most/all of the styling. Any suggestions that I can try?

Link to comment
Share on other sites

Here's a technique for holding the graph to a .png file and then incorporating the .pgn file into a PDF report.

DEFINE FILE ggsales DateYYMD/YYMD = AYMD(&DATEH8,-SEQ_NO,'I8YYMD'); DateA8YYMD/A8YYMD = DateYYMD; DateMD/A6 = EDIT(DateA8YYMD,'$$$$99/99'); END  GRAPH FILE ggsales SUM UNITS BY DateYYMD NOPRINT BY DateMD WHERE READLIMIT IS 30 HEADING "Units by Date Chart ~ Run: &DATEHYYMtDS " ON GRAPH HOLD AS graf2 FORMAT PNG ON GRAPH SET LOOKGRAPH LINE ON GRAPH SET EMBEDHEAD ON ON GRAPH SET STYLE * INCLUDE = IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$ TYPE=REPORT, CHART-SERIES-LAYOUT=stacked, ARGRAPHENGINE=JSCHART,$ TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $ TYPE=DATA, COLUMN=N2, BUCKET=x-axis, $ TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $ *GRAPH_SCRIPT setSkipCount(getO1Label(),1); setTextRotation(getO1Label(),0); *GRAPH_JS_FINAL xaxis: { title: {visible: false}, majorGrid: { visible:true, lineStyle: {width: 1, color:'#fdfdfd'} } }, yaxis: { title: {visible: false}, majorGrid: { visible:true, lineStyle: {width: 1, color:'#fafafa'} } } *END ENDSTYLE END  TABLE FILE ggsales SUM UNITS/I5C AS 'Units' BY DateYYMD NOPRINT BY DateMD AS 'Date' WHERE READLIMIT IS 30 ON TABLE SET PAGE NOLEAD ON TABLE PCHOLD FORMAT PDF ON TABLE SET STYLE * TYPE=REPORT, SIZE=9, $ TYPE=REPORT, IMAGE=graf2.png, SIZE=(5.0 3.5), POSITION=(2.0 0.3), $ ENDSTYLE END 

Output looks like:image.thumb.png.a6c0c94737033f6d8585d70171b22292.png

Link to comment
Share on other sites

David,

This looks promising once I can get your example working. When I ran your code, I am getting

0 NUMBER OF RECORDS IN GRAPH= 30 PLOT POINTS= 30

ERROR AT OR NEAR LINE 57 IN PROCEDURE ADHOCRQ FOCEXEC *

(FOC3315) IMAGE FILE NOT FOUND: graf2.png

I am running this from the repository. Do you know where the image is stored? Do I have to map to a directory on the server and add that mapping to the app path for this repo folder where this fex resides?

Thanks!

Link to comment
Share on other sites

I ran the fex from the reprting server, but just tried it on the repository and it worked fine. The graf2.png is stored in edatemp which is always on the app path. You can see exactly where this is, put this code before the final TABLE FILE.

WHENCE GRAF2 PNG

-EXIT

when I run this, I get:

Detail:

0 NUMBER OF RECORDS IN GRAPH= 30 PLOT POINTS= 30

0 PNG FILE SAVED ...

C:ibisrv90wfsedatempts000020graf2.png

It looks like you didn't get the PNG FILE SAVED ...

I don't get why you wouldn't.

Link to comment
Share on other sites

If I run it from the server, then it works and outputs this file location:

C:ibisrv82wfsedatempts004316graf2.png

But when I run the repo where we store all fex's, then it generates:

0 NUMBER OF RECORDS IN GRAPH= 30 PLOT POINTS= 30

(FOC1892) FILE NOT FOUND : GRAF2 PNG

Must be something simple I am missing with a path or configuration since you can run it from repo. However, you are on 9 and we are on 8207 if that matters. I will open a case with TIBCO,

Thanks again.

Link to comment
Share on other sites

  • 2 weeks later...

Follow up to this post in case this can help others. I put in a case with TIBCO. From what I understood, the main setting to look for that is in the Administration Console>Application Settings>Other and make sure that the "Upload Images to be Embedded in Reports" is checked. This was checked but we unchecked, checked it, saved it, and then Cleared Cache. Then I cleared my browser cache and tried again and it worked (the png file was saved to edatemp). For what it is worth.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...