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.
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.
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.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
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.