Emily Lee Posted November 7, 2023 Share Posted November 7, 2023 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? ENGINE INT CACHE SET ONSET PAGE-NUM=NOLEADSET SQUEEZE=ON-DEFAULTH &WF_HTMLENCODE=ON;SET HTMLENCODE=&WF_HTMLENCODESET HTMLCSS=ON-DEFAULTH &WF_EMPTYREPORT=ON;SET EMPTYREPORT=&WF_EMPTYREPORTSET EMBEDHEADING=ONSET GRAPHDEFAULT=OFF-*COMPONENT=Define_carDEFINE FILE ssa_co_sys_disability_development/base/common/car Profit/D12.2 ( TITLE = 'Profit', MISSING ='ON' ) =CAR.BODY.RETAIL_COST - CAR.BODY.DEALER_COST ;ENDSET ARVERSION=2-DEFAULTH &WF_TITLE='WebFOCUS Report';GRAPH FILE ssa_co_sys_disability_development/base/common/car-* Created by Designer for GraphSUM CAR.BODY.DEALER_COSTProfitBY CAR.COMP.CARWHERE CAR.ORIGIN.COUNTRY EQ 'FRANCE';ON GRAPH PCHOLD FORMAT JSCHARTON GRAPH SET VZERO OFFON GRAPH SET HAXIS 770.0ON GRAPH SET VAXIS 405.0ON GRAPH SET LOOKGRAPH BARON GRAPH SET EMBEDHEADING ONON GRAPH SET AUTOFIT ONON 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 More sharing options...
Patrick Huebgen Posted November 7, 2023 Share Posted November 7, 2023 Can you share a very simple sample of your data - is good/bad based on a comlumn???Patrick Link to comment Share on other sites More sharing options...
Emily Lee Posted November 8, 2023 Author Share Posted November 8, 2023 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 ;ENDthank you,Emily Lee Link to comment Share on other sites More sharing options...
David Beagan Posted November 9, 2023 Share Posted November 9, 2023 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 ENDThis produces a piedata hold file in the foccache folder:You 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 More sharing options...
Emily Lee Posted November 9, 2023 Author Share Posted November 9, 2023 David,Thank you. I will give it a try and let you know.thanks,Emily Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now