Focal Point
[SOLVED]Different color for each bar in Vertical Bar chart

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

July 07, 2016, 04:16 PM
WFDevConsultant
[SOLVED]Different color for each bar in Vertical Bar chart
How can I give different color for each BAR?

GRAPH FILE CAR
SUM
DEALER_COST
BY COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET HAXIS 500
ON GRAPH SET VAXIS 220
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ON
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
-*ON GRAPH SET GTREND ON
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT OFF
ON GRAPH SET STYLE *
TYPE=HEADING, JUSTIFY=CENTER, FONT='CALIBRI', SIZE=10, STYLE=BOLD,COLOR=RGB(128 128 128), $
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
-*setFrameDisplay(false);
setColorMode(2);
setFillColor(getGroup(0),new Color(128,128,255));
setFillColor(getGroup(1),new Color(158,224,191));
setFillColor(getGroup(2),new Color(128,128,255));
-*setPlace(true);
*END

ENDSTYLE
END
-RUN

This message has been edited. Last edited by: <Emily McAllister>,


8.2.06
Windows, All Formats
July 07, 2016, 04:36 PM
Francis Mariani
Running your code, I see different colours...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 07, 2016, 04:42 PM
Squatch
quote:
Originally posted by Francis Mariani:
Running your code, I see different colours...

I was scratching my head about that, too.

I can only assume the request is: "How can I change the default colors?"


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
July 07, 2016, 04:43 PM
Francis Mariani



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 07, 2016, 04:44 PM
WFDevConsultant
Yes, it is showing different colors but I want to get the colors like below.

England, France - Blue color
Italy - Red color
Japan, Germany - Yellow color.


8.2.06
Windows, All Formats
July 07, 2016, 04:44 PM
Francis Mariani
Use setFillColor(getSeries(n):
setFillColor(getSeries(0),new Color(0,0,255));
setFillColor(getSeries(1),new Color(255,0,0));
setFillColor(getSeries(2),new Color(0,255,0));
setFillColor(getSeries(3),new Color(0,255,255));
setFillColor(getSeries(4),new Color(255,0,255));



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
July 07, 2016, 04:55 PM
WFDevConsultant
Thanks Francis.

The trick is adding setColorMode(2) and setFillColor(getSeries(n)) works.

I didn't had the setColorMode(2) when I use the series color.


8.2.06
Windows, All Formats