I am doing a ring pie chart in which I am using a style sheet that was provided by IBI. I am doing filtering using java script in a BI Portal but even if I do filtering via auto prompt. The end result is a chart that has a RYG status and I want the colors to be consistent on the filters.
I did a sample of this using the car file and have included the below code. When I am doing filtering and select Japan and then Italy the colors match up to what is in the legend for England and France.
I'm wanting it to no matter the selections it keeps the colors intact. Has anyone had this issue before and how was it corrected?
-* File: IBFS:/Uat/WFC/Repository/Retail2/Chart2.fex Created by WebFOCUS AppStudio -*IA_GRAPH_BEGIN -*Do not delete or modify the comments below *-INTERNAL_COMMENT LINE#0$PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0xLjAtLT48Um9vdCB2ZXJzaW9uPSIxLjAiPgogICAgPE9iamVjdCBvYmplY3RJZD0iQ2hhcnRfMSI+CiAgICAgICAgPFByb3BlcnR5IG5hbWU9IkxpbmtlZFNvcnRzIiB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIi8+CiAgICA8L09iamVjdD4KICAgIDxPYmplY3Qgb2JqZWN0SWQ9IkdMT0JBTCI+CiAgICAgICAgPFByb3BlcnR5IG5hbWU9IlNhbXBsZURhdGEiIHR5cGU9ImphdmEubGFuZy5Cb29sZWFuIj5mYWxzZTwvUHJvcGVydHk+CiAgICAgICAgPFByb3BlcnR5IG5hbWU9Ikdsb2JhbFJlY29yZExpbWl0IiB0eXBlPSJqYXZhLmxhbmcuU3RyaW5nIj41MDA8L1Byb3BlcnR5PgogICAgICAgIDxQcm9wZXJ0eSBuYW1lPSJHbG9iYWxSdW5SZWNvcmRMaW1pdCIgdHlwZT0iamF2YS5sYW5nLlN0cmluZyI+MDwvUHJvcGVydHk+CiAgICAgICAgPFByb3BlcnR5IG5hbWU9Ikdsb2JhbE9wdGltaXphdGlvbiIgdHlwZT0iamF2YS5sYW5nLkJvb2xlYW4iPnRydWU8L1Byb3BlcnR5PgogICAgICAgIDxQcm9wZXJ0eSBuYW1lPSJ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y5TdHJpbmciPmNhcjwvRW50cnk+CiAgICAgICAgPC9Qcm9wZXJ0eT4KICAgICAgICA8UHJvcGVydHkgbmFtZT0ibWV0YWRhdGFWaWV3QXMiIHR5cGU9Ik1hcCI+CiAgICAgICAgICAgIDxFbnRyeSBrZXk9ImNhciIgdHlwZT0iamF2YS5sYW5nLlN0cmluZyI+TWV0YURhdGFUcmVlLlZJRVdfRElNUzwvRW50cnk+CiAgICAgICAgPC9Qcm9wZXJ0eT4KICAgICAgICA8UHJvcGVydHkgbmFtZT0iZW5hYmxlUHJldmlldyIgdHlwZT0iamF2YS5sYW5nLkJvb2xlYW4iPnRydWU8L1Byb3BlcnR5PgogICAgPC9PYmplY3Q+CjwvUm9vdD4K -*Do not delete or modify the comments above ENGINE INT CACHE SET ON -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 CNT.CAR.COMP.CAR BY CAR.ORIGIN.COUNTRY WHERE CAR.ORIGIN.COUNTRY EQ &COUNTRY.(OR(FIND CAR.ORIGIN.COUNTRY IN CAR |FORMAT=A10)).COUNTRY:.; ON GRAPH PCHOLD FORMAT JSCHART ON GRAPH SET VZERO OFF ON GRAPH SET HTMLENCODE ON ON GRAPH SET GRAPHDEFAULT OFF 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 0 ON GRAPH SET GRLEGEND 1 ON GRAPH SET GRXAXIS 0 ON GRAPH SET LOOKGRAPH PIERING ON GRAPH SET AUTOFIT ON ON GRAPH SET STYLE * *GRAPH_SCRIPT setPieDepth(0); setPieTilt(0); setDepthRadius(0); setCurveFitEquationDisplay(false); setPlace(true); setPieFeelerTextDisplay(1); *END INCLUDE=IBFS:/WFC/Repository/STAR/styles/Warm.sty,$ TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $ *GRAPH_SCRIPT setReportParsingErrors(false); setSelectionEnableMove(false); *END ENDSTYLE END -RUNThis message has been edited. Last edited by: wlwright1,
8.1.0.4 Windows 7 Excel, AHTML, HTML,PDF
September 15, 2015, 12:23 PM
Chad Miller
Please post your code.
WebFOCUS 8105 Windows, All Outputs
September 15, 2015, 01:22 PM
MartinY
Looks like it's something regarding the style sheet which we can't see....
Or if you're trying to always have the same slice's color, add the following. But you will need to add as many getSeries(x) as you may have slice (to have it dynamic, you'll need to create some code):
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 15, 2015, 02:19 PM
wlwright1
do you want me to include the part of the sty sheet for the graph?
8.1.0.4 Windows 7 Excel, AHTML, HTML,PDF
September 15, 2015, 02:23 PM
Chad Miller
I am slightly confused on what is actually wanting to be achieved. I believe wlwright1 is looking to color a slice based on the country, no matter which combination of countries are select. For example, England always appears blue, and no other country appears blue. Won't this:
produce the same thing as any generic style sheet?
WebFOCUS 8105 Windows, All Outputs
September 15, 2015, 02:23 PM
Chad Miller
Yes, please include the style sheet in the discussion.
WebFOCUS 8105 Windows, All Outputs
September 15, 2015, 02:27 PM
MartinY
Do we answered your question already ?
Is that what you're looking for : have the slice's color always the same ?
Or always have the same slice's color for the for the country ? Example : Italy in blue, France in yellow, England in red, ...
You should try to reproduce your request using the CAR file, it will give us an example.
Maybe your style sheet is not the issue, but depending of what is your request and what is in the style sheet, it may be related to your issue.
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 15, 2015, 02:31 PM
MartinY
Chad,
To have the country always displayed with the same slice's color, you need to know which slice will be assigned to that country or assign a slice to a country yourself. Then you can assign a default color to that slice which remain the same all the time.
To perform this, some code as to be entered and I'm pretty sure that a style sheet will not be able. It has to be dynamic.
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 15, 2015, 02:32 PM
wlwright1
Yes it is. Here is the setFillColor's for the different series.
My thoughts are that whatever the number of items they fit into the series order. So if I select Italy and England it would be Series 0 and Series 1.
The only thing I think of is to do a define and then do conditional formatting and specify the colors. Exclude the stylesheet altogether?
Would that work?
8.1.0.4 Windows 7 Excel, AHTML, HTML,PDF
September 15, 2015, 02:37 PM
MartinY
quote:
*GRAPH_SCRIPT setFillColor(getSeries(0),new Color(#526F35)); setFillColor(getSeries(1),new Color(#e1542b)); setFillColor(getSeries(2),new Color(#fee08b)); setFillColor(getSeries(3),new Color(#b2df8a)); setFillColor(getSeries(4),new Color(#1f78b4)); setFillColor(getSeries(5),new Color(#ffb061)); My thoughts are that whatever the number of items they fit into the series order. So if I select Italy and England it would be Series 0 and Series 1.
And what if I chose France and Japan, display with series 0 and 1 or with another series ?
And if I chose England, France, Italy and Japan, should they be displayed with : England series (0), France Series(1), Italy series(2), Japan series(3) ? Which will be the case actually or should always be Italy series(0), England series(1) ?
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 15, 2015, 02:37 PM
Chad Miller
I am still confused, what are you trying to do? Answer this question from Martin.
quote:
Is that what you're looking for : have the slice's color always the same ?
Or always have the same slice's color for the for the country ? Example : Italy in blue, France in yellow, England in red, ...
WebFOCUS 8105 Windows, All Outputs
September 15, 2015, 02:49 PM
wlwright1
Yes I'm looking to to someone selects England then it be blue, France - red and so on. So no matter the selections the color is consistant.
8.1.0.4 Windows 7 Excel, AHTML, HTML,PDF
September 15, 2015, 03:23 PM
MartinY
This may do the trick, but you may have to play around a little:
-*-SET &CNTRY = 'FRANCE';
-*-SET &CNTRY = 'ITALY';
-SET &CNTRY = FOC_NONE;
TABLE FILE CAR
PRINT COMPUTE ROWID /P2 = ROWID + 1; NOPRINT
COMPUTE SERIES /P2 = ROWID - 1; NOPRINT
COMPUTE COLOR /A11V = DECODE COUNTRY ('FRANCE' '255,0,0' 'ENGLAND' '0,255,0' 'ITALY' '0,0,255' 'JAPAN' '100,100,100' ELSE '200,200,200'); NOPRINT
COMPUTE SETCOLOR /A51V = 'setFillColor(getSeries(' || EDIT(SERIES) || '),new Color(' || COLOR || '));';
BY COUNTRY NOPRINT
BY ROWID
WHERE COUNTRY EQ '&CNTRY';
ON TABLE HOLD AS SETCOL FORMAT BINARY
END
-RUN
-SET &NBROWS = &LINES;
-* LOOP TO INITIALIZE COLORSET
-REPEAT CSET FOR &Y FROM 1 TO 5 STEP 1
-SET &COLSET.&Y = '';
-CSET
-* LOOP TO SET COLSET TO PROPER VALUE
-SET &Y = 0;
-NEXTSET
-SET &Y = &Y + 1;
-READFILE SETCOL
-RUN
-SET &COLSET.&Y = &SETCOLOR;
-IF &Y LT &NBROWS THEN GOTO NEXTSET;
-* -------------------------------------------------
-* CREATE BAR GRAPH
-* -------------------------------------------------
GRAPH FILE CAR
SUM RETAIL_COST AS ''
BY COUNTRY
WHERE COUNTRY EQ '&CNTRY';
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET VZERO OFF
ON GRAPH SET HAXIS 770
ON GRAPH SET VAXIS 405
ON GRAPH SET UNITS PIXELS
ON GRAPH SET LOOKGRAPH PIESINGL
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 1
ON GRAPH SET GRXAXIS 0
ON GRAPH SET GRAPHSTYLE *
setTemplateFile("/images/tdg/template/IBISouthWestern.txt");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setTransparentBorderColor(getChartBackground(),true);
setTransparentBorderColor(getSeries(0),true);
setTransparentBorderColor(getSeries(1),true);
setTransparentBorderColor(getSeries(2),true);
setTransparentBorderColor(getSeries(3),true);
setTransparentBorderColor(getSeries(4),true);
setTransparentBorderColor(getSeries(5),true);
setPlace(true);
&COLSET1.EVAL
&COLSET2.EVAL
&COLSET3.EVAL
&COLSET4.EVAL
&COLSET5.EVAL
ENDSTYLE
END
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 16, 2015, 08:31 AM
eric.woerle
You can use conditional styling in a graph just like you would I'm a report.
Eric Woerle 8.1.05M Gen 913- Reporting Server Unix 8.1.05 Client Unix Oracle 11.2.0.2
September 16, 2015, 11:04 AM
J.L. Hinds
Not sure I'm on the same page as you but here is some code that I include to make sure colors match throughout the entire dashboard or PPT deck.
J.L., as far as I know this will work in a report for the data's color, not for slice's color in a graph which have a different syntax.
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 22, 2015, 07:57 AM
wlwright1
I ended up using the Traffic Lights on the Sum field. I was able to select multiple different items and it did stick with the colors. The legend didn't show the correct colors but I think that has to setting the conditions vs the colors via stylesheet or at the series level.
8.1.0.4 Windows 7 Excel, AHTML, HTML,PDF
September 23, 2015, 11:30 AM
J.L. Hinds
Martin, that's the code I use to make sure the information on a pie chart matches the colors on an hbar chart.