Focal Point
[SOLVED] Styling on Trend Lines

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

July 11, 2018, 03:53 PM
matthew_hinext
[SOLVED] Styling on Trend Lines
Hi all,

Is it possible to style a trend line independently of the series? When I try to specifically change the color of a trend line it changes the entire series to match.

We have a requirement where the trend line should be made a shade of grey so the main line is emphasized over the trend line.

I found this thread: http://forums.informationbuild...1057331/m/5647099966

But the solution did not do anything to my trend lines.

I should mention I'm using version 8201 and App Studio.

Thanks,
Matthew

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
July 11, 2018, 05:11 PM
Waz
What is the chart format ?

JSCHART ?


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!

July 11, 2018, 05:35 PM
matthew_hinext
Hi Waz,

Yes, it's a JSCHART.

ON GRAPH PCHOLD FORMAT JSCHART


WebFOCUS 8
Windows, All Outputs
July 11, 2018, 06:01 PM
Waz
Have a look at the documentation on JSCHART reference Lines

wfjschart82

You are on 8.2 ?


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!

July 12, 2018, 04:17 PM
matthew_hinext
Hi Waz,

Yes, I'm on 8.2.

Just to clarify, I'm not trying to add a reference line, I'm trying to get a linear trend line and then style it independently from the line graph it is showing the trend of. Correct me if I'm wrong, but it seems like reference lines can only be static horizontal and vertical lines.


Below is the style portion of my chart. I tried using the trend line syntax just below the reference line text but was not able to get a trend line to appear. When I add a trend line through the UI, it adds the two lines that are bolded below. I commented them out so I could verify that the new syntax is working, but I'm not able to get the trend line to appear.


ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
-*setCurveFitEquationDisplay(false);
setPlace(true);
setUseSeriesShapes(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N3, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setLabelStagger(getO1Label(),false);
setTextRotation(getO1Label(),0);
-*setCurveFitType(0,1);
*GRAPH_JS_FINAL
"trendline": {
"enabled": true,
"mode": 'linear',
"line": {"width": 2, "color": 'black', "dash": '' },
"equationLabel": { "visible": false, "color": 'black', "mode": 'equation' }
},
"pieProperties": {
"holeSize": "0%"
},
"blaProperties": {
"seriesLayout": "absolute"
},
"agnosticSettings": {
"chartTypeFullName": "Line_Absolute"
},
"xaxis": {
"title": {
"visible": false
}
}
*END
ENDSTYLE
END
-RUN


WebFOCUS 8
Windows, All Outputs
July 12, 2018, 05:24 PM
Waz
Apologies, meant to type trend, got reference on the brain.

So the trend line appears when those two line are in the chart ?


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!

July 13, 2018, 02:42 PM
matthew_hinext
It's this line that controls if the trend line appears:

setCurveFitType(0,1);

The other line simply controls if the equation for the line appears on the chart depending if it's set to true or false:

setCurveFitEquationDisplay(false);

Regardless, even when I include "setCurveFitType", the trend line styling code copied above does not affect how it is displayed.


WebFOCUS 8
Windows, All Outputs
July 19, 2018, 09:39 AM
matthew_hinext
Hi,

Any advice on this matter would be very helpful!

Thanks,
Matthew


WebFOCUS 8
Windows, All Outputs
July 20, 2018, 08:33 AM
Spence
This has worked for me in version 8.2.01. Changed the trend line color to red.
*GRAPH_JS
series: [
{series: 0, trendline: { lineStyle: {color: 'red'} } }
]
*END


WF 8 version 8.2.04. Windows.
In focus since 1990.
July 20, 2018, 10:09 AM
Spence
Sample with car file.

ENGINE INT CACHE SET ON
SET PAGE-NUM=NOLEAD
SET HTMLENCODE=ON
SET ARGRAPHENGINE=JSCHART
SET EMBEDHEADING=ON
SET GRAPHDEFAULT=OFF
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE car
-* Created by Info Assist for Graph
SUM CAR.BODY.SALES
BY CAR.ORIGIN.COUNTRY
ON GRAPH PCHOLD FORMAT JSCHART
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 LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setFillType(getSeries(0),2);
setGradientPinPosition0(getSeries(0),0.0);
setGradientPinPosition1(getSeries(0),1.0);
setTransparentBorderColor(getSeries(0), true);
setCurveFitType(0,1);
setFillColor(getSeries(0),new Color(255,0,0));
*END
*GRAPH_JS
series: [
{series: 0, trendline: { lineStyle: {color: 'blue'} } }
]
*END
ENDSTYLE
END
-RUN


WF 8 version 8.2.04. Windows.
In focus since 1990.
July 25, 2018, 02:11 PM
matthew_hinext
Thank you Spence!

This works, but only after I delete all of the other properties in the *GRAPH_JS_FINAL section of the code I posted above.


WebFOCUS 8
Windows, All Outputs