Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Dynamic Bands in Gauge Chart - Format GIF or PNG

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Dynamic Bands in Gauge Chart - Format GIF or PNG
 Login/Join
 
Member
posted
Hi,

I am trying to make a gauge chart that shows current sales, 1st target and 2nd target. The min/max values of each band are calculated using the total sales and therefore, are dynamic.

I was able to do it using the scripts below but the format is JSCHART. I'd like to make it as an image (png/gif...) Does anyone know how to do it?

-*Use Car as an example: BTW The scripts is running well in App Studio but returns an error message in info assistant and I don't know why...

SET HOLDLIST=PRINTONLY
TABLE FILE CAR
SUM SALES
COMPUTE 1ST_TARGET/I10=TOT.SALES * 1.15;
COMPUTE 2ND_TARGET/I10=1ST_TARGET * 1.15;
BY COUNTRY
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS A1
END
-RUN

TABLE FILE A1
SUM A1.A1.1ST_TARGET NOPRINT
COMPUTE REDMAX/I10=C1/3;
COMPUTE YELLOWMIN/I10=C1/3*2;
COMPUTE YELLOWMAX/I10=C1;
COMPUTE DARKGREENMIN/I10=C1*1.15;
COMPUTE DARKGREENMAX/I10=C1*1.33;
ON TABLE HOLD AS VALUES FORMAT ALPHA
PRINT *
END
-RUN
-READ VALUES &REDMAX.A10 &YELLOWMIN.A10.&YELLOWMAX.A10.&DARKGREENMIN.A10.&DARKGREENMAX.A10.

GRAPH FILE CAR
SUM SALES
COMPUTE 1ST_TARGET/I10=TOT.SALES * 1.15;
COMPUTE 2ND_TARGET/I10=1ST_TARGET * 1.15;
BY COUNTRY
WHERE COUNTRY EQ 'ENGLAND';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH GAUGE1
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setY1ExcludeMaxLabel(true);
setPlace(true);
setGaugeBackgroundStyle(6);
setGaugeStopAngle(0.0);
setGaugeSizeMode(false);
setGaugeStartAngle(180.0);
setTransparentFillColor(getFrame(),true);
setTextFormatPreset(getY1Label(),0);
setFillColor(getSeries(0),new Color(255,128,0));
setFillColor(getSeries(1), new Color(187,0,187,38));
setFillColor(getSeries(2), new Color(187,0,187,38));
setGaugeMinorTickRelativeTickLength(0.02);
setGaugeMajorTickRelativeTickLength(0.06);
setGaugeNeedleStyle(0);

*GRAPH_JS
"series": [{"series": 0,"color": "orange"},
{"series": 1,"marker": {"shape": "house","border": {"color": "purple","width": 1},"size": 12},"color": "purple"},
{"series": 2,"marker": {"shape": "house","border": {"color": "purple","width": 1},"size": 12},"color": "purple"} ],
"yaxis": {"min": 0,"colorBands":
[{"stop": &REDMAX.EVAL,"color": "red","start": 0},
{"stop": &YELLOWMIN.EVAL,"color": "orange","start": &REDMAX.EVAL},
{"stop": &YELLOWMAX.EVAL,"color": "yellow","start": &YELLOWMIN.EVAL},
{"stop": &DARKGREENMIN.EVAL,"color": "lightgreen","start": &YELLOWMAX.EVAL},
{"stop": &DARKGREENMAX.EVAL,"color": "green","start": &DARKGREENMIN.EVAL}],
"max": &DARKGREENMAX.EVAL},
"gaugeProperties":
{"totalLabel": {"visible": false},
"axisWidth": "8%",
"outerBorder": {"fill": {"color": "grey"},"width": 18,"border": {"color":"white","width": 20}},
"startAngle": 180,
"endAngle": 0,
"needleBase": {"color": "white","border": {"color": "orange", "width": 3},"size": 6},"groupLabel": {"visible": false},"secondaryNeedlesAsMarkers": true},
*END

ENDSTYLE
END
-RUN

This message has been edited. Last edited by: FP Mod Chuck,
 
Posts: 10 | Registered: September 05, 2018Report This Post
Member
posted Hide Post
Thanks in advance! Smiler
 
Posts: 10 | Registered: September 05, 2018Report This Post
Expert
posted Hide Post
quote:
the format is JSCHART. I'd like to make it as an image (png/gif...) Does anyone know how to do it?

JSCHART is HTML and JavaScript which, as you've found out, only result in your chart when using FORMAT JSCHART.

If you were to change the format to an image format then the code that would be used would be the PFJ (Perspective for Java) engine which would result in a different looking chart.

You could use PhantomJS - as has been mentioned before in other posts. Unfortunately, this is too involved for this forum Frowner

Your code, saved within App Studio, runs perfectly OK in InfoAssist.


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Hi Tony,

Thanks a lot for your reply!


I tried with InfoAssist 8.1.09 and it worked but with 8.2.03 it asked me to put values in parameters "&REDMAX.A10 &YELLOWMIN.A10.&YELLOWMAX.A10.&DARKGREENMIN.A10.&DARKGREENMAX.A10.". It seems the "-Read Values" does not work very well.


I also tried to call values from database to define band starts and band ends. I almost got the gauge chart I need. The only problem is that the ScaleMax is a bit smaller than the value I defined. I will post the sample codes using car data later.

Best,
 
Posts: 10 | Registered: September 05, 2018Report This Post
Virtuoso
posted Hide Post
And if you try with the following, is that look better and make any differences under 8.2.0.3 ?
-DEFAULTH &REDMAX = 0
-DEFAULTH &YELLOWMIN = 0
-DEFAULTH &YELLOWMAX = 0
-DEFAULTH &DARKGREENMIN = 0
-DEFAULTH &DARKGREENMAX = 0
TABLE FILE A1
SUM A1.A1.1ST_TARGET NOPRINT
    COMPUTE REDMAX/I10=C1/3;
    COMPUTE YELLOWMIN/I10=C1/3*2;
    COMPUTE YELLOWMAX/I10=C1;
    COMPUTE DARKGREENMIN/I10=C1*1.15;
    COMPUTE DARKGREENMAX/I10=C1*1.33;
ON TABLE HOLD AS VALUES
END
-RUN
-READFILE VALUES
-RUN


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Dynamic Bands in Gauge Chart - Format GIF or PNG

Copyright © 1996-2020 Information Builders