Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Macros and Javascript call in Chart
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Macros and Javascript call in Chart
 Login/Join
 
Member
posted
Hey guys ia m trying to do JAVASCRIPT call a in my chart and i want to do the JAVASCRIPT call based on some condition.
So when i am applying the conditional styling or even a macro i am not able to get call the JAVASCRIPT function.

Below is the Code for my chart :-

-SET &FLAG=1;

ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE finance
-* Created by Info Assist for Graph
SUM FINANCE.DETAIL.EXPENSES
FINANCE.DETAIL.REVENUE
BY FINANCE.DETAIL.FISCAL_PERIOD
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END

INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
-*DEFMACRO=ENG, MACTYPE=RULE, WHEN=&FLAG EQ 1, $
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, WHEN = &FLAG EQ 1,JAVASCRIPT=Pillar_Call(), $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH
-HTMLFORM BEGIN
< !DOCTYPE html>









<script>
function Pillar_Call(){
alert("HELLO");

}




-HTMLFORM END

This message has been edited. Last edited by: FP Mod Chuck,


Webfocus 8.x
Windows
PDF,HTML,XLSX
 
Posts: 25 | Location: India | Registered: June 01, 2018Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Not tested since it's not built with a sample IB file, but try this
-SET &FLAG=1;

ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE finance
-* Created by Info Assist for Graph
SUM FINANCE.DETAIL.EXPENSES
FINANCE.DETAIL.REVENUE
BY FINANCE.DETAIL.FISCAL_PERIOD
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setCurveFitEquationDisplay(false);
*END

INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
-*DEFMACRO=ENG, MACTYPE=RULE, WHEN=&FLAG EQ 1, $
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
-IF &FLAG EQ 1 THEN GOTO WITHJS;
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
-GOTO NEXTFMT
-WITHJS
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, JAVASCRIPT=Pillar_Call(), $
-NEXTFMT
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH
-HTMLFORM BEGIN
< !DOCTYPE html>


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2191 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
hey thanks for replying i just got the solution to my issue...
thanks anyways..


Webfocus 8.x
Windows
PDF,HTML,XLSX
 
Posts: 25 | Location: India | Registered: June 01, 2018Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Please share, it may help someone else.

This is the first objective of this forum : help others


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2191 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Virtuoso
posted Hide Post
^^^^^ THAT. Share the love!


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
 
Posts: 1110 | Location: USA | Registered: January 27, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
As far as I know, WHEN conditions don't work for comparisons between constants. In this case, WHEN=&FLAG EQ 1 never fires, because (to FOCUS) both &FLAG and 1 are constants.

The solution is to create a DEFINE with FLAG/I1 = &FLAG;.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1644 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Macros and Javascript call in Chart

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.