Jump to content

How to show calculated fields with PIE chart with WF 9.03 Designer tool?


Emily Lee

Recommended Posts

I have three calculated fields in my data source, the relation is A=B+C , “Total” = “Defected” + “Good”.

I like to use a PIE chart to show the percentage of “Good” and “Defected” vs the “Total”.

I use WF 9.0.3 Designer to create the graphic, however, it seems I can only use the bar chart to show it. Can someone show me how to present it with a pie chart?

image.png.f1033e48f43cf0d263225ece4f7944b4.png 

ENGINE INT CACHE SET ON

SET PAGE-NUM=NOLEAD

SET SQUEEZE=ON

-DEFAULTH &WF_HTMLENCODE=ON;

SET HTMLENCODE=&WF_HTMLENCODE

SET HTMLCSS=ON

-DEFAULTH &WF_EMPTYREPORT=ON;

SET EMPTYREPORT=&WF_EMPTYREPORT

SET EMBEDHEADING=ON

SET GRAPHDEFAULT=OFF

-*COMPONENT=Define_car

DEFINE FILE ssa_co_sys_disability_development/base/common/car

 Profit/D12.2 ( TITLE = 'Profit', MISSING ='ON' ) =CAR.BODY.RETAIL_COST - CAR.BODY.DEALER_COST ;

END

SET ARVERSION=2

-DEFAULTH &WF_TITLE='WebFOCUS Report';

GRAPH FILE ssa_co_sys_disability_development/base/common/car

-* Created by Designer for Graph

SUM CAR.BODY.DEALER_COST

Profit

BY CAR.COMP.CAR

WHERE CAR.ORIGIN.COUNTRY EQ 'FRANCE';

ON GRAPH PCHOLD FORMAT JSCHART

ON GRAPH SET VZERO OFF

ON GRAPH SET HAXIS 770.0

ON GRAPH SET VAXIS 405.0

ON GRAPH SET LOOKGRAPH BAR

ON GRAPH SET EMBEDHEADING ON

ON GRAPH SET AUTOFIT ON

ON GRAPH SET STYLE *

INCLUDE=IBFS:/WFC/Global/Themes/Standard/Default/theme.sty,$

TYPE=REPORT, TITLETEXT='Chart1', ARREPORTSIZE=DIMENSION, ARFILTER_TARGET='*', ARGRAPHENGINE=JSCHART, $

TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $

TYPE=DATA, COLUMN=N2, BUCKET=y-axis(1), $

TYPE=DATA, COLUMN=N3, BUCKET=y-axis(1), $

*GRAPH_SCRIPT

Link to comment
Share on other sites

Patrick,

The "good" and "bad" are not based on a column, instead, they are calculated results.

They are similar to the CAR sample data: Profit = Retail_cost - Dealer_cost; and I like to show the % of Profit and % of Dealer_cost based on the Retail_cost.

 

DEFINE FILE car

 Profit/D12.2 ( TITLE = 'Profit', MISSING ='ON' ) =CAR.BODY.RETAIL_COST - CAR.BODY.DEALER_COST ;

END

thank you,

Emily Lee

Link to comment
Share on other sites

The way the pie chart works is you need measure values in a single column. Probably not something you can do in Designer. Here is code, you can create a fex and run it, to do this for your car file example.

TABLE FILE syscolum PRINT COLNO WHERE TBNAME EQ 'car' WHERE COLNO LE 2 ON TABLE HOLD AS TWOROWS END  TABLE FILE car SUM COMPUTE Profit /D12.2 = RETAIL_COST - DEALER_COST; RETAIL_COST DEALER_COST ON TABLE HOLD AS PROFCOST END  JOIN FILE PROFCOST AT Profit TAG A TO ALL FILE TWOROWS AT COLNO TAG B AS J1 END TABLE FILE PROFCOST PRINT COMPUTE Dimension/A12 = IF COLNO EQ 1 THEN 'Profit' ELSE IF COLNO EQ 2 THEN 'Dealer Cost' ELSE 0; COMPUTE Measure/P12.2 = IF COLNO EQ 1 THEN Profit ELSE IF COLNO EQ 2 THEN DEALER_COST ELSE 0; ON TABLE HOLD AS foccache/PIEDATA END

This produces a piedata hold file in the foccache folder:

image.png.daf1ed4afa5278d3f5965d24fc07cd2e.pngYou can then create your pie chart in Designer from this hold file.

Final step you can add a -INCLUDE of the Designer pie chart fex to the fex that generates the piedata hold file.

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