Jump to content

Hey all, I have what I thought was a not-so-niche issue, but...


John Coleman 3

Recommended Posts

Hey all,

I have what I thought was a not-so-niche issue, but I cant find anything on it. I am creating a chart on Designer, easy peasy. We want to keep the color flow the same based on a min and max value, NOT what you are filtered on.

For example, values range from 0 - 100, so it flows from red to yellow to green respectively, When a user filters the data and the result range is 40 - 60, I want the output to still remain in that yellow range and not reset to green at 40 and red at 60. Is this possible

John

Link to comment
Share on other sites

  • 2 weeks later...

Hi John,

Although there is no option specifically in the Designer interface to achieve this, if you are willing to use the text editor you can set start points for different colors in a color scale using the colorScale:colors:start property. If you set a static start value for each color in the color scale, these start points will not change with changes in your data. You can create the basic chart in WebFOCUS Designer, and then edit it in the text editor by right-clicking it and clicking Edit with text editor. You can also create a new procedure using only the text editor by clicking Other on the Action bar on the Workspaces view of the WebFOCUS Home Page and then clicking Text Editor to create a FOCEXEC procedure.

For example, the color scale in the following procedure starts red at 0, turns yellow at 250K, and turns green at 500K (you can run this procedure from text editor if you have the wf_retail sample files):

GRAPH FILE WF_RETAIL_LITE

SUM REVENUE_US QUANTITY_SOLD

BY PRODUCT_CATEGORY

ON GRAPH PCHOLD FORMAT JSCHART

ON GRAPH SET LOOKGRAPH BAR

ON GRAPH SET STYLE *

TYPE=DATA, COLUMN=N1, BUCKET=x-axis,$

TYPE=DATA, COLUMN=N2, BUCKET=y-axis,$

TYPE=DATA, COLUMN=N3, BUCKET=color,$

*GRAPH_JS_FINAL

"yaxis": {"majorGrid": {"visible": false}},

"xaxis": {"majorGrid": {"visible": false}},

"colorScale": {

"colors": [

{"start": 0, "color": "red"},

{"start": 250000, "color": "yellow"},

{"start": 500000, "color": "green"}

] }

*END

ENDSTYLE

END

 

In the following example, the chart is now filtered, but still changes to yellow at 250K and green at 500K:

GRAPH FILE WF_RETAIL_LITE

SUM REVENUE_US QUANTITY_SOLD

BY PRODUCT_CATEGORY

WHERE TOTAL QUANTITY_SOLD LE 500000;

ON GRAPH PCHOLD FORMAT JSCHART

ON GRAPH SET LOOKGRAPH BAR

ON GRAPH SET STYLE *

TYPE=DATA, COLUMN=N1, BUCKET=x-axis,$

TYPE=DATA, COLUMN=N2, BUCKET=y-axis,$

TYPE=DATA, COLUMN=N3, BUCKET=color,$

*GRAPH_JS_FINAL

"yaxis": {"majorGrid": {"visible": false}},

"xaxis": {"majorGrid": {"visible": false}},

"colorScale": {

"colors": [

{"pin": 0, "color": "red"},

{"start": 250000, "color": "yellow"},

{"start": 500000, "color": "green"}

] }

*END

ENDSTYLE

END

 

So for your example, if you want, for instance, 0-30 to be red, 30-60 to be yellow, and 60 and higher to be green, you could use the following properties in the *GRAPH_JS_FINAL block of the chart procedure:

"colorScale": {

"colors": [

{"start": 0, "color": "red"},

{"start": 30, "color": "yellow"},

{"start": 60, "color": "green"}

] }

 

See pp. 813 and 816 in https://webfocusinfocenter.informationbuilders.com/wfdesigner/pdfs7/wfjschart8207.pdf for documentation, and let me know if you have any questions.

Thanks,

Alex

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...