Focal Point
[SOLVED] two colours for one line in a graph

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

February 16, 2009, 12:50 PM
jodye
[SOLVED] two colours for one line in a graph
Hi

Does anyone know how to change the colour of a line in a line graphs depending on the values? for example, make the line red when negative and black when positive... so one line can be either or both colours in the same graph? I know how to change the colour of a line of course but can't figure out how to get two colours.



Thanks.

Jodye

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


WF 8.0.0.5M
February 16, 2009, 01:19 PM
FrankDutch
Jodye

You have to create a graph with two lines
one for the positive values and one for the negative.
If you do that, the first version will give you some strange lines whenever the value switches from plus to minus.
The trick is to handle the null values (not zero!).
This is documented in the manuals.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 16, 2009, 01:28 PM
jodye
Hi Frank

I was just thinking something like that but thought that there must be an easier way. I looked and did not find anything I will search again.

thx.


WF 8.0.0.5M
February 16, 2009, 01:34 PM
FrankDutch
If you find an easier way please post it!




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 20, 2009, 04:04 PM
jodye
Hi Frank

I opened a case and got a great solution. Here is a sample with CAR...works perfectly. How come nobody seems to know about this? Smiler

Jodye

  
GRAPH FILE car
SUM SALES
BY COUNTRY
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET STYLE *
DEFMACRO=COND0001, MACTYPE=RULE, WHEN=SALES LT 20000, $
DEFMACRO=COND0002, MACTYPE=RULE, WHEN=SALES GE 20000, $
TYPE=DATA, MACRO=COND0001, COLUMN=SALES, STYLE=BOLD, COLOR=LIME, $
TYPE=DATA, MACRO=COND0002, COLUMN=SALES, COLOR=RED, $
ENDSTYLE
END 



WF 8.0.0.5M
February 22, 2009, 03:41 PM
Waz
quote:
How come nobody seems to know about this?

Perhaps the reason is because it doesn't work in 7.1, but does in 7.6.

I assume this functionality became available in 7.6.

In 7.1 the graph language created is

setGraphType(41);
setTextRotation(getO1Label(),2);
setTextRotation(getO2Label(),2);
setTextRotation(getX1Label(),2);
setFontSizeVC(getDataText(),1000);
setFontSizeVC(getFootnote(),1000);
setFontSizeVC(getLegendText(),1000);
setFontSizeVC(getO1Label(),1000);
setFontSizeVC(getO1Title(),1000);
setFontSizeVC(getO2Label(),1000);
setFontSizeVC(getO2Title(),1000);
setFontSizeVC(getPieLabel(),1000);
setFontSizeVC(getPieRingLabel(),1000);
setFontSizeVC(getPieSliceLabel(),1000);
setFontSizeVC(getSubtitle(),1000);
setFontSizeVC(getTitle(),1000);
setFontSizeVC(getX1Label(),1000);
setFontSizeVC(getX1Title(),1000);
setFontSizeVC(getY1Axis(),1000);
setFontSizeVC(getY1Label(),1000);
setFontSizeVC(getY1Title(),1000);
setFontSizeVC(getY2Label(),1000);
setFontSizeVC(getY2Title(),1000);
setToolTipDisplay(true);
setSeriesLabelArray(
"SALES"); 
setDataSeries(
12000.00,
0.00,
30200.00,
78030.00,
88190.00);
setDataRangeToExtent();
setGroupLabelArray(
"ENGLAND",
"FRANCE",
"ITALY",
"JAPAN",
"W GERMANY");
setY1MajorGridStyle(3);
setO1MajorGridStyle(3);
setDecimalNotation(".");
setCentZero(false);
setDataTextPosition(0);
setDataTextRadiusDefault(10);
setCustomDataText(getSeries(0), true);
setTextFormatPreset(getSeries(0),-1);
setTextFormatPattern(getSeries(0),"###,###");
setY1TitleString("SALES");
setO1TitleString("COUNTRY");
setFillColor(getSeries(0),new Color(0,255,0));
setFillColor(getSeries(1),new Color(0,255,0));
setFillColor(getSeries(2),new Color(255,0,0));
setFillColor(getSeries(3),new Color(255,0,0));
setFillColor(getSeries(4),new Color(255,0,0));



In 7.6 the graph language created is
setGraphType(41);
setTextRotation(getO1Label(),2);
setTextRotation(getO2Label(),2);
setTextRotation(getX1Label(),2);
setFontSizeVC(getDataText(),1000);
setFontSizeVC(getFootnote(),1000);
setFontSizeVC(getLegendText(),1000);
setFontSizeVC(getO1Label(),1000);
setFontSizeVC(getO1Title(),1000);
setFontSizeVC(getO2Label(),1000);
setFontSizeVC(getO2Title(),1000);
setFontSizeVC(getPieLabel(),1000);
setFontSizeVC(getPieRingLabel(),1000);
setFontSizeVC(getPieSliceLabel(),1000);
setFontSizeVC(getSubtitle(),1000);
setFontSizeVC(getTitle(),1000);
setFontSizeVC(getX1Label(),1000);
setFontSizeVC(getX1Title(),1000);
setFontSizeVC(getY1Axis(),1000);
setFontSizeVC(getY1Label(),1000);
setFontSizeVC(getY1Title(),1000);
setFontSizeVC(getY2Label(),1000);
setFontSizeVC(getY2Title(),1000);
setToolTipDisplay(true);
setSeriesLabelArray(
"SALES");
setDataSeries(
12000.00,
0.00,
30200.00,
78030.00,
88190.00);
setDataRangeToExtent();
setGroupLabelArray(
"ENGLAND",
"FRANCE",
"ITALY",
"JAPAN",
"W GERMANY");
setY1MajorGridStyle(3);
setO1MajorGridStyle(3);
setDecimalNotation(".");
setCentZero(false);
setDataTextPosition(0);
setDataTextRadiusDefault(10);
setCustomDataText(getSeries(0), true);
setTextFormatPreset(getSeries(0),-1);
setTextFormatPattern(getSeries(0),"###,###");
setY1TitleString("SALES");
setO1TitleString("COUNTRY");
setExceptionalRiser(0,0);
setFillColor(getExceptionalRiser(0,0),new Color(0,255,0));
setExceptionalRiser(0,1);
setFillColor(getExceptionalRiser(0,1),new Color(0,255,0));
setExceptionalRiser(0,2);
setFillColor(getExceptionalRiser(0,2),new Color(255,0,0));
setExceptionalRiser(0,3);
setFillColor(getExceptionalRiser(0,3),new Color(255,0,0));
setExceptionalRiser(0,4);
setFillColor(getExceptionalRiser(0,4),new Color(255,0,0));


It seems that in 7.1 code tried to produce the multi coloured line, but created different colours for each series, there is only one.
In 7.6 it uses the ExceptionalRiser method. This method is normally used for bar graphs, ten point to IBI for finding this out.

If anyone is interested, here is a link to ThreedGrephics that details this method. ExceptionalRiser


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!