' +
'
'
);
tooltip
.style("top", event.pageY - 155 + "px")
.style("left", event.pageX - 155 + "px")
.style("display", "inherit")
}
function TooltipSwitch(territory, d) {
switch (territory) {
case 'western':
ShowToolTip('Southern Territory', ' - USA', 'Michael Strickland', 'michael.strickland@PLI-PETRONAS.COM', '+(1) 417-834-9592', d);
break;
case 'northern':
ShowToolTip('Northern Territory', ' - USA', 'Bruce Brekke', 'Bruce.Brekke@PLI-PETRONAS.COM', '+(1) 630-822-8302', d);
break;
case 'southern':
ShowToolTip('Southeastern Territory', ' - USA', 'Clayton Rougeou ', 'Clayton.Rougeou@PLI-PETRONAS.COM', '+(1) 630-512-7986', d);
break;
case 'central':
ShowToolTip('North Central Territory', ' - USA', 'Rick Martinez', 'Ricardo.Martinez@pli-petronas.com', '+(1) 312-882-5429', d)
break;
case 'eastern':
ShowToolTip('Eastern Territory', ' - USA', 'Peter Wagner', 'Peter.Wagner@PLI-PETRONAS.COM', '+(1) 630-528-6474', d);
break;
case 'CaEst':
ShowToolTip('Eastern Territory', ' - CANADA', 'David Journeault', 'David.Journeault@PLI-PETRONAS.COM', '+(1) 403-680-7358', d);
break;
case 'westernNew':
ShowToolTip('Western Territory', ' - USA & CANADA', 'Matt Pflieger', 'Matthew.Pflieger@PLI-PETRONAS.COM', '+(1) 717-679-9733', d);
break;
case 'centralCentral':
ShowToolTip('Central Territory', ' - USA','Clayton Rougeou ', 'Clayton.Rougeou@PLI-PETRONAS.COM', '+(1) 630-512-7986', d, d)
//the following code is for temporary use.
// the official region name is Central Left
break;
case 'centralLeft':
ShowToolTip('Western Territory', ' - USA', 'Matt Pflieger', 'Matthew.Pflieger@PLI-PETRONAS.COM', '+(1) 717-679-9733', d)
default:
break;
}
}
function RemoveTooltip() {
tooltip.style("display", "none");
}
/**
* Remove tooltip when you click outside of the svg
*
*/
function HideTooltip() {
var tooltip = d3.select("div.map-tooltip");
var mapWithContent = d3.selectAll("path.selectable, path.selectable *");
var tooltipWithContent = d3.selectAll("div.map-tooltip, div.map-tooltip *");
var textpWithContent = d3.selectAll("text.selectable, text.selectable *");
var linepWithContent = d3.selectAll("line.selectable, line.selectable *");
function equalToEventTarget() {
return this == event.target;
}
d3.select("body").on("click", function () {
var mapOutside = mapWithContent.filter(equalToEventTarget).empty();
var tooltipOutside = tooltipWithContent.filter(equalToEventTarget).empty();
var textOutside = textpWithContent.filter(equalToEventTarget).empty();
var lineOutside = linepWithContent.filter(equalToEventTarget).empty();
if (mapOutside && tooltipOutside && textOutside && lineOutside) {
RemoveTooltip();
ResetHighLight();
isClicked = false;
}
});
}