Focal Point
[CASE OPENED] Tag Cloud - One Plot Point

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

February 22, 2016, 08:41 AM
stur0063
[CASE OPENED] Tag Cloud - One Plot Point
I'm whipping up a tag cloud report.

When I only have one plot point - the graph doesn't render. I have checked out the Creating HTML5 Charts with WebFOUCS - but I don't see any mention of a single plot point not rendering.

Is there some set command that I'm missing to make a single plot render? Example below.

DEFINE FILE GGSALES
PROFIT/D12.2= DOLLARS-BUDDOLLARS ;
END
GRAPH FILE GGSALES
SUM PROFIT UNITS
BY PRODUCT
WHERE PRODUCT EQ 'Espresso'
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH TAGCLOUD
ON GRAPH SET STYLE *
*GRAPH_JS
yaxis: {colorScale: {
colors: ['red', 'black', 'green', 'blue', 'purple']
}
}
*END
ENDSTYLE
END
-RUN


-IF &RECORDS EQ 0 GOTO ERROR ELSE GOTO DONE

-ERROR
-HTMLFORM BEGIN
<html>
<head>
</head>
<body>


<div style="width:100%">
<span style="font-size:1.5em">No Data!</span><p></p>
</div>



</body>
</html>
-HTMLFORM END
-DONE

This message has been edited. Last edited by: stur0063,


webFOCUS 8207.15
WindowsServer 2019
February 24, 2016, 08:47 AM
Clayton Peacock
I get similar behaviour on 8105m, maybe try logging a call on TechSupport.

See new tagCloud just for interest:

DEFINE FILE GGSALES
PROFIT/D12.2= DOLLARS-BUDDOLLARS ;
END

GRAPH FILE GGSALES
SUM UNITS UNITS
BY PRODUCT
-*WHERE PRODUCT EQ 'Croissant';
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH TAGCLOUD
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setUseSeriesShapes(true);
setScaleMustIncludeZero(getX1Axis(), false);
setScaleMustIncludeZero(getY1Axis(), false);
setScaleMustIncludeZero(getY2Axis(), false);
setMarkerSizeDefault(60);
setMarkerSizeDefault(50);
setPieFeelerTextDisplay(1);
*END
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*END
*GRAPH_JS
tagcloudProperties: {engine: 'new'},
*END
ENDSTYLE
END
-RUN


WF 8.1.05, MRE, BI Portal, App Studio, Apache Tomcat/8.0.21, MS Windows Server 2014 Express, MS Windows 10, Chrome
February 29, 2016, 08:37 AM
stur0063
quote:
maybe try logging a call on TechSupport.

See new tagCloud just for interest:


I've opened a case.

Thanks for the tip on the new engine. It looks nice. However - when I toggled to the new engine - my drill downs stopped working....so I'm not sure if that's ready for prime time yet.


webFOCUS 8207.15
WindowsServer 2019
February 29, 2016, 03:41 PM
stur0063
I was told a tagcloud of one is odd - and the size rendered is calculated against the other values. Since there's only one - no soup for you.

I've put in a NFR for this.

My example is a TagCloud of Customers that order a product - so we can see our most and least profitable customers.

We have a few one off products that only one customer has ordered - so I'd argue that I'd still want to see that on a graph.

NFR has been submitted.


webFOCUS 8207.15
WindowsServer 2019
July 01, 2016, 10:51 AM
Mike in DeLand
I just tried that "new" engine and it didn't display all of my items - looks like it skipped 2 or 3 of them, and the colors I defined did not come out either. Won't be using that one for a while.


Webfocus 8
Windows, Linux
July 01, 2016, 11:20 AM
Squatch
quote:
Originally posted by Mike in DeLand:
I just tried that "new" engine and it didn't display all of my items - looks like it skipped 2 or 3 of them, and the colors I defined did not come out either. Won't be using that one for a while.

The new engine doesn't render any tags in IE 9.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
July 06, 2016, 02:52 PM
Maggie McBride
[QUOTE] and the colors I defined did not come out either.

I know this is an old post but I did get the color selection to work. see below.

 DEFINE FILE GGSALES
PROFIT/D12.2= DOLLARS-BUDDOLLARS ;
END

GRAPH FILE GGSALES
SUM UNITS UNITS
BY PRODUCT

ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET ARGRAPHENGIN JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET GRWIDTH 1
ON GRAPH SET GRMERGE ADVANCED
ON GRAPH SET GRMULTIGRAPH 0
ON GRAPH SET GRLEGEND 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH TAGCLOUD
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
setUseSeriesShapes(true);
setScaleMustIncludeZero(getX1Axis(), false);
setScaleMustIncludeZero(getY1Axis(), false);
setScaleMustIncludeZero(getY2Axis(), false);
setMarkerSizeDefault(60);
setMarkerSizeDefault(50);
setPieFeelerTextDisplay(0);
*END
*GRAPH_SCRIPT
setReportParsingErrors(false);
setSelectionEnableMove(false);
*END
*GRAPH_JS
tagcloudProperties: {engine: 'new'},
yaxis: {colorScale: {colors: ['PURPLE', 'SALMON', 'YELLOW', 'GREEN', 'AQUA']}},
*END
ENDSTYLE
END
-RUN

-*IA_GRAPH_FINISH 



WebFOCUS 8.1.04
Windows, All Outputs
July 07, 2016, 11:10 AM
Squatch
Here is a workaround for the original post. This does not work for the "new" engine.

The chart fails when there is only one product, so the trick is to insert a second "empty" product into the chart code.

So these lines...

script += 'setDataSeries(';
script += '1703.00);';
script += 'setDataSeries(';
script += '308986.00);';

script += 'setGroupLabelArray(';
script += '"Espresso");';

...need to be changed to look like this:

script += 'setDataSeries(';
script += '1703.00,0.00);';
script += 'setDataSeries(';
script += '308986.00,0.00);';

script += 'setGroupLabelArray(';
script += '"Espresso"," ");';

To do that, the chart can be placed in an -HTMLFORM with a hold file named !IBI.FIL.CHART commented out.

<div id="fix_tag_cloud">
<!--
!IBI.FIL.CHART;
-->
</div>

That stops the chart from rendering right away, and gives some jQuery code a chance to modify the chart code. When it is done doing that, it removes the original chart code from the HTML and inserts the updated code and the chart renders.

Because of the way the chart code is generated, the jQuery code will fail to update anything if there is more than one product.

DEFINE FILE GGSALES
PROFIT/D12.2= DOLLARS-BUDDOLLARS ;
END
GRAPH FILE GGSALES
SUM PROFIT UNITS
BY PRODUCT
WHERE PRODUCT EQ 'Espresso';
ON GRAPH HOLD AS CHART FORMAT JSCHART
ON GRAPH SET LOOKGRAPH TAGCLOUD
ON GRAPH SET STYLE *
*GRAPH_JS
yaxis: {colorScale: {
colors: ['red', 'black', 'green', 'blue', 'purple']
}
}
*END
ENDSTYLE
END
-RUN

-IF &RECORDS EQ 0 GOTO ERROR ELSE GOTO DONE

-ERROR
-HTMLFORM BEGIN
<html>
<head>
</head>
<body>
<div style="width:100%">
<span style="font-size:1.5em">No Data!</span><p></p>
</div>
</body>
</html>
-HTMLFORM END
-DONE

-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/ibi_html/javaassist/jquery/jquery_min.js"></script>
<script>
$(document).ready(function() {
	// Retrieve the tag cloud chart code from "fix_tag_cloud" div.
	var html = $("#fix_tag_cloud").clone().html();

	// Chart code is now one big string separated by newline chars.
	// Break it up into an array of individual lines.
	var code = html.split("\n");

	// Modify the lines causing the chart to not display when only one product is selected.
	// Adding a phantom second product fixes the problem.
	for(var i = 0; i < code.length; i++) {
		if (code[i].indexOf("setDataSeries(") > -1) code[i + 1] = code[i + 1].replace(");", ",0.00);");
		if (code[i].indexOf("setGroupLabelArray(") > -1) code[i + 1] = code[i + 1].replace(");", '," ");');

		// Blank out the HTML comment lines.
		if (code[i].indexOf("<!--") > -1) code[i] = "";
		if (code[i].indexOf("-->") > -1) code[i] = "";
	}

	// Reassemble the array items into one big string separated by newline chars.
	code = code.join("\n");

	// Clear out the "fix_tag_cloud" div contents and insert modified chart code.
	$("#fix_tag_cloud").empty().append($(code));
});
</script>
</head>
<body>
<div id="fix_tag_cloud">
<!--
!IBI.FIL.CHART;
-->
</div>
</body>
</html>
-HTMLFORM END



App Studio
WebFOCUS 8.1.05M
Windows, All Outputs