Focal Point
[CLOSED] Tooltip on Mapchart

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

January 02, 2019, 04:47 PM
Rajna Nannat
[CLOSED] Tooltip on Mapchart
I am having a requirement to show 3 series on tooltip when we hover over a state.
On load for first time the custom tooltip works but when we go to next zoom level its showing undefined values. Kindly let me know if any suggestion.

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 STATEPOP
-* Created by Info Assist for Graph
SUM CNT_MBR AS 'Member Count'
    CNT_SUB AS 'Subscriber Count'
	CNT_DEP AS 'Dependant Count'
BY ST_CD AS 'State'
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET VZERO OFF
ON GRAPH SET HTMLENCODE ON
ON GRAPH SET GRAPHDEFAULT OFF
ON GRAPH SET GRWIDTH 1
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 0
ON GRAPH SET GRXAXIS 1
ON GRAPH SET LOOKGRAPH CHOROPLETH
ON GRAPH SET AUTOFIT ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setPieDepth(0);
setPieTilt(0);
setDepthRadius(0);
setCurveFitEquationDisplay(false);
setPlace(true);
*END
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
TYPE=REPORT, TITLETEXT=&WF_TITLE.QUOTEDSTRING, $
*GRAPH_SCRIPT
setPlace(true); setToolTipStyle("html5");
setReportParsingErrors(false);
setSelectionEnableMove(false);
setDisplay(getLegendArea(),true);
-*setGradientPinLeftColor0(getLegendArea(),new Color(126,245,255));
-*setGradientPinRightColor0(getLegendArea(),new Color(126,245,255));
-*setGradientPinLeftColor2(getLegendArea(),new Color(126,245,255));
-*setGradientPinRightColor2(getLegendArea(),new Color(126,245,255));
-*setFillType(getLegendArea(),2);
-*setGradientNumPins(getLegendArea(),2);
-*setGradientPinPosition0(getLegendArea(),0.0);
-*setGradientPinPosition1(getLegendArea(),1.0);
*GRAPH_JS
"mapProperties": {
    "leaflet": {
        "overlayLayers": [{
                "dataLookup": "properties.state_abbr",
                "layerInfo": {
                    "type": "regions"
                },
                "title": "US-all",
                "type": "tdg",
                "url": function(){ return tdgchart.getScriptPath().replace(/\/tdg\/.*/,'/web_resource/map/') +'US-all.json'}
            }],
        "baselayers": [{
                "layerInfo": {
                    "maxZoom": 8,
                    "attribution": function(){  return "&|copy; <a target='_blank' href='http://www.InformationBuilders.com'>Information Builders</a> | " +
					"&|copy; <a target='_blank' href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors"; }
                },
                "title": "OpenStreetMap",
                "url": function(){  return tdgchart.getScriptPath().replace(/\/tdg\/.*/,'') + '/maptiles/osm/{z}/{x}/{y}.png' }
            }]
    }
},
"colorScale": {
-*    "colors": ["#D7191C","#FDAE61","#FFFFBF","#A6D96A","#1A9641"]
-*	 "colors": ["aquamarine","skyblue","lightblue","cadetblue","blue","darkblue"]
"colors": ["#3FE0D0","#B0DFE5","#95C8D8","#7EF9FF","#588BAE","#89CFF0","#81D8D0","#4682B4","#57A0D3","#4F97A3","#7285A5","#73C2FB","#008081","#4C516D","#6593F5","#008ECC","#0F52BA","#0080FF","#1034A6","#0E4D92","#000080","#003152","#1D2951","#111E6C"]
}
,
series: [
-*      {series: 'reset', tooltip: function(v, s, g) {return 'state: ' + chart.data[s][g].name +'<br/>Series: ' + s +'<br/>Group: ' + g;}},
{series: 'reset', tooltip: function(v,s,g) {
state = chart.data[s][g].name;
    x = this.data[0][g].value;
-*    x = this.formatNumber(x, '$###,###,###.');
    y = this.data[1][g].value;
	z = this.data[2][g].value;
-*    y = this.formatNumber(y, '$###,###,###.');
    return 'State' + ': ' + state + '<br>' +
	this.getSeries(0).label + ': ' + x + '<br>' +
    this.getSeries(1).label + ': ' + y + '<br>' +
	this.getSeries(2).label + ': ' + z + '<br>'
    ;}, dataLabels:{visible:true}},
]
*END
ENDSTYLE
END
-RUN


Thanks,
Rajna

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8.1.05
Windows
Excel, PDF, HTML
January 02, 2019, 04:52 PM
Rajna Nannat
series: [
{series: 'reset', tooltip: function(v,s,g) {

state = chart.data[s][g].name;
    x = this.data[0][g].value;
-*    x = this.formatNumber(x, '$###,###,###.');
    y = this.data[1][g].value;
	z = this.data[2][g].value;
-*    y = this.formatNumber(y, '$###,###,###.');
    return 'State' + ': ' + state + '<br>' +
	this.getSeries(0).label + ': ' + x + '<br>' +
    this.getSeries(1).label + ': ' + y + '<br>' +
	this.getSeries(2).label + ': ' + z + '<br>'
    ;}, dataLabels:{visible:true}}
,]


Above is the series section. As a work around I had to disable the minzoom and maxzoom by setting to same value and passing a parameter by using a slider.

Thanks,
Rajna


WebFOCUS 8.1.05
Windows
Excel, PDF, HTML
January 03, 2019, 09:37 AM
Rajna Nannat
Kindly let me know if there are any suggestions.


WebFOCUS 8.1.05
Windows
Excel, PDF, HTML
January 07, 2019, 11:39 AM
FP Mod Chuck
Rajna

Since no one has been able to provide you any guidance I suggest you open a case with techsupport.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
January 17, 2019, 01:35 PM
Rajna Nannat
Changing function to below solved the issue.

series: [ 
{series: 'reset', tooltip: function(v,s,g) {
                var d = this.data[1][g];
                d = (Array.isArray(d)) ? d[1] : d.value;
                var e = this.data[2][g];
                e = (Array.isArray(e)) ? e[1] : e.value;
                return this.getSeries(0).label + ': ' + this.formatNumber(v, '#,###') + '<br>' + this.getSeries(1).label + ': ' + d +  '<br>' + this.getSeries(2).label + ': ' + e;
}
}
]


Thanks,
Rajna


WebFOCUS 8.1.05
Windows
Excel, PDF, HTML