Focal Point
[CLOSED]Traffic Lights Bar/Line Chart

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

April 05, 2016, 04:48 PM
Scott Matson
[CLOSED]Traffic Lights Bar/Line Chart
I have a chart with 2 series: 1 line and 1 bar. The bar is number of complaints per month. The line is the upper control limit per month. I want the bar series to be red if it is greater than the line graph for that month, and green if it is lower than the line graph for that month. The Traffic Light GUI does not seem to be doing what I would expect it to do. In fact, all it does it make the first bar data point in that series red and the rest are the default color of blue.

I'm on 8105, btw.

Here's my code:


-*IA_GRAPH_BEGIN
-*Do not delete or modify the comments below
*-INTERNAL_COMMENT LINE#0$PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8IS0tMS4wLS0+DQo8Um9vdCB2ZXJzaW9uPSIxLjAiPg0KICAgIDxPYmplY3Qgb2JqZWN0SWQ9IkNoYXJ0XzEiPg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0iTGlua2VkU29ydHMiIHR5cGU9ImphdmEubGFuZy5TdHJpbmciLz4NCiAgICA8L09iamVjdD4NCiAgICA8T2JqZWN0IG9iamVjdElkPSJHTE9CQUwiPg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0iU2FtcGxlRGF0YSIgdHlwZT0iamF2YS5sYW5nLkJvb2xlYW4iPmZhbHNlPC9Qcm9wZXJ0eT4NCiAgICAgICAgPFByb3BlcnR5IG5hbWU9Ikdsb2JhbFJlY29yZExpbWl0IiB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIj41MDA8L1Byb3BlcnR5Pg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0iR2xvYmFsUnVuUmVjb3JkTGltaXQiIHR5cGU9ImphdmEubGFuZy5TdHJpbmciPjA8L1Byb3BlcnR5Pg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0iZmllbGREaXNwbGF5TW9kZSIgdHlwZT0iamF2YS5sYW5nLlN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ZyI+Q0FSQl9DTVBMVF9ST0xMU19TSEVFVFNfREFUQV8yMjk8L0VudHJ5Pg0KICAgICAgICA8L1Byb3BlcnR5Pg0KICAgICAgICA8UHJvcGVydHkgbmFtZT0ibWV0YWRhdGFWaWV3QXMiIHR5cGU9Ik1hcCI+DQogICAgICAgICAgICA8RW50cnkga2V5PSJDQVJCX0NNUExUX0RBVEFfMjI5IiB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIj5NZXRhRGF0YVRyZWUuVklFV19UUkVFPC9FbnRyeT4NCiAgICAgICAgICAgIDxFbnRyeSBrZXk9IkNBUkJfQ01QTFRfUk9MTFNfU0hFRVRTX0RBVEFfMjI5IiB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIj5NZXRhRGF0YVRyZWUuVklFV19ESU1TPC9FbnRyeT4NCiAgICAgICAgPC9Qcm9wZXJ0eT4NCiAgICAgICAgPFByb3BlcnR5IG5hbWU9ImVuYWJsZVByZXZpZXciIHR5cGU9ImphdmEubGFuZy5Cb29sZWFuIj50cnVlPC9Qcm9wZXJ0eT4NCiAgICA8L09iamVjdD4NCjwvUm9vdD4NCg==
-*Do not delete or modify the comments above
ENGINE INT CACHE SET ON
-DEFAULTH &WF_STYLE_UNITS='INCHES';
-DEFAULTH &WF_STYLE_HEIGHT='4.21875';
-DEFAULTH &WF_STYLE_WIDTH='8.020833';
-DEFAULTH &WF_TITLE='WebFOCUS Report';
GRAPH FILE CARB_CMPLT_ROLLS_SHEETS_DATA_229
-* Created by Info Assist for Graph
SUM CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CF_CPT
CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.UCL
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.PROD_FORM
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.ACCOUNTING_YEAR
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.ACCOUNTING_MONTH NOPRINT
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.ACCOUNTING_MONTH_NAME_SHORT
WHERE CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CURRENT_MONTH LE 24;
WHERE CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CURRENT_MONTH GE 1;
HEADING
"Carbonless Complaints"
ON GRAPH PCHOLD FORMAT PDF
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 3
ON GRAPH SET LOOKGRAPH VBAR
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,$
DEFMACRO=Condition_1, MACTYPE=RULE, WHEN=N5 GE CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.UCL, $
DEFMACRO=Condition_2, MACTYPE=RULE, WHEN=N5 LT CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.UCL, $
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=HEADING, JUSTIFY=CENTER, FONT='Trebuchet MS', SIZE=12, COLOR=RGB(66 70 73), STYLE=BOLD, $
TYPE=DATA, COLUMN=N5, MACRO=Condition_1, COLOR=RGB(255 0 0), $
TYPE=DATA, COLUMN=N5, MACRO=Condition_2, COLOR=RGB(0 128 64), $
*GRAPH_SCRIPT
setUseSeriesShapes(true);
setMarkerSizeDefault(50);
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesType(0,1);
setSeriesType(1,2);
setFillColor(getSeries(0),new Color(48,94,213));
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH


What am I doing wrong?

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


WebFOCUS 8007
April 06, 2016, 10:02 AM
Scott Matson
I have also tried creating a compute to say create the condition as well. It only applies the condition to the first bar on the chart (as in, the first record that it comes to).

GRAPH FILE CARB_CMPLT_ROLLS_SHEETS_DATA_229
-* Created by Info Assist for Graph
SUM CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CF_CPT
CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.UCL
COMPUTE ISRED/I1=IF CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CF_CPT GE CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.UCL THEN 1 ELSE 0; NOPRINT
COMPUTE ISGREEN/I1=IF CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CF_CPT LT CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.UCL THEN 1 ELSE 0; NOPRINT
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.PROD_FORM
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.ACCOUNTING_YEAR
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.ACCOUNTING_MONTH NOPRINT
BY CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.ACCOUNTING_MONTH_NAME_SHORT
WHERE CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CURRENT_MONTH LE 24;
WHERE CARB_CMPLT_ROLLS_SHEETS_DATA_229.SEG01.CURRENT_MONTH GE 1;
HEADING
"Carbonless Complaints"
ON GRAPH PCHOLD FORMAT PDF
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET UNITS &WF_STYLE_UNITS
ON GRAPH SET HAXIS &WF_STYLE_WIDTH
ON GRAPH SET VAXIS &WF_STYLE_HEIGHT
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 1
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 3
ON GRAPH SET LOOKGRAPH VBAR
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,$
DEFMACRO=Condition_1, MACTYPE=RULE, WHEN=N8 EQ 1, $
DEFMACRO=Condition_2, MACTYPE=RULE, WHEN=N8 EQ 0, $
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
TYPE=HEADING, JUSTIFY=CENTER, FONT='Trebuchet MS', SIZE=12, COLOR=RGB(66 70 73), STYLE=BOLD, $
TYPE=DATA, COLUMN=N5, MACRO=Condition_1, COLOR=RGB(0 128 64), $
TYPE=DATA, COLUMN=N5, MACRO=Condition_2, COLOR=RGB(255 0 0), $
*GRAPH_SCRIPT
setUseSeriesShapes(true);
setMarkerSizeDefault(50);
setReportParsingErrors(false);
setSelectionEnableMove(false);
setSeriesType(0,1);
setSeriesType(1,2);
setFillColor(getSeries(0),new Color(48,94,213));
*END
ENDSTYLE
END
-RUN


WebFOCUS 8007
April 06, 2016, 10:45 AM
PBax
Have you tried adding NOPRINT to all your BY fields?


81.05 All formats
April 06, 2016, 10:58 AM
Scott Matson
Ok, that seemed to make the traffic light condition work, but it doesn't solve the problem. My chart spans 3 years, so I need the "by year" to show up.


WebFOCUS 8007
April 07, 2016, 03:18 AM
PBax
Without knowing your spec or trying to replicate with the car file.... how feasible is it to change YEAR to be primary 'by'?

I believe the traffic lights would work if YEAR was your first 'by' and removed the NOPRINT from it. You could show the YEAR in the heading.

Sorry just trying to guess without reproducing the report with different data here.


81.05 All formats