Focal Point
[CLOSED] How to Set the color of the legend marker in a line graph

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

May 12, 2010, 06:14 AM
Shamitha
[CLOSED] How to Set the color of the legend marker in a line graph
The problem is: for the line graph, the color of the series and the legend marker is coming different. Is it possible to set the color of the legend marker. I am setting the color of the series according to the group values but the legend marker is showing a different color than that.

This message has been edited. Last edited by: Kerry,
May 12, 2010, 09:04 AM
FrankDutch
How about posting some code you already have




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

May 12, 2010, 09:29 AM
Shamitha
Hi Frank. Here is the code what I have

ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO ON
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET HAXIS 470
ON GRAPH SET VAXIS 305
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 1
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBIDefault.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
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);
setMarkerDisplay(true);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(false);
setO1MinorGridDisplay(true);
setO1MinorGridStyle(3);
setAxisAssignment(0,0);
setSeriesType(0,2);
setY1LabelDisplay(true);
setY1AxisSide(0);
setY1MustIncludeZero(true);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setTextFormatPreset(getY1Label(),-1);
setTextFormatPattern(getY1Label(),"#.##");
setPieFeelerTextDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setRiserBorderMode(1);
setSeriesDefaultTransparentBorderColor(true);
setUseSeriesBorderDefaults(true);
setLegendDisplay(true);
setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setTextJustHoriz(getO1Title(),1);
setFontSizeAbsolute(getO1Title(),true);
setFontSize(getO1Title(),12);
setTextRotation(getO1Title(),0);
setTextWrap(getO1Title(),false);
setTextJustHoriz(getO1Label(),0);
setTextWrap(getO1Label(),false);
setPlaceResize(getO1Title(),0);
setPlaceRotate(getO1Title(),0);
setPlaceAlign(getO1Title(),0);
setPlaceWordWrap(getO1Title(),0);
setPlaceResize(getO1Label(),0);
setPlaceRotate(getO1Label(),0);
setPlaceAlign(getO1Label(),0);
setPlaceWordWrap(getO1Label(),0);
setPlace(true);
setDepthRadius(0);
setDepthAngle(0);
setTransparentFillColor(getLegendArea(),false);
setLegendOrient(1);
setDisplay(getBeveledLegend(),false);
setFillColor(getLegendArea(),new Color(255,255,255));
setLineStyleLegendMarkers(2);
setMarkerShape(getLegendLabelMarker(0),1);
setColorMode(0);
setFontName(getDataText(),"Arial");
setFontName(getPieLabel(),"Arial");
setFontName(getPieBarLabel(),"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");
setUseSeriesShapes(true);
setSquareMarkers(true);
setCurveFitType(getSeries(0),0);
setTransparentFillColor(getSeries(1),false);
setMarkerShape(getSeries(0),3);
setMarkerShape(getSeries(1),5);
setMarkerShape(getSeries(2),1);
setTextString(getO1Title(),"");
setTextString(getY1Title(),"");
setDisplay(getReferenceLineY1(0),false);
setDisplay(getY1MajorTick(),true);setTickStyle(getY1MajorTick(),4);
setDisplay(getBeveledRiser(),false);
setExtendToFrameEdge(false);
setTextRotation(getDataText(),0);
setLabelStagger(getY1Label(),false);
setFontName(getO1Label(),"Arial");
setTextRotation(getO1Label(),3);
setTransparentBorderColor(getChartBackground(),false);
ENDSTYLE
ON GRAPH SET STYLE *
DEFMACRO=COND0001, COLOR=RGB(0 0 255), WHEN=N1 EQ 'A', $
DEFMACRO=COND0002, COLOR=RGB(255 0 255), WHEN=N1 EQ 'B', $
DEFMACRO=COND0003, COLOR=RGB(0 255 0), WHEN=N1 EQ 'C', $
TYPE=REPORT, FONT='ARIAL', SIZE=10, GRID=OFF, SQUEEZE=ON, $
TYPE=HEADING, LINE=1, ITEM=1, OBJECT=TEXT, FONT='ARIAL', SIZE=10, STYLE=BOLD, JUSTIFY=RIGHT,COLOR=RGB(150 150 150),BACKCOLOR='NONE',$
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0002, $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0001, $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0003, $
ENDSTYLE
END
May 12, 2010, 05:58 PM
Waz
I used the style with one of my graphs and it looks fine.

Could it be something to do with the template? Confused


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!

May 13, 2010, 01:49 AM
Shamitha
If all the group values are there(eg:A,B,C) it works fine but if one of the group is absent then it displays differently. Like if A is absent then the legend marker will still display the color of series A.


Web Focus 7.6.9
Platform – Windows
Output formats - HTML,PDF,Excel
May 13, 2010, 01:58 AM
Waz
Are you able to repro with one of the IBI sample files ?

This way we can run the code and check it.


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!

May 18, 2010, 06:34 AM
Shamitha
GRAPH FILE CAR
SUM DEALER_COST
BY CAR
ACROSS COUNTRY
WHERE CAR IN('ALFA ROMEO','DATSUN','BMW','JAGUAR');
HEADING
""
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO ON
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 1
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBIDefault.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
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);
setMarkerDisplay(true);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(true);
setO1AxisSide(0);
setO1MajorGridDisplay(false);
setO1MinorGridDisplay(true);
setO1MinorGridStyle(3);
setAxisAssignment(0,0);
setSeriesType(0,2);
setY1LabelDisplay(true);
setY1AxisSide(0);
setY1MustIncludeZero(true);
setY1MajorGridDisplay(true);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setTextFormatPattern(getY1Label(),"#.##");
setPieFeelerTextDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setRiserBorderMode(1);
setSeriesDefaultTransparentBorderColor(true);
setUseSeriesBorderDefaults(true);
setLegendDisplay(true);
setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setTextJustHoriz(getO1Title(),1);
setFontSizeAbsolute(getO1Title(),true);
setFontSize(getO1Title(),12);
setTextRotation(getO1Title(),0);
setTextWrap(getO1Title(),false);
setTextJustHoriz(getO1Label(),0);
setTextWrap(getO1Label(),false);
setPlaceResize(getO1Title(),0);
setPlaceRotate(getO1Title(),0);
setPlaceAlign(getO1Title(),0);
setPlaceWordWrap(getO1Title(),0);
setPlaceResize(getO1Label(),0);
setPlaceRotate(getO1Label(),0);
setPlaceAlign(getO1Label(),0);
setPlaceWordWrap(getO1Label(),0);
setPlace(true);
setDepthRadius(0);
setDepthAngle(0);
setTransparentFillColor(getLegendArea(),false);
setLegendOrient(1);
setDisplay(getBeveledLegend(),false);
setFillColor(getLegendArea(),new Color(255,255,255));
setLineStyleLegendMarkers(2);
setFillColor(getLegendLabelMarker(1),new Color(255,0,128));
setMarkerShape(getLegendLabelMarker(0),1);
setColorMode(0);
setFontName(getDataText(),"Arial");
setFontName(getPieLabel(),"Arial");
setFontName(getPieBarLabel(),"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");
setUseSeriesShapes(true);
setSquareMarkers(true);
setCurveFitType(getSeries(0),0);
setTransparentFillColor(getSeries(1),false);
setFillColor(getSeries(1),new Color(255,0,255));
setMarkerShape(getSeries(0),3);
setMarkerShape(getSeries(1),1);
setTextString(getO1Title(),"");
setTextString(getY1Title(),"");
setDisplay(getReferenceLineY1(0),false);
setDisplay(getY1MajorTick(),true);setTickStyle(getY1MajorTick(),4);
setDisplay(getBeveledRiser(),false);
setExtendToFrameEdge(false);
setTextRotation(getDataText(),0);
setLabelStagger(getY1Label(),false);
setFontName(getO1Label(),"Arial");
setTextRotation(getO1Label(),3);
setTransparentBorderColor(getChartBackground(),false);
setTextFormatPreset(getY1Label(),1);
ENDSTYLE
ON GRAPH SET STYLE *
DEFMACRO=COND0001, WHEN=N1 EQ 'DATSUN', $
DEFMACRO=COND0002, WHEN=N1 EQ 'ALFA ROMEO', $
DEFMACRO=COND0003, WHEN=N1 EQ 'BMW', $
DEFMACRO=COND0004, WHEN=N1 EQ 'JAGUAR', $
TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, GRID=OFF, SQUEEZE=ON, $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0001, COLOR=RGB(0 0 255), $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0002, COLOR=RGB(255 0 255), $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0003, COLOR=RGB(0 128 0), $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0004, COLOR=RGB(0 128 255), $
ENDSTYLE
END

I have created the graph with the CAR file. You can see that I am not able to control the color of the marker in the legend. I want the marker in the legend to have the same color as the series.


Web Focus 7.6.9
Platform – Windows
Output formats - HTML,PDF,Excel
May 18, 2010, 05:50 PM
Waz
Looks like it is something to do with the conditional styling.

ON GRAPH SET STYLE *
DEFMACRO=COND0001, WHEN=N1 EQ 'DATSUN', $
DEFMACRO=COND0002, WHEN=N1 EQ 'ALFA ROMEO', $
DEFMACRO=COND0003, WHEN=N1 EQ 'BMW', $
DEFMACRO=COND0004, WHEN=N1 EQ 'JAGUAR', $
TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, GRID=OFF, SQUEEZE=ON, $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0001, COLOR=RGB(0 0 255), $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0002, COLOR=RGB(255 0 255), $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0003, COLOR=RGB(0 128 0), $
TYPE=DATA, ACROSSCOLUMN=N1, MACRO=COND0004, COLOR=RGB(0 128 255), $
ENDSTYLE


I removed it and the markers ended up the same as the lines.


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!