Focal Point
[SOLVED] Spectral graph (pdf) change color scale

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

November 12, 2018, 07:51 PM
cldiaz
[SOLVED] Spectral graph (pdf) change color scale
I'm trying to change the color scale in a spectral graph. I've tried to use the colorscale property from the documentation but that only works when the format is JSCHART. I've also tried changing the color via labels, that also doesn't work. Does anyone have advice for how to do this?
Here is an example using the car file:
 ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='INCHES';
-DEFAULTH &WF_STYLE_HEIGHT='4.21875';
-DEFAULTH &WF_STYLE_WIDTH='8.020833';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE car
-* Created by Info Assist for Graph
SUM AVE.CAR.BODY.DEALER_COST
BY CAR.SPECS.MPG
ACROSS CAR.SPECS.WEIGHT
ON GRAPH PCHOLD FORMAT PDF
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET AUTOFIT ON
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 2
ON GRAPH SET LOOKGRAPH SPECTRAL
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setPlace(true);
setDataTextPosition(4);
setCurveFitEquationDisplay(false);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Flat.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
-*Tried this to change the colors in the spectral chart
-*TYPE=DATA, COLUMN=DEALER_COST, BACKCOLOR=PINK, WHEN=DEALER_COST LE 8000, $

*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*GRAPH_JS_FINAL
-*Tried this to change the colors in a spectral chart
-*"colorScale": {"colors": ["tan", "antiquewhite"]}
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH
 

This message has been edited. Last edited by: cldiaz,


WebFOCUS 8204
Windows, All Outputs
November 13, 2018, 07:55 AM
MartinY
Many JSCHART features are not rendered the same within PDF format which can possibly be explained with this similar issue
[SOLVED] Waterfall Charts output differences
or look at Tony's reply in this post
Dynamic Bands in Gauge Chart - Format GIF or PNG


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
November 15, 2018, 01:17 PM
cldiaz
Thanks MartinY! Those posts led me to opening a case and with tech support help I was able to come to a solution that worked for me.
You are right there is an older engine used for PDF charts. You can use getColorByHeight and gradient pins to set up a color scale for spectral maps in this engine. Here is the styling code that gave me the color scale and order that I was looking for.
 setGradientNumPins(getColorByHeight(),2);
setGradientPinPosition(getColorByHeight(),0.0,0);
setGradientPinLeftColor(getColorByHeight(),new Color(255,255,255),0);
setGradientPinRightColor(getColorByHeight(),new Color(255,255,255),0);
setGradientPinPosition(getColorByHeight(),1.0,1);
setGradientPinLeftColor(getColorByHeight(),new Color(0,0,255),1);
setGradientPinRightColor(getColorByHeight(),new Color(0,0,255),1);
 


Once I did that my borders were still odd colors and needed some help. I did the following to make the borders all black:
setSeriesBorderColor(1,new Color(0,0,0));
setSeriesBorderColor(2,new Color(0,0,0));
setSeriesBorderColor(3,new Color(0,0,0));
setSeriesBorderColor(4,new Color(0,0,0));
setSeriesBorderColor(5,new Color(0,0,0));
setSeriesBorderColor(0,new Color(0,0,0));  

This worked for my current needs and I hope it ends up being dynamic enough in the future.


WebFOCUS 8204
Windows, All Outputs