Focal Point
[CLOSED]Setting a proper interval when using error bars

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

May 16, 2016, 02:06 PM
Barry Solomon
[CLOSED]Setting a proper interval when using error bars
Hi

There is a requirement to use Error Bars to set the range of the first standard deviation on a graph the displays the Mean. I am very close but the interval is set by taking the Upper Standard Deviation and dividing by 9(intervals) to get the inverval setting. A condition can occur where the interval value .4 can display properly (.4, .8, 1.2, 1.6, 2, 2.4, 2.8, 3) except for the last value of 3.0 it really should be 3.2 to be consistant. I will post the code but its a little messy(sorry):

-DEFAULTH &WF_TITLE='WebFOCUS Report';
-DEFAULTH &WF_STYLE_UNITS='PIXELS';
-DEFAULTH &WF_STYLE_HEIGHT='405.0';
-DEFAULTH &WF_STYLE_WIDTH='770.0';
-SET &ECHO=ALL;


DEFINE FILE METRICSCORES
BLL1/A20 = FTOA(BLL,'(D12.5)','A20');
BLU1/A20 = FTOA(BLU,'(D12.5)','A20');
DCL1/A20 = FTOA(DCL,'(D12.5)','A20');
DCU1/A20 = FTOA(DCU,'(D12.5)','A20');
CHL1/A20 = FTOA(CHL,'(D12.5)','A20');
CHU1/A20 = FTOA(CHU,'(D12.5)','A20');


BLtip1/A20 = FTOA(BLNMEAN,'(D15.5)','A20');
BLtip2/A20 = FTOA(BLSTD,'(D15.5)','A20');
BLtip/A52 = 'Mean: ' || BLtip1 || ' STD: ' || BLtip2;

DCtip1/A20 = FTOA(DCNMEAN,'(D15.5)','A20');
DCtip2/A20 = FTOA(DCSTD,'(D15.5)','A20');
DCtip/A52 = 'Mean: ' || DCtip1 || ' STD: ' || DCtip2 ;

CHtip1/A20 = FTOA(CDBMEAN,'(D15.5)','A20');
CHtip2/A20 = FTOA(CHSTD,'(D15.5)','A20');
CHtip/A52 = 'Mean: ' || CHtip1 || ' STD: ' || CHtip2 ;

AGEtip1/A20 = FTOA(AGEMEAN,'(D15.5)','A20');
AGEtip2/A20 = FTOA(AGESTD,'(D15.5)','A20');
AGEtip/A52 = 'Mean: ' || AGEtip1 || ' STD: ' || AGEtip2 ;

AGEL1/A20 = FTOA(AGEL,'(D12.5)','A20');
AGEU1/A20 = FTOA(AGEU,'(D12.5)','A20');


END
TABLE FILE METRICSCORES
PRINT BLL1 BLU1 DCL1 DCU1 CHL1 CHU1 BLtip DCtip CHtip AGEtip AGEL1 AGEU1
WHERE METRICNAME EQ 'Gait Speed';

ON TABLE HOLD AS LIMITS1
END
-RUN
-READ LIMITS1 &BLL.20.&BLU.20.&DCL.20.&DCU.20.&CHL.20.&CHU.20.&BTIP.52.&DTIP.52.&CTIP.52.&AGETIP.52.&AGEL.20.&AGEU.20.

-SET &maxy = IF (&BLU GT &DCU AND &BLU GT &CHU ) THEN &BLU ELSE IF (&DCU GT &BLU AND &DCU GT &CHU ) THEN &DCU ELSE &CHU ;
-SET &interval = &maxy/9;



END
-SET &BTIP = '''' || &BTIP || '''';
-SET &DTIP = '''' || &DTIP || '''';
-SET &CTIP = '''' || &CTIP || '''';
-SET &AGETIP = '''' || &AGETIP || '''';

-RUN


GRAPH FILE METRICSCORES
-* Created by Info Assist for Graph
SUM BLNMEAN AS 'Baseline Mean' DCNMEAN AS 'Discharge Mean' CDBMEAN AS 'Change Mean'
BY METRICSCORES.SEG01.METRICNAME
WHERE METRICNAME EQ 'Gait Speed';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET HAXIS &WF_STYLE_HEIGHT
ON GRAPH SET VAXIS &WF_STYLE_WIDTH
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 0
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=endeflt.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(2), true);
setDisplay(getDataText(1), true);
setDisplay(getDataText(0), true);
setScaleMax(getY1Axis(),&maxy);
setTextString(getY1Title(),"Feet Together");
setDataTextPosition(5);
*END
*GRAPH_JS
mouseOverIndicator: {enabled: true,color: ' '},
introAnimation: {enabled: true, duration: 1000 },
border: {width: 1, color: 'navy'},

fill: {
color: {type: 'linear',start: {x: '0%', y: '0%'},end: {x: '100%', y: '100%'},stops: [
[0, 'tan'],[1, 'ghostwhite'],],}},



yaxis: {title: {visible: true, color: 'navy'},ticks: {style: 'span'},
labels: {color: 'navy', font: 'bold 12pt Bookman Old Style'},
intervalMode: 'interval', intervalValue: &interval
},

legend: {visible: true, position: 'bottom'},



errorBars: {
hatWidth: '50%',
yData: [[ &BLL, &BLU ],[ &DCL ,&DCU ],[ &CHL ,&CHU ],[ &AGEL ,&AGEU ]],
line: {color: 'orangered',width: 3,SOLID: '2 2'},
marker: {color: 'linear-gradient(0,0,100%,100%, 20% teal, 95% cyan)',shape: 'square', size: 25,} },

series: [
{series: 0, color: 'teal', tooltip: &BTIP },
{series: 1, color: 'turquoise', tooltip: &DTIP },
{series: 2, color: 'lightseagreen', tooltip: &CTIP },
{series: 3, color: 'green', tooltip: &AGETIP },

]
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH

Thanks for any thoughts
Barry Solomon

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8
Windows, All Outputs
May 18, 2016, 03:32 PM
Tamra
Hi Barry,

Can you provide a screenshot of the graph you have now?

The picture might help with understanding what you are trying to do.

Here is a link related to Drawing Error Bars (errorBars)

There is an Graph example in the link using the WF_retail_lite data too.


Thank you for participating in the Focal Point Forum.

Kindest regards,
Tamra Colangelo
Focal Point Moderator - Information Builders Inc.
* Summit 2016 – June 13-17 in Reno, Nevada  - http://www.informationbuilders.com/events/summit


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
August 29, 2016, 10:01 AM
Barry Solomon
Hi All

I actually found a solution for the issue. Below is the code I used. In the chart common I built a fex and saved the results In a table then did a -READ to get the data points for the graph.

-SET &whereclause = 'WHERE METRICNAME EQ ''Six-Minute Walk Test Distance'' ';
-INCLUDE chartcommon

-*-RUN
DEFINE FILE METRICSCORES
metricN/A100 = 'Six-Minute Walk Test';
END


GRAPH FILE METRICSCORES
-* Created by Info Assist for Graph
SUM BLNMEAN AS 'Baseline Mean' DCNMEAN AS 'Discharge Mean' CDBMEAN AS 'Change Mean'
-*AGEMEAN AS 'Age Mean'
-*,[ &AGEL ,&AGEU ]
BY metricN

WHERE METRICNAME EQ 'Six-Minute Walk Test Distance';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET HAXIS &WF_STYLE_HEIGHT
ON GRAPH SET VAXIS &WF_STYLE_WIDTH
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 0
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET EMBEDHEADING ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=endeflt.sty,$
TYPE=FOOTING, JUSTIFY = LEFT,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getDataText(3), true);
setDisplay(getDataText(2), true);
setDisplay(getDataText(1), true);
setDisplay(getDataText(0), true);
setScaleMax(getY1Axis(),&maxy);
setScaleMin(getY1Axis(),&miny);
setTextString(getY1Title(),"Feet");
setDataTextPosition(5);
*END
*GRAPH_JS
mouseOverIndicator: {enabled: true,color: ' '},
introAnimation: {enabled: true, duration: 1000 },
border: {width: 1, color: 'navy'},

fill: {
color: {type: 'linear',start: {x: '0%', y: '0%'},end: {x: '100%', y: '100%'},stops: [
[0, 'tan'],[1, 'ghostwhite'],],}},

yaxis: {title: {visible: true, color: 'navy'},ticks: {style: 'span'},
labels: {color: 'navy', font: 'bold 12pt '},
intervalMode: 'interval', intervalValue: &interval },
dataLabels: {visible: true,font: 'bold 12pt ', color: 'black', position: 'middle', },

legend: {visible: true, position: 'bottom'},

errorBars: {
hatWidth: '20%',
yData: [[ &BLL, &BLU ],[ &DCL ,&DCU ],[ &CHL ,&CHU ]],
line: {color: 'orangered',width: 1,dash: '2 2', errorBarAlpha: 10},
marker: {color: 'linear-gradient(0,0,100%,100%, 20% teal, 95% cyan)',shape: 'square', size: 25,} },

series: [
{series: 0, color: 'rgb(39,89,142)', tooltip: &BTIP },
{series: 1, color: 'rgb(60,140,200)', tooltip: &DTIP },
{series: 2, color: 'rgb(141,193,63)', tooltip: &CTIP },

]
//teal
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH


WebFOCUS 8
Windows, All Outputs