Focal Point
[SOLVED]How can you assign the highest series to a spec color in a Stacked Bar Graph?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2807014096

June 20, 2018, 06:12 PM
Don Garland
[SOLVED]How can you assign the highest series to a spec color in a Stacked Bar Graph?
Here is an GGSALES example of a stacked bar graph, single sum field stacked by Category. How can I assign the series with the highest summed number to a specific color in the graph?

GRAPH FILE GGSALES
SUM 
BUDDOLLARS       
BY CATEGORY      
ACROSS DATE AS ' '
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
ENDSTYLE
END  

This message has been edited. Last edited by: Don Garland,


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL
June 20, 2018, 06:47 PM
Tomsweb
Right click on that data point and select change color. You can also change from series to group and that will give each data point it's own color.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
June 20, 2018, 06:48 PM
Tomsweb
quote:
Originally posted by Tomsweb:
First, run the code to view the chart. Then, right click on that data point and select change color. You can also change from series to group and that will give each data point it's own color.



Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
June 20, 2018, 07:26 PM
Doug
Hey Don,

Instead of summing BUDDOLLARS by CATEGORY, consider DEFINEing each CATEGORY individually, then summing them in whatever order you want the as follows:
DEFINE FILE GGSALES
Gifts_DOL/D20M  = IF CATEGORY EQ 'Gifts'  THEN BUDDOLLARS ELSE 0;
Food_DOL/D20M   = IF CATEGORY EQ 'Food'   THEN BUDDOLLARS ELSE 0;
Coffee_DOL/D20M = IF CATEGORY EQ 'Coffee' THEN BUDDOLLARS ELSE 0;
END
GRAPH FILE GGSALES
SUM Coffee_DOL
    Gifts_DOL
    Food_DOL
. . .
I'm sure that's work for you.

You can add "setFillColor(getSeries(0),new Color(0,255,0));" to change the series colors.

Just in case you want to programatically figure out the stack order, you can predetermine the order as a pre-process to see which category has the highest values and SUM them in that order. However, beware of doing that as the users may get used to seeing 'Coffee' in the bottom section, then when 'Gifts' out sell coffee it switches and that becomes confusing to the users.

You can see where I did that on my site, the Vendor Tracking Chart.

I hope this helps.
~ Doug

This message has been edited. Last edited by: Doug,
June 20, 2018, 07:37 PM
Don Garland
Yes, that did work. I asked the question badly though, It really wasn't the colors, it was arranging them in a certain order. Your example reminded me that I needed to make my own categories so that I could put them in the sequence I wanted to.

Now all I have to do is determine the 1st highest, 2nd highest and 3rd highest. I'll do that with a HOLD file before the chart and use variable in the GRAPH.

Toooo many 12 hour days in a row I guess.

Thanks Doug and Tom


WebFOCUS Administrator @ Worldpay FIS
PROD/DEV/TEST: 8204, SANDBOX: 8206 soon - BIP, Reportcaster, Resource Manager, EUM, HyperStage soon, DB: HIVE,Oracle,MSSQL