Focal Point
[SOLVED] Changing the colour of datatext in a graph

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

October 17, 2012, 08:50 PM
Waz
[SOLVED] Changing the colour of datatext in a graph
Posting on behalf of Mary Sparks

I was wondering if you were able to change the color of the datatext (not the bar) in a graph, unique to the series.
The quick chart in advanced graph assist, does it for all series.

The highlighted code below against the car file, shows what I’m trying to do, but 7703 just ignores it.


Any suggestions?



GRAPH FILE CAR
-* Created by Advanced Graph Assistant
SUM CAR.BODY.DEALER_COST
CAR.BODY.RETAIL_COST
CAR.BODY.SALES
ACROSS CAR.BODY.SEATS
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 440
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setDepthRadius(5);
setTransparentBorderColor(getSeries(3),true);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setTransparentBorderColor(getSeries(6),true);
setTransparentBorderColor(getSeries(7),true);
setTransparentBorderColor(getSeries(8),true);
setTransparentBorderColor(getSeries(9),true);
setTransparentBorderColor(getSeries(10),true);
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getChartBackground(),true);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
setPlace(true);
setSeriesType(getSeries(1),2);
setBorderColor(getSeries(1),new Color(255,255,128));
setMarkerSize(getSeries(1),30);
setLineWidth(getSeries(1),0);
setDisplay(getDataText(1),true);
setFontName(getDataText(1),"Arial");
setFontSizeAbsolute(getDataText(1),true);
setFontSizeInPoints(getDataText(1),8);
setPlaceResize(getDataText(1),0);
setFontStyle(getDataText(1),0);
setTextFormatPreset(getDataText(1),2);
setBorderColor(getSeries(2),new Color(106,189,187));
setSeriesType(getSeries(2),2);
setDisplay(getDataText(2),true);
setFontName(getDataText(2),"Arial");
setFontSizeAbsolute(getDataText(2),true);
setFontSizeInPoints(getDataText(2),8);
setPlaceResize(getDataText(2),0);
setFontStyle(getDataText(2),0);
setTextFormatPreset(getDataText(2),2);
setDisplay(getDataText(),true);
setFillColor(getDataText(0),new Color(255,255,255));
setFillColor(getDataText(1),new Color(255,255,255));
setFillColor(getDataText(2),new Color(0,0,24));
setFontName(getCurveFitEquationText(),"Arial");
setTextJustHoriz(getCurveFitEquationText(),0);
setDataLineThickness(0);
setLineWidth(getSeries(0),0);
setSeriesType(getSeries(0),1);
setMarkerShape(getSeries(1),3);
setLineWidth(getSeries(2),0);
setFontName(getDataText(),"Arial");
setFontName(getPieLabel(),"Arial");
setFontName(getPieBarLabel(),"Arial");
setFontName(getPieRingLabel(),"Arial");
setFontName(getPieSliceLabel(),"Arial");
setFontName(getLegendText(),"Arial");
setFontName(getO1Title(),"Arial");
setFontName(getX1Title(),"Arial");
setFontName(getY1Title(),"Arial");
setFontName(getO2Title(),"Arial");
setFontName(getY2Title(),"Arial");
setFontName(getY3Title(),"Arial");
setFontName(getY4Title(),"Arial");
setFontName(getY5Title(),"Arial");
setFontName(getTitle(),"Arial");
setFontName(getSubtitle(),"Arial");
setFontName(getFootnote(),"Arial");
setFontName(getAllText(),"Arial");
setDataTextDisplay(true);
setDataTextPosition(5);
setDataTextRadiusDefault(30);
setDataTextAngleDefault(60);
ENDSTYLE
END

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


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 18, 2012, 08:05 AM
MAdams1
Hi Waz and Mary,

This is the code you need;
  
setFillColor(getDataText(1),new Color(218,165,32));
setFillColor(getDataText(2),new Color(0,0,255));
setFillColor(getDataText(0),new Color(128,0,255));
 


The (1), (2), and (0) are the series numbers.

Hope it helps.

P.S. you can't do this from the GUI, you have to add the code.

Michelle


WebFOCUS Server 8.1.05
Windows 2008 Server
WebFOCUS AppStudio 8.1.05
Windows 7 Professional
IE 11 and Chrome Version 43.0.2357.124 m.
Mostly HTML, PDF, Excel, and AHTML
October 18, 2012, 05:28 PM
Mary Sparks
Thank you, I had something similar above (the highlighting did not carry through), but my did not work, while yours did, so....., again thank you!

I did find that if you also have setDataTextFormat(28); (which prints the datatext values as percentages disables the color)