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] sorting legend based on data count not by alphabetical order
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] sorting legend based on data count not by alphabetical order
 Login/Join
 
Silver Member
posted
i have a pie chart say with 4 categories and the data for each category is like below. existing legend for the chart is in alphabetical order but the customer wants the legends to be sorted based on the data count and not based on alphabetical order. pls let me know how do we achieve ?

data sorting order
suzuki - 50
ford - 30
toyota - 20
honda - 10


current legend order(based on alphabetical)
ford
honda
suzuki
toyota


current legend order(based on alphabetical)
suzuki
ford
toyota
honda

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


WebFOCUS 8
Windows, All Outputs
 
Posts: 40 | Registered: January 23, 2018Reply With QuoteReport This Post
Guru
posted Hide Post
This works 8.2.02 Environment:
 
GRAPH FILE ibisamp/car
SUM SALES
BY TOTAL HIGHEST SALES NOPRINT
BY COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
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/endeflt.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=color, $
TYPE=DATA, COLUMN=N3, BUCKET=measure, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getSeries(*), true);
setPieFeelerTextDisplay(1);
setPieLabelDisplay(4);
setTextFormatPreset(getPieSliceLabel(),33);
*GRAPH_JS_FINAL
"pieProperties": {
    "holeSize": "0%"
},
"riserBevel": "none",
"agnosticSettings": {
    "chartTypeFullName": "Pie_Pie"
}
*END
ENDSTYLE
END
-RUN
 


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 376 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
How about using DEFINE, as follows? I actually did this in InfoAssist Smiler
DEFINE FILE baseapp/car
LengendOrder/I1=DECODE COUNTRY('ENGLAND' 5 'FRANCE' 2 'ITALY' 1 'JAPAN' 4 'W GERMANY' 3 );
END
ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
-DEFAULTH &WF_HTMLENCODE=OFF;
SET HTMLENCODE=&WF_HTMLENCODE

SET ARGRAPHENGINE=JSCHART
-DEFAULTH &WF_EMPTYREPORT=ON;
SET EMPTYREPORT=&WF_EMPTYREPORT

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 baseapp/car
-* Created by Info Assist for Graph
SUM CAR.BODY.RETAIL_COST
BY LengendOrder NOPRINT
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
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 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=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, ORIENTATION=LANDSCAPE, $
TYPE=DATA, COLUMN=N1, BUCKET=color, $
TYPE=DATA, COLUMN=N2, BUCKET=color, $
TYPE=DATA, COLUMN=N3, BUCKET=measure, $
*GRAPH_SCRIPT

setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getSeries(*), true);
setDataTextDisplay(true);
setPieLabelDisplay(6);
setPieFeelerTextDisplay(1);
setLegendReverse(true);
*GRAPH_JS_FINAL
"pieProperties": {
"holeSize": "0%"
},
"riserBevel": "bevel",
"agnosticSettings": {
"chartTypeFullName": "Pie_Multi"
}

*END
ENDSTYLE
END

-RUN
 


   See you at Summit! In FOCUS Since 1983 ~ from PC FOCUS to WebFOCUS.
   Currrently using 8204 Gen 48 in Test and Production.
   KGPCo at CenturyLink. October 2017 to Present...
 
Posts: 2967 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Silver Member
posted Hide Post
thank you doug, it worked. i am able to sort the legends and data based on count.


WebFOCUS 8
Windows, All Outputs
 
Posts: 40 | Registered: January 23, 2018Reply With QuoteReport This Post
Guru
posted Hide Post
Please change the title of your post to begin with "[SOLVED]" if this has been resolved.


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 376 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] sorting legend based on data count not by alphabetical order

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