Focal Point
[CLOSED] Need To Create A "Status" Tracking Pie Chart

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

December 23, 2019, 10:13 AM
Gravaman
[CLOSED] Need To Create A "Status" Tracking Pie Chart
In a similar fashion to how Pizza Hut has their tracker that lets you know what step the pizza is on as it is delivered to you, one of my clients wants to have a pie chart that tracks their work status. We have a piece of work that will move through a process, where it will receive a different "status" as it reaches certain criteria. Unfortunately I am unable to use Info Assist functionality to recreate this. Either it creates multiple pie charts for each status, or it only lets me use one at a time.

I am able to to make this happen with a bar chart, but my client is strongly pushing a pie chart.

I believe this will have to be done with a calculated field, where all of the different statuses are lumped into one field, and will be conditionally selected.

Any ideas or direction would be appreciated.

This message has been edited. Last edited by: FP Mod Chuck,
December 23, 2019, 11:30 AM
BabakNYC
There are few chart extensions but I haven't seen one that fits this exact scenario. If you can find the chart type in github you could probably write a D3 extension for this spec.

What version of WebFOCUS are you using? It's not in your signature.


WebFOCUS 8206, Unix, Windows
December 23, 2019, 12:10 PM
Waz
Here is a little something I cooked up.

You will need to set up an ajax call to get the status and update the chart accordingly.

Tested in v8.1.04 and v8.2.06

-MRNOEDIT EX -LINES * EDAPUT MASTER,PIZZA,CV,FILE
FILENAME=PIZZA, SUFFIX=FIX,$
SEGNAME=PIZZA, $
  FIELD=EVENT ,ALIAS=  ,A20,A20 ,$
  FIELD=TIME  ,ALIAS=  ,I9 ,A9 ,$
EDAPUT*

-MRNOEDIT EX -LINES * EDAPUT FOCTEMP,PIZZA,CV,FILE
1 Order Received            1
2 Order Prepared            1
3 Cooking                   1
4 Ready                     1
EDAPUT*

-RUN

FILEDEF PIZZA DISK pizza.ftm (LRECL 29 RECFM V

-RUN
GRAPH FILE PIZZA
SUM TIME AS ''
ACROSS EVENT AS ''
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH PIE
ON GRAPH SET HAXIS 600
ON GRAPH SET VAXIS 500
ON GRAPH SET STYLE *
*GRAPH_JS
introAnimation: {
   enabled: true,
   duration: 1000
},
pieProperties: {rotation:315},
series: [
   {series: 0, color: 'cyan', showDataValues:true, explodeSlice: 30},
   {series: 1, color: 'bisque', showDataValues:false},
   {series: 2, color: 'slateblue', showDataValues:false},
   {series: 3, color: 'red', showDataValues:false},
],
dataLabels: {
   visible: true, 
   formatCallback: function(d,s,g){var lbl = this.getSeries(s).label;return lbl ;}
}
*END
ENDSTYLE
END

-RUN

-HTMLFORM BEGIN
  <script>
	var myChart = null ;
	var pollNum = 1 ;
	setTimeout(getChart(), 5000);
	function getChart() {
		myChart = document.getElementById("jschart_HOLD_0").chart ;
		setTimeout(function() {poll();}, 5000);
	}
	function poll() {
		pollNum++;
		// ajax call to get current status goes here
		myChart.pieProperties.rotation = (myChart.pieProperties.rotation-90<0)?315:myChart.pieProperties.rotation-90;
		for (var s=1;s<myChart.series.length;s++) {
			myChart.series[s].explodeSlice=(s==pollNum)?30:0;
		}
		myChart.series[pollNum].showDataValues = true ;
		myChart.redraw(myChart.documentRoot);
		if (pollNum<4) setTimeout(function() {poll();}, 5000);
	}
  </script>

-HTMLFORM END
-RUN




Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 26, 2019, 10:56 AM
Gravaman
@BabaNYC, we are running 8.2.3? I hope I am saying that right. I will definitely take a look at GitHub.
@Waz, I will give that a try and get back to you if I am stuck.
Thank you so much for the replies!
December 26, 2019, 05:04 PM
vaayu
Not sure if 8203 has this option but there is a feature to turn on "Real-time refresh" on a chart built using Designer. We see it on 8206 for sure.


-********************
Sandbox: 8206.10
Dev: 8201M
Prod:8009
-********************