Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved]: Sparkline Trend (ToolTip)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved]: Sparkline Trend (ToolTip)
 Login/Join
 
Platinum Member
posted
Hi,
I am able to produce sparkline using the code below.
I am having trouble figuring out how to change the tooltip/mouseover to show the value of the "DATE" field along with the value.

  
TABLE FILE GGSALES
SUM   DOLLARS
BY    PRODUCT
BY    ST
BY    DATE
IF ST EQ 'CA'
ON TABLE HOLD AS HLDSALES
END
-RUN
-*
-* Create Sales Report with Sparkline Trend.
-*
DEFINE FILE HLDSALES
 DOLLARS_D/D12c = DOLLARS;
 DOLLARS_A/A15  = FTOA(DOLLARS_D,'(D12c)','A15');
 SAMEROW_YN/A1  = IF ((LAST PRODUCT EQ PRODUCT) AND (LAST ST EQ ST)) THEN 'Y' ELSE 'N';
 DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DOLLARS_A ELSE DOLL_OUT || ',' || DOLLARS_A;
END
-*
TABLE FILE HLDSALES
 SUM DOLLARS/D12 AS 'Sales'
 COMPUTE SPARK2FLAME/A4096V = '<span class="inlinesparkline">' ||
                              DOLL_OUT ||
		                      '</span>'; AS 'jQuery Sparkline - Sales Trend Across Time'
 BY  PRODUCT AS 'Product'
 BY  ST      AS 'State'
 IF ST EQ 'CA'
 ON TABLE SET HOLDLIST PRINTONLY
 ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE
 ON TABLE SET HTMLCSS ON
 ON TABLE SET PAGE NOLEAD
 ON TABLE SET STYLE *
 INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/ENInformationBuilders_Light1,$

 TYPE=HEADING,COLOR='WHITE',BACKCOLOR=RGB(#4F81BD),$
 TYPE=TITLE, JUSTIFY=CENTER,$
ENDSTYLE
END
-RUN
-*
-* Present the report page to the user.
-*
-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
-*
<head>
 <title>GG Sales Status Reporting</title>
 <style>
  .block_wrapper{
    width: 820px;
  }
  .innerblock {
    float: left;
    padding: 10px;
    border: 1px solid gray;
  }
 </style>
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
 <script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/2.0/jquery.sparkline.js"></script>
 <script>
  $(function() {
   $.fn.sparkline.defaults.common.width  = '500px';
   $.fn.sparkline.defaults.common.height = '020px';
   $('.inlinesparkline').sparkline();   
   });
 </script>
</head>
-*
<body>
  <div class="block_wrapper">
   <div class="innerblock">
       !IBI.FIL.HLDREPT;
   </div>
  </div>
</body>
</html>
-HTMLFORM END




Thanks

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


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Virtuoso
posted Hide Post
Hi BM

I found this old forum post with an example against the car file. http://forums.informationbuild...1057331/m/7231009331

Hope this helps,


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Platinum Member
posted Hide Post
Thanks. I did find this post before I posted the question .
Unfortunatly, doesn't give me what I am looking for.
Basically, I am looking to overwrite the default tooltip which the value with Date: and Value.


Thanks


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Virtuoso
posted Hide Post
BM

I found this link on techsupport https://techsupport.informatio...track/170217072.html It may give you some guideance for using &variables but to be honest it did not sound promising with 8.1.05. 8.2.01 has much improved tool tip usage.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Expert
posted Hide Post
BM, you're using a jQuery plugin, which not really in the realm of WebFOCUS support.

Meanwhile, I took a look at your code. The DATE column is not specified in the code that generates the data for the sparkline so I can't see how it can be displayed in the tooltip.

Did you take a look at the Sparkline documentation for tooltips? http://omnipotent.net/jquery.sparkline/#tooltips


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Hi Francis,
Thanks.
The first query that creates the HLDSALES HOLD file has the DATE

  
TABLE FILE GGSALES
SUM   DOLLARS
BY    PRODUCT
BY    ST
BY    DATE
IF ST EQ 'CA'
ON TABLE HOLD AS HLDSALES
END
-RUN




Yes, I did read the documentation as well searched and searched. Since JavaScript and JQuery is new to me so having a hard time self learning.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
Francis is offline, BUT, he stated:
"The DATE column is not specified in the code that generates the data for the sparkline so I can't see how it can be displayed in the tooltip."

Your showing a DATE in the HOLD file, not not in the ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE table.

Add it in with NOPRINT so it is a available for the tooltip...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Platinum Member
posted Hide Post
Hi,
Here is the updated code.
I've concatenated all the "DATE"s and called it DATE_OUT.
But not sure how to show it as a tooltip. Currently it shows values. I would like to show something like this

Date: 19960101
Value: 27,270



  
TABLE FILE GGSALES
SUM   DOLLARS
BY    PRODUCT
BY    ST
BY    DATE
IF ST EQ 'CA'
ON TABLE HOLD AS HLDSALES
END
-RUN
-*
-* Create Sales Report with Sparkline Trend.
-*
DEFINE FILE HLDSALES
 DOLLARS_D/D12c = DOLLARS;
 DOLLARS_A/A15  = FTOA(DOLLARS_D,'(D12c)','A15');
 SAMEROW_YN/A1  = IF ((LAST PRODUCT EQ PRODUCT) AND (LAST ST EQ ST)) THEN 'Y' ELSE 'N';
 DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DOLLARS_A ELSE DOLL_OUT || ',' || DOLLARS_A;
 DATE_CONV/A10V=EDIT(FPRINT(DATE, 'I8YYMD', 'A10V'),'9999$99$99');
 DATE_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DATE_CONV ELSE DATE_OUT || ',' || DATE_CONV;
END
-*
TABLE FILE HLDSALES
 SUM DOLLARS/D12 AS 'Sales'
 DATE_OUT
 COMPUTE SPARK2FLAME/A4096V = '<span class="inlinesparkline">' ||
                              DOLL_OUT ||
		                      '</span>'; AS 'jQuery Sparkline - Sales Trend Across Time'
 BY  PRODUCT AS 'Product'
 BY  ST      AS 'State'
 IF ST EQ 'CA'
 ON TABLE SET HOLDLIST PRINTONLY
 ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE
 ON TABLE SET HTMLCSS ON
 ON TABLE SET PAGE NOLEAD
 ON TABLE SET STYLE *
 INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/ENInformationBuilders_Light1,$

 TYPE=HEADING,COLOR='WHITE',BACKCOLOR=RGB(#4F81BD),$
 TYPE=TITLE, JUSTIFY=CENTER,$
ENDSTYLE
END
-RUN
-*
-* Present the report page to the user.
-*
-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
-*
<head>
 <title>GG Sales Status Reporting</title>
 <style>
  .block_wrapper{
    width: 820px;
  }
  .innerblock {
    float: left;
    padding: 10px;
    border: 1px solid gray;
  }
 </style>
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
 <script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/2.0/jquery.sparkline.js"></script>
 <script>
  $(function() {
   $.fn.sparkline.defaults.common.width  = '500px';
   $.fn.sparkline.defaults.common.height = '020px';
   $('.inlinesparkline').sparkline();   
   });
 </script>
</head>
-*
<body>
  <div class="block_wrapper">
   <div class="innerblock">
       !IBI.FIL.HLDREPT;
   </div>
  </div>
</body>
</html>
-HTMLFORM END



WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
It looks like the x values can be passed:

quote:
Inline: x and y values are separated by a colon: x:y,x:y,x:y - eg.
<span class="linechart">1:3,2.7:4,4.8:3</span>


But this seems to mess up the chart:

-* File: IBFS:/localhost/WFC/Repository/FocalPoint/fp_bm2.fex Created by WebFOCUS AppStudio

-SET &ECHO=ALL;

TABLE FILE GGSALES
SUM   DOLLARS
BY    PRODUCT
BY    ST
BY    DATE
IF ST EQ 'CA'
ON TABLE HOLD AS HLDSALES
END
-RUN
-*
-* Create Sales Report with Sparkline Trend.
-*

DEFINE FILE HLDSALES
-*DATE_A/A10      = FPRINT(EDIT(DATE), 'A8YYMD', 'A10');
DATE_A/A8       = EDIT(DATE);
DOLLARS_A/A12   = LJUST(12, FPRINT(DOLLARS,'D12c','A12'), 'A12');

SAMEROW_YN/A1   = IF ((LAST PRODUCT EQ PRODUCT) AND (LAST ST EQ ST)) THEN 'Y' ELSE 'N';

DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DATE_A || ':' || DOLLARS_A ELSE DOLL_OUT || ',' || DATE_A || ':' || DOLLARS_A;
-*DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN '''' || DATE_A || ''':' || DOLLARS_A ELSE DOLL_OUT || ',' || '''' || DATE_A || ''':' || DOLLARS_A;
-*DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DOLLARS_A ELSE DOLL_OUT || ',' || DOLLARS_A;
END
-RUN

TABLE FILE HLDSALES
SUM DOLLARS/D12 AS 'Sales'
COMPUTE SPARK2FLAME/A4096V =
   '<span class="inlinesparkline">'
|| DOLL_OUT
|| '</span>'; AS 'jQuery Sparkline - Sales Trend Across Time'

BY  PRODUCT AS 'Product'
BY  ST      AS 'State'

IF ST EQ 'CA'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/ENInformationBuilders_Light1,$

TYPE=HEADING,COLOR='WHITE',BACKCOLOR=RGB(#4F81BD),$
TYPE=TITLE, JUSTIFY=CENTER,$
ENDSTYLE
END
-RUN
-*
-* Present the report page to the user.
-*
-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
-*
<head>
<title>GG Sales Status Reporting</title>
<style>
.block_wrapper{
width: 820px;
}
.innerblock {
float: left;
padding: 10px;
border: 1px solid gray;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/2.0/jquery.sparkline.js"></script>
<script>
$(function() {
$.fn.sparkline.defaults.common.width  = '500px';
$.fn.sparkline.defaults.common.height = '020px';
$('.inlinesparkline').sparkline( 'html', {type: 'line' } );
});
</script>
</head>
-*
<body>
<div class="block_wrapper">
<div class="innerblock">
!IBI.FIL.HLDREPT;
</div>
</div>
</body>
</html>
-HTMLFORM END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
yes.. messes up the chart and doesn't show the Date either.
Any other "Webfocus" friendly way to show "Sparkline" with the control over ToolTip.

Thanks


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Platinum Member
posted Hide Post
The code below seems to do what I want to do but not sure how to make it webfocus friendly?


  

var values = [95.00,100.00,125.00,80.00,80.00,100.67];

$('#sparkline').sparkline(values, {
    type: "line",
    width: '500px',
    tooltipFormat: '{{offset:offset}} {{y}}',
    tooltipValueLookups: {
        'offset': {
            0: 'Dec',
            1: 'Aug',
            2: 'Sep',
            3: 'Oct',
            4: 'Nov',
            5: 'Jul',
        }
    },
});




WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
Inching forward...

The docs mention you can specify the values as an attribute, so I assumed you can do that with the x values as well:

<span class="inlinesparkline"
  values="27270,13321,34242">
  xvalues="19960101,19960201,19960301">
</span>


But this doesn't work yet. The x value that is displayed is an integer starting at zero.

-* File: IBFS:/localhost/WFC/Repository/FocalPoint/fp_bm2.fex Created by WebFOCUS AppStudio

-SET &ECHO=ALL;

TABLE FILE GGSALES
SUM   DOLLARS
BY    PRODUCT
BY    ST
BY    DATE
IF ST EQ 'CA'
ON TABLE HOLD AS HLDSALES
END
-RUN
-*
-* Create Sales Report with Sparkline Trend.
-*

DEFINE FILE HLDSALES
-*DATE_A/A10      = FPRINT(EDIT(DATE), 'A8YYMD', 'A10');
DATE_A/A12       = EDIT(DATE);
DOLLARS_A/A12   = LJUST(12, FPRINT(DOLLARS,'D12c','A12'), 'A12');

SAMEROW_YN/A1   = IF ((LAST PRODUCT EQ PRODUCT) AND (LAST ST EQ ST)) THEN 'Y' ELSE 'N';

-*DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DATE_A || ':' || DOLLARS_A ELSE DOLL_OUT || ',' || DATE_A || ':' || DOLLARS_A;
-*DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN '''' || DATE_A || ''':' || DOLLARS_A ELSE DOLL_OUT || ',' || '''' || DATE_A || ''':' || DOLLARS_A;
DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DOLLARS_A ELSE DOLL_OUT || ',' || DOLLARS_A;
DATE_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DATE_A ELSE DATE_OUT || ',' || DATE_A;
END
-RUN

TABLE FILE HLDSALES
SUM DOLLARS/D12 AS 'Sales'
COMPUTE SPARK2FLAME/A4096V =
   '<span class="inlinesparkline" '
|| ' values="'  || DOLL_OUT || '">'
|| ' xvalues="' || DATE_OUT || '">'
|| '</span>'; AS 'jQuery Sparkline - Sales Trend Across Time'

BY  PRODUCT AS 'Product'
BY  ST      AS 'State'

IF ST EQ 'CA'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/ENInformationBuilders_Light1,$

TYPE=HEADING,COLOR='WHITE',BACKCOLOR=RGB(#4F81BD),$
TYPE=TITLE, JUSTIFY=CENTER,$
ENDSTYLE
END
-RUN
-*
-* Present the report page to the user.
-*
-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
-*
<head>
<title>GG Sales Status Reporting</title>
<style>
.block_wrapper{
width: 820px;
}
.innerblock {
float: left;
padding: 10px;
border: 1px solid gray;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/2.0/jquery.sparkline.js"></script>
<script>
$(function() {
$.fn.sparkline.defaults.common.width  = '500px';
$.fn.sparkline.defaults.common.height = '020px';
$('.inlinesparkline').sparkline( 'html', { type: 'line', tooltipFormat: '{{x}}' } );
});
</script>
</head>
-*
<body>
<div class="block_wrapper">
<div class="innerblock">
!IBI.FIL.HLDREPT;
</div>
</div>
</body>
</html>
-HTMLFORM END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
You could generate the lookup list like this -

TABLE FILE HLDSALES
  SUM COMPUTE CNTR/I3 = LAST CNTR + 1; NOPRINT
      COMPUTE DATEYYMD/YYMD = DATE; NOPRINT
      COMPUTE MNTH/A3 = EDIT(DATETRAN(DATEYYMD, '(YYMD)', '(t)', 'en', 12, 'A12'),'$$$$$999$$$'); NOPRINT
      COMPUTE LKUP_VAL/A20 = LJUST(3,FPRINT(CNTR - 1,'I3','A3'),'A3')||':'''||MNTH||''',';
   BY DATE NOPRINT
WHERE ST EQ 'CA'
ON TABLE SAVE AS LOOKUPS
END
-RUN


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Thanks Tony.
How do I incorporate "LOOKUPS" into the existing code to be used as "Tooltip"

Thanks


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
Instead of your decode list within the jQuery code, you can just include the output file -

$('#sparkline').sparkline(values, {
    type: "line",
    width: '500px',
    tooltipFormat: '{{offset:offset}} {{y}}',
    tooltipValueLookups: {
        'offset': {
!IBI.FIL.LOOKUPS;
        }
    },
});


Good luck

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Close, but no cigar. Frowner

Tony and Francis ,
as usual, you pointed me to a correct direction.

It produces the lookup values that I need but the only problem is that it leaves an extra "comma" in the end. causing the chart to not show up.
If I manually delete that comma then it works fine.

Here is my updated code.

  
-SET &ECHO=ALL;
TABLE FILE GGSALES
SUM   DOLLARS
BY    PRODUCT
BY    ST
BY    DATE
IF ST EQ 'CA'
ON TABLE HOLD AS HLDSALES
END
-RUN
-*
-* Create Sales Report with Sparkline Trend.
-*

TABLE FILE HLDSALES
  SUM COMPUTE CNTR/I3 = LAST CNTR + 1; NOPRINT
  COMPUTE DATE_CONV/A10V=EDIT(FPRINT(DATE, 'I8YYMD', 'A10V'),'9999$99$99');
  COMPUTE LKUP_VAL/A20 = LJUST(3,FPRINT(CNTR - 1,'I3','A3'),'A3')||':'''||DATE_CONV||''',';
 BY DATE NOPRINT
WHERE ST EQ 'CA'
ON TABLE HOLD AS HLD
END
-RUN


TABLE FILE HLD
BY LKUP_VAL
ON TABLE SAVE AS LOOKUPS
END
-RUN


DEFINE FILE HLDSALES
 DOLLARS_D/D12c = DOLLARS;
 DOLLARS_A/A15  = FTOA(DOLLARS_D,'(D12c)','A15');
 SAMEROW_YN/A1  = IF ((LAST PRODUCT EQ PRODUCT) AND (LAST ST EQ ST)) THEN 'Y' ELSE 'N';
 DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DOLLARS_A ELSE DOLL_OUT || ',' || DOLLARS_A;
END
-*
TABLE FILE HLDSALES
 SUM DOLLARS/D12 AS 'Sales'
 COMPUTE SPARK2FLAME/A4096V = '<span class="inlinesparkline">' ||
                              DOLL_OUT ||
		                      '</span>'; AS 'jQuery Sparkline - Sales Trend Across Time'
 BY  PRODUCT AS 'Product'
 BY  ST      AS 'State'
 IF ST EQ 'CA'
 ON TABLE SET HOLDLIST PRINTONLY
 ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE
 ON TABLE SET HTMLCSS ON
 ON TABLE SET PAGE NOLEAD
 ON TABLE SET STYLE *
 INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/ENInformationBuilders_Light1,$

 TYPE=HEADING,COLOR='WHITE',BACKCOLOR=RGB(#4F81BD),$
 TYPE=TITLE, JUSTIFY=CENTER,$
ENDSTYLE
END
-RUN
-*
-* Present the report page to the user.
-*
-HTMLFORM BEGIN
<!DOCTYPE html>
<html>
-*
<head>
 <title>GG Sales Status Reporting</title>
 <style>
  .block_wrapper{
    width: 820px;
  }
  .innerblock {
    float: left;
    padding: 10px;
    border: 1px solid gray;
  }
 </style>
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
 <script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/2.0/jquery.sparkline.js"></script>
 <script>

$(function() {
$.fn.sparkline.defaults.common.height = '020px';
$('.inlinesparkline').sparkline('html',{type: "line",width: '500px',tooltipFormat: '{{offset:offset}} {{y}}',tooltipValueLookups: {'offset': {!IBI.FIL.LOOKUPS;}}
});
});

 </script>
</head>
-*
<body>
  <div class="block_wrapper">
   <div class="innerblock">
       !IBI.FIL.HLDREPT;
   </div>
  </div>
</body>
</html>
-HTMLFORM END






Here is the lookup values it creates. there extra comma at the end of last entry "9:'19961001'" is causing the issue.
Is there anyway to get rid of it?

 

$(function() {
$.fn.sparkline.defaults.common.height = '020px';
$('.inlinesparkline').sparkline('html',{type: "line",width: '500px',tooltipFormat: '{{offset:offset}} {{y}}',tooltipValueLookups: {'offset': {
0:'19960101',       0:'19960101',
10:'19961101',      10:'19961101',
11:'19961201',      11:'19961201',
12:'19970101',      12:'19970101',
13:'19970201',      13:'19970201',
14:'19970301',      14:'19970301',
15:'19970401',      15:'19970401',
16:'19970501',      16:'19970501',
17:'19970601',      17:'19970601',
18:'19970701',      18:'19970701',
19:'19970801',      19:'19970801',
1:'19960201',       1:'19960201',
20:'19970901',      20:'19970901',
21:'19971001',      21:'19971001',
22:'19971101',      22:'19971101',
23:'19971201',      23:'19971201',
2:'19960301',       2:'19960301',
3:'19960401',       3:'19960401',
4:'19960501',       4:'19960501',
5:'19960601',       5:'19960601',
6:'19960701',       6:'19960701',
7:'19960801',       7:'19960801',
8:'19960901',       8:'19960901',
9:'19961001',       9:'19961001',
}}
});
});
 


Once again thanks all for your help.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
Generally, JSON tolerates the trailing comma. Here's working code that runs in Chrome and IE. (Thanks Tony!)

-SET &ECHO=ALL;

SET HOLDLIST = PRINTONLY
-RUN

TABLE FILE GGSALES
SUM
DOLLARS
BY PRODUCT
BY ST
BY DATE

WHERE ST EQ 'CA'

ON TABLE HOLD AS HLDSALES
END
-RUN

DEFINE FILE HLDSALES
DOLLARS_A/A12   = LJUST(12, FPRINT(DOLLARS,'D12c','A12'), 'A12');
SAMEROW_YN/A1   = IF ((LAST PRODUCT EQ PRODUCT) AND (LAST ST EQ ST)) THEN 'Y' ELSE 'N';
DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DOLLARS_A ELSE DOLL_OUT || ',' || DOLLARS_A;
END
-RUN

TABLE FILE HLDSALES
SUM
DOLLARS/D12 AS 'Sales'

COMPUTE SPARK2FLAME/A4096V =
   '<span class="inlinesparkline">'
|| DOLL_OUT
|| '</span>'; AS 'jQuery Sparkline - Sales Trend Across Time'

BY  PRODUCT AS 'Product'
BY  ST      AS 'State'

WHERE ST EQ 'CA'

ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
END
-RUN

TABLE FILE HLDSALES
SUM
COMPUTE DATE_YYMD/YYMD = DATE; NOPRINT
COMPUTE CNTR/I3 = LAST CNTR + 1; NOPRINT

COMPUTE LKUP_VAL/A20 = LJUST(3, FPRINT(CNTR - 1, 'I3', 'A3'), 'A3') || ':''' || FPRINT(DATE_YYMD, 'YY-M-D', 'A10') || ' - ' || ''',';

BY DATE NOPRINT

WHERE ST EQ 'CA'

ON TABLE SAVE AS LOOKUPS
END
-RUN

-HTMLFORM BEGIN
<!DOCTYPE html>
<html>

<head>
<title>GG Sales Status Reporting</title>
<style>
.block_wrapper{
width: 820px;
}

.innerblock {
float: left;
padding: 10px;
border: 1px solid gray;
}

</style>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/2.0/jquery.sparkline.js"></script>

<script>
$(function() {
    $.fn.sparkline.defaults.common.width  = '500px';
    $.fn.sparkline.defaults.common.height = '020px';
    $('.inlinesparkline').sparkline( 'html', { type: 'line'
                                           , enableTagOptions: true
                                           , tooltipFormat: '{{offset:offset}} {{y}}'
                                           , tooltipValueLookups: { 'offset': { !IBI.FIL.LOOKUPS; } }
                                             })
});
</script>
</head>

<body>
<div class="block_wrapper">
<div class="innerblock">
!IBI.FIL.HLDREPT;
</div>
</div>

</body>
</html>
-HTMLFORM END
 


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Team work!

Have a great weekend when it arrives for you, mine is but a blink away Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
Thanks Francis.
But unfortunately the code is not working for me it shows the "comma delimited" values but no graph.
Please let me know if you would like me to post the image of the result.

Tony, have a great weekend.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Platinum Member
posted Hide Post
Looks like JSON tolerates trailing comma in Chrome only.
IE11 doesn't like it Frowner.


WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Platinum Member
posted Hide Post
Here is my full and final code.
Was able to figure out how to get rid of that "nasty" comma and all good Smiler

Thanks Francis and Tony.



  
-* File: IBFS:/MONTREWFCD01/WFC/Repository/Product_Marketing/Portal/PM_MKTG_BU/Top_Analysis/Procedure4.fex Created by WebFOCUS AppStudio
-SET &ECHO=ALL;

-DEFAULTH &MX_DATE = 'FOC_NONE' ;

SET HOLDLIST = PRINTONLY
-RUN

TABLE FILE GGSALES
SUM
DOLLARS
BY PRODUCT
BY ST
BY DATE

WHERE ST EQ 'CA'

ON TABLE HOLD AS HLDSALES
END
-RUN

DEFINE FILE HLDSALES
DOLLARS_A/A12   = LJUST(12, FPRINT(DOLLARS,'D12c','A12'), 'A12');
SAMEROW_YN/A1   = IF ((LAST PRODUCT EQ PRODUCT) AND (LAST ST EQ ST)) THEN 'Y' ELSE 'N';
DOLL_OUT/A4096V = IF SAMEROW_YN EQ 'N' THEN DOLLARS_A ELSE DOLL_OUT || ',' || DOLLARS_A;
END
-RUN

TABLE FILE HLDSALES
SUM
DOLLARS/D12 AS 'Sales'

COMPUTE SPARK2FLAME/A4096V =
   '<span class="inlinesparkline">'
|| DOLL_OUT
|| '</span>'; AS 'jQuery Sparkline - Sales Trend Across Time'

BY  PRODUCT AS 'Product'
BY  ST      AS 'State'

WHERE ST EQ 'CA'

ON TABLE HOLD AS HLDREPT FORMAT HTMTABLE
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
END
-RUN




TABLE FILE HLDSALES
SUM MAX.DATE AS MX_DATE
WHERE ST EQ 'CA'
ON TABLE SET ASNAMES ON
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS RR FORMAT ALPHA
END
-RUN
-READFILE RR




TABLE FILE HLDSALES
SUM
COMPUTE DATE_YYMD/YYMD = DATE; NOPRINT
COMPUTE CNTR/I3 = LAST CNTR + 1; NOPRINT

COMPUTE LKUP_VAL/A20 = LJUST(3, FPRINT(CNTR - 1, 'I3', 'A3'), 'A3') || ':''' || FPRINT(DATE_YYMD, 'YY-M-D', 'A10') || ' - ' || ''','; NOPRINT

COMPUTE I_SUBSTR/I2 =  ARGLEN(20, LKUP_VAL, I_SUBSTR) ; NOPRINT 
COMPUTE LKUP_VAL_NOCOM/A20 = SUBSTR(20, LKUP_VAL, 1, I_SUBSTR-1,I_SUBSTR-1, 'A20') ;  NOPRINT
COMPUTE LKUP_VAL_MAX/A20 = IF DATE EQ '&MX_DATE.EVAL' THEN LKUP_VAL_NOCOM ELSE LKUP_VAL ;

BY DATE NOPRINT

WHERE ST EQ 'CA'

ON TABLE SAVE AS LOOKUPS
END
-RUN




-HTMLFORM BEGIN
<!DOCTYPE html>
<html>

<head>
<title>GG Sales Status Reporting</title>
<style>
.block_wrapper{
width: 820px;
}

.innerblock {
float: left;
padding: 10px;
border: 1px solid gray;
}

</style>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/2.0/jquery.sparkline.js"></script>

<script>
$(function() {
    $.fn.sparkline.defaults.common.width  = '500px';
    $.fn.sparkline.defaults.common.height = '020px';
    $('.inlinesparkline').sparkline( 'html', { type: 'line'
                                           , enableTagOptions: true
                                           , tooltipFormat: '{{offset:offset}} {{y}}'
                                           , tooltipValueLookups: { 'offset': { !IBI.FIL.LOOKUPS; } }
                                             })
});
</script>
</head>

<body>
<div class="block_wrapper">
<div class="innerblock">
!IBI.FIL.HLDREPT;
</div>
</div>

</body>
</html>
-HTMLFORM END





WebFOCUS 8202M
 
Posts: 167 | Location: Montreal | Registered: September 23, 2014Report This Post
Expert
posted Hide Post
Congrats BM on working it out. Just goes to show that there are posters who really want to learn and try things instead of just asking for the solution SmilerSmilerSmiler

If you think of the comma as a leading comma instead of trailing, then you could achieve the lookups like this -
TABLE FILE HLDSALES
  SUM COMPUTE CNTR/I3 = LAST CNTR + 1; NOPRINT
      COMPUTE DATEYYMD/YYMD = DATE; NOPRINT
      COMPUTE MNTH/A3 = EDIT(DATETRAN(DATEYYMD, '(YYMD)', '(t)', 'en', 12, 'A12'),'$$$$$999$$$'); NOPRINT
      COMPUTE LKUP_VAL/A20 = IF CNTR EQ 1 THEN LJUST(3,FPRINT(CNTR - 1,'I3','A3'),'A3')||':'''||MNTH||''''
                                     ELSE ','||LJUST(3,FPRINT(CNTR - 1,'I3','A3'),'A3')||':'''||MNTH||'''';
   BY DATE NOPRINT
WHERE ST EQ 'CA'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS LOOKUPS
END
-RUN


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
Very nice indeed!

I wonder if there is a way to do the same with "pure" WF, without having to resort to jQuery.
I can create sparklines but the tooltip eludes me.
The jschart documentation shows that one can create tooltips but the only example it gives is something fixed (see WF80_js_chart.pdf page 3-78).

An example of sparklines using only WF (using an intermediate HOLD file would make this "cleaner"...):
  
-SET &ECHO=ALL;
-* File Sparkline.fex
APP HOLD BASEAPP
TABLE FILE GGSALES
BY PRODUCT
WHERE ST EQ 'CA';
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE
END
-RUN
-SET &C=&LINES;
-REPEAT #GIFS FOR &I FROM 1 TO &C;
-READ SAVE,&PRODUCT.&I
GRAPH FILE GGSALES
SUM DOLLARS AS ''
ACROSS DATE AS ''
WHERE PRODUCT EQ '&PRODUCT.&I';
WHERE ST EQ 'CA';
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET HAXIS 350
ON GRAPH SET VAXIS 30
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET BARNUMB OFF
ON GRAPH SET 3D OFF
ON GRAPH SET VZERO ON
ON GRAPH SET GRID OFF
ON GRAPH HOLD AS SPARK&I FORMAT PNG
ON GRAPH SET GRAPHSTYLE *
setMarkerDisplay(false);
setConnectLineMarkers(true);
setConnectScatterMarkers(true);
setO1LabelDisplay(false);
setO1AxisSide(0);
setO1MajorGridDisplay(false);
setO1MajorGridStyle(0);
setO1MinorGridDisplay(false);
setAxisAssignment(0,0);
setSeriesType(0,2);
setY1LabelDisplay(false);
setY1AxisSide(0);
setY1MajorGridDisplay(false);
setY1MajorGridStyle(0);
setY1MinorGridDisplay(false);
setTextFormatPreset(getY1Label(),-1);
setTextFormatPattern(getY1Label(),"#.##");
setPieFeelerTextDisplay(1);
setPieLabelDisplay(0);
setTextFormatPreset(getPieSliceLabel(),1);
setRiserBorderMode(0);
setSeriesDefaultTransparentBorderColor(false);
setUseSeriesBorderDefaults(false);
setLegendDisplay(false);
setFontSizeAbsolute(getY1Title(),true);
setFontSizeAbsolute(getY1Label(),true);
setFontSizeAbsolute(getY2Title(),true);
setFontSizeAbsolute(getY2Label(),true);
setFontSizeAbsolute(getO1Title(),true);
setPlace(true);
ENDSTYLE
ON GRAPH SET STYLE *
$
ENDSTYLE
END
-#GIFS
-*
DEFINE FILE GGSALES
SPARK/A50=
-REPEAT #SPLINES FOR &I FROM 1 TO &C;
IF (PRODUCT EQ '&PRODUCT.&I') AND (ST EQ 'CA') THEN '<img src=/approot/baseapp/spark&I...png>' ELSE
-#SPLINES
' ';
END
-*
TABLE FILE GGSALES
SUM DOLLARS SPARK AS Spark
BY PRODUCT
WHERE ST EQ 'CA';
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Member
posted Hide Post
Hello,
Do you know if it is possible to sum a field and then give it a name to use in a different define statement to calculate?

For instance,

TABLE FILE AS_STUDENT
SUM SECTION_CREDIT_HOURS
BY ID
END

DEFINE FILE AS_STUDENT
ENROLLED_HRS/D12.2 = TOTAL_HOURS - SUM.SECTION_CREDIT_HOURS;
END


TABLE FILE AS_STUDENT
PRINT ENROLLED_HRS
BY ID
END
-EXIT


This is not working. Can you assist?


WebFOCUS 8
Windows, All Outputs
 
Posts: 27 | Registered: January 10, 2017Report This Post
Virtuoso
posted Hide Post
Look up TOT. as a prefix operator. The syntax you are suggesting will not work.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Solved]: Sparkline Trend (ToolTip)

Copyright © 1996-2020 Information Builders