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     [CLOSED] Sorting Pie Chart by Percent
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Sorting Pie Chart by Percent
 Login/Join
 
Member
posted
Hello!

I'm having some difficulty sorting a pie chart by anything other than the BY field. Specifically, I'd like to sort by the percentage each piece occupies (so the largest piece, then second largest... down to the smallest).

For instance:
GRAPH FILE CAR
	HEADING CENTER
	"Model Count by Make"
	SUM CNT.MODEL
	BY CAR
	ON GRAPH PCHOLD FORMAT JSCHART
	ON GRAPH SET LOOKGRAPH PIE
 
ON GRAPH SET STYLE *

*GRAPH_SCRIPT
setPieSorting(2);
setPieFeelerTextDisplay(1); 
*END

ENDSTYLE

END


I thought setPieSorting would address my need, but it doesn't seem to do anything. Is there a way to sort pie graphs by either percent or value?

Thanks!
Jay

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


WebFOCUS 8.1/8.2, Windows 10/Server 2012
 
Posts: 10 | Location: Baltimore, MD | Registered: April 30, 2019Reply With QuoteReport This Post
Virtuoso
posted Hide Post
  
GRAPH FILE ibisamp/car
SUM CNT.MODEL
BY TOTAL HIGHEST CNT.MODEL NOPRINT
BY CAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET LOOKGRAPH PIE
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT

setPieDepth(0);
setPieTilt(0);
setDepthRadius(0); 
setCurveFitEquationDisplay(false); 
setPlace(true); 
setPieFeelerTextDisplay(1); 

*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=color, $
TYPE=DATA, COLUMN=N3, BUCKET=measure, $
*GRAPH_SCRIPT

setReportParsingErrors(false);
setSelectionEnableMove(false);
*GRAPH_JS_FINAL
"pieProperties": {
"holeSize": "0%"
},
"agnosticSettings": {
"chartTypeFullName": "Pie_Pie"
}

*END
ENDSTYLE
END

-RUN


WebFOCUS 8204, Unix, Windows
 
Posts: 1617 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Member
posted Hide Post
Thank you for the response! I can't get your code to run as is, because Warm.sty isn't saved at that address as far as I can tell, and I can't find it. When I swap that style out with one I know works, I get a pie chart with 7 identically sized slices with a value of 1.

Any thoughts on what my app may be doing wrong in this?


WebFOCUS 8.1/8.2, Windows 10/Server 2012
 
Posts: 10 | Location: Baltimore, MD | Registered: April 30, 2019Reply With QuoteReport This Post
Virtuoso
posted Hide Post
What version are you running? The code runs in my environment even when you comment out the style line. However, if you have InfoAssist, you should be able to create the same code in your version. Create a pie chart with CNT.MODEL as the measure and Color by CAR. Then right click CNT.MODEL in the query and click Sort, Descending. That ought to create a BY TOTAL CNT.MODEL NOPRINT in your code. See if that works.


WebFOCUS 8204, Unix, Windows
 
Posts: 1617 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Member
posted Hide Post
quote:
Originally posted by Jay Ervin:
Thank you for the response! I can't get your code to run as is, because Warm.sty isn't saved at that address as far as I can tell, and I can't find it. When I swap that style out with one I know works, I get a pie chart with 7 identically sized slices with a value of 1.

Any thoughts on what my app may be doing wrong in this?


Some more detail... I'm pretty sure the 7 pieces are the 7 car makes with only 1 model, so its excluding the 3 makes with 2+ models. The lines
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=color, $
TYPE=DATA, COLUMN=N3, BUCKET=measure, $

seems to enable/ disable 3 other pie charts, each with one car make, and each with a different model count.

Also, I'm working out of 8.1 if that makes a difference here.


WebFOCUS 8.1/8.2, Windows 10/Server 2012
 
Posts: 10 | Location: Baltimore, MD | Registered: April 30, 2019Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I don't believe BUCKET syntax existed in 8.1. If you have an 8.2 test environment, that's where this will work.


WebFOCUS 8204, Unix, Windows
 
Posts: 1617 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Member
posted Hide Post
I think I'm a few days away from our 8.2 DEV environment being up and running. I'll give it a try then.

Thanks for your help!


WebFOCUS 8.1/8.2, Windows 10/Server 2012
 
Posts: 10 | Location: Baltimore, MD | Registered: April 30, 2019Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Sorting Pie Chart by Percent

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