While creating Chart from 3rd party library having issue with passing data into the chart
Hi
This is our D3 Js Script for creating a Hierarchal Edge Building Graph. I'll have to use Logi to implement it.
<!DOCTYPE html>
<style>
body {
overflow: auto;
margin: 50px 0px 0px 100px;
font-size: 12px;
text-align:center;
font-weight: 200;
font-family:"Roboto";
}
headerRight {
font-family: "Roboto";
text-align: right;
position:absolute;
top:10px;
font-size:23px;
right:0px;
margin-right:20px;
}
.node {
font: 5 10px"Roboto";
fill: #BDBDBD;
}
.node:hover {
fill: #000000;
}
.link {
stroke: #BDBDBD;
stroke-opacity: 0.4;
fill: none;
pointer-events: none;
}
.node:hover, .node--source, .node--target, .node--both {
font-weight: 500;
}
.node--source {
fill: #0000A0;
}
.node--target {
fill: #FE2E2E;
}
.node--both {
fill: #BF00FF;
}
.link--source, .link--target, .link--both {
stroke-opacity: 1;
stroke-width: 2px;
}
.link--source {
stroke: #FE2E2E;
}
.link--target {
stroke: #0000A0;
}
.link--both {
stroke: #BF00FF;
}
.d3-tip {
line-height: 1;
padding: 5px 15px;
width: 200px;
background: #FFFFFF;
border-radius: 5px;
box-shadow: 0px 0px 5px rgba(50, 50, 50, 20);
}
</style>
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="src/tip.js"></script>
<script>
var flaredata = [{
"name": "flare.international.Arctic Council",
"citation": "The Arctic Council is a high level intergovernmental forum with the role of providing a means for promoting cooperation, coordination and interaction among the Arctic States, with the involvement of the Arctic Indigenous communities and other Arctic inhabitants on common Arctic issues, in particular issues of sustainable development and environmental protection in the Arctic.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.international.Oil & Gas Industry",
"flare.international.IMO",
"flare.AllScales.NGOs",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.international.IMO",
"citation": "IMO is a specialized agency for the UN with the role of setting global standards for safety, security and environmental performance of international shipping to create a regulatory framework for the shipping industry that is fair and effective, universally adopted and universally implemented.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Security, Safety & Defence",
"flare.international.Arctic Council",
"flare.international.Oil & Gas Industry",
"flare.international.national.Mining Industry",
"flare.international.national.International Shipping Industry",
"flare.international.national.Banks/Insurance Market",
"flare.national.Ice Navigators",
"flare.national.Transport Canada",
"flare.national.local.Domestic Shipping Industry",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.AllScales.Research Community/Consultants",
"flare.AllScales.Cruise Companies"]
}, {
"name": "flare.international.Oil & Gas Industry",
"citation": "It covers exploration, exploitation, production and exportation.",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.international.Arctic Council",
"flare.international.national.Banks/Insurance Market",
"flare.national.local.Domestic Shipping Industry",
"flare.national.Environment Canada",
"flare.AllScales.DFO",
"flare.national.Ice Navigators",
"flare.international.national.International Shipping Industry",
"flare.local.Inuit Population",
"flare.national.NRCan",
"flare.AllScales.NGOs",
"flare.local.Northern Population",
"flare.international.IMO",
"flare.national.Transport Canada",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.national.AANDC",
"citation": "AANDC is a federal department in Canada that as the role of supporting northern Canadians in their efforts to improve social and economic well-being to develop healthier, more sustainable communities and to participate more fully in Canada's political, social and economic development.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests"]
}, {
"name": "flare.national.Environment Canada",
"citation": "EC is a federal department in Canada that has the role of preserving and enhancing the quality of the natural environment; conserving Canada's renewable resources; conserving and protecting Canada's waters resources; forecasting daily weather conditions and warnings and providing detailed meteorological information to all of Canada; enforcing rules relating to boundary waters; and coordinating environmental policies and programs for the federal government.",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.AllScales.Cruise Companies",
"flare.international.Oil & Gas Industry",
"flare.international.national.International Shipping Industry",
"flare.international.national.Mining Industry",
"flare.international.local.Adventure Tourists",
"flare.national.local.Domestic Shipping Industry",
"flare.national.Ice Navigators",
"flare.national.Transport Canada",
"flare.AllScales.DFO",
"flare.local.Inuit Commercial Fishing",
"flare.local.Inuit Population",
"flare.local.Northern Population",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.national.Ice Navigators",
"citation": "Ice navigators are persons who have served on a ship as master or person in charge of the deck watch for 50 days or more; 30 of those days must have been spent in Arctic waters where the ship required assistance from an icebreaker or had to make manoeuvres to avoid concentrations of ice. Their responsibility is to determine the ice regimes and to use them with the Ice Multipliers to determine whether the ship is capable of handling the planned route.",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.AllScales.DFO",
"flare.national.Environment Canada",
"flare.national.Transport Canada",
"flare.national.local.Domestic Shipping Industry",
"flare.international.national.International Shipping Industry",
"flare.international.IMO",
"flare.international.Oil & Gas Industry",
"flare.international.national.Mining Industry",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.national.NRCan",
"citation": "NRCan is a federal department in Canada with the role of enhancing the responsible development and use of Canada's natural resources and the competitiveness of Canada's natural resources products.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.international.Oil & Gas Industry",
"flare.international.national.Mining Industry",
"flare.national.Transport Canada",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.national.Transport Canada",
"citation": "TC is a federal department in Canada with the role of managing transportation policies and programs, and promoting safe, secure, efficient and environmentally-responsible transportation.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.international.local.Adventure Tourists",
"flare.international.national.Banks/Insurance Market",
"flare.AllScales.Cruise Companies",
"flare.national.local.Domestic Shipping Industry",
"flare.AllScales.DFO",
"flare.international.national.Foreign Affairs, Trade & Development",
"flare.national.Environment Canada",
"flare.national.Ice Navigators",
"flare.international.IMO",
"flare.international.national.International Shipping Industry",
"flare.local.Inuit Commercial Fishing",
"flare.local.Inuit Population",
"flare.AllScales.NGOs",
"flare.international.national.Mining Industry",
"flare.international.Oil & Gas Industry",
"flare.national.NRCan",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.local.Inuit Population",
"flare.local.Northern Population",
"flare.national.local.Public Safety Canada",
"flare.AllScales.Research Community/Consultants",
"flare.local.Territorial Governments"]
}, {
"name": "flare.local.Inuit Commercial Fishing",
"citation": "Inuit commercial fisheries are those fishermen/fisherwomen who identify as Inuit and are engaged in a commercial fishery (in contrast to a traditional fishery). For example: Niqitaq Fisheries Ltd.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.national.local.CanNor",
"flare.national.Environment Canada",
"flare.international.national.Banks/Insurance Market",
"flare.AllScales.DFO",
"flare.national.Environment Canada",
"flare.national.Transport Canada",
"flare.local.Inuit Population",
"flare.AllScales.NGOs",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.local.Northern Population"]
}, {
"name": "flare.local.Inuit Population",
"size": 3812,
"citation": "The Inuit in Canada constitute the largest aboriginal group in the country's North. They have described their entire culture and identity as being based on free movement on sea and sea ice for hunting and fishing (Ostreng et al., 2013)",
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.international.national.International Shipping Industry",
"flare.national.Environment Canada",
"flare.national.Transport Canada",
"flare.AllScales.DFO",
"flare.national.local.Domestic Shipping Industry",
"flare.AllScales.NGOs",
"flare.AllScales.Cruise Companies",
"flare.local.Inuit Commercial Fishing",
"flare.international.Oil & Gas Industry",
"flare.international.national.Mining Industry",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.AllScales.Research Community/Consultants",
"flare.local.Territorial Governments"]
}, {
"name": "flare.local.Northern Population",
"citation": "Aboriginal populations.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.AllScales.NGOs",
"flare.national.local.Domestic Shipping Industry",
"flare.AllScales.Cruise Companies",
"flare.international.national.International Shipping Industry",
"flare.national.Environment Canada",
"flare.national.Transport Canada",
"flare.AllScales.DFO",
"flare.international.Oil & Gas Industry",
"flare.international.national.Mining Industry",
"flare.local.Inuit Commercial Fishing",
"flare.AllScales.Research Community/Consultants",
"flare.local.Territorial Governments"]
}, {
"name": "flare.local.Territorial Governments",
"citation": "Canada's North is composed by three territories: Northwest Territories, Nunavut and Yukon. Their powers ae delegated from the federal government.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.national.local.CanNor",
"flare.international.local.Adventure Tourists",
"flare.AllScales.Cruise Companies",
"flare.national.local.Domestic Shipping Industry",
"flare.international.national.International Shipping Industry",
"flare.national.Transport Canada",
"flare.AllScales.DFO",
"flare.AllScales.NGOs",
"flare.local.Northern Population",
"flare.local.Inuit Population",
"flare.international.national.Mining Industry",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.international.national.Banks/Insurance Market",
"citation": "They allow ship owners and carriers to take on the risk of navigating in the Arctic or not. Generally the limit is 60 degrees North but depending on the company the limit can be 70 degrees North.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.international.local.Adventure Tourists",
"flare.AllScales.Cruise Companies",
"flare.national.local.Domestic Shipping Industry",
"flare.international.national.International Shipping Industry",
"flare.international.national.Mining Industry",
"flare.international.IMO",
"flare.international.Oil & Gas Industry",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.local.Inuit Commercial Fishing",
"flare.national.Transport Canada",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.international.national.International Shipping Industry",
"citation": "",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.international.IMO",
"flare.international.Oil & Gas Industry",
"flare.international.national.Mining Industry",
"flare.national.Environment Canada",
"flare.national.Transport Canada",
"flare.national.Ice Navigators",
"flare.local.Territorial Governments",
"flare.international.national.Banks/Insurance Market",
"flare.national.local.Public Safety Canada",
"flare.AllScales.DFO",
"flare.international.national.Foreign Affairs, Trade & Development",
"flare.local.Northern Population",
"flare.local.Inuit Population",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.international.national.Mining Industry",
"citation": "Mining and mineral processing industries. It covers exploration, exploitation, production and exportation.",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.international.IMO",
"flare.international.national.Banks/Insurance Market",
"flare.international.national.International Shipping Industry",
"flare.national.local.CanNor",
"flare.national.local.Domestic Shipping Industry",
"flare.AllScales.DFO",
"flare.national.Ice Navigators",
"flare.local.Northern Population",
"flare.local.Inuit Population",
"flare.national.Environment Canada",
"flare.national.NRCan",
"flare.AllScales.Research Community/Consultants",
"flare.national.Transport Canada",
"flare.local.Territorial Governments"]
},{
"name": "flare.international.national.Foreign Affairs, Trade & Development",
"citation": "FATD is a federal department in Canada with the role of managing Canada's diplomatic and consular relations, encouraging the country's international trade and leading Canada's international development and humanitarian assistance.",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.interest.Climate & Environment",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.interest.Security, Safety & Defence",
"flare.national.Transport Canada",
"flare.AllScales.Cruise Companies",
"flare.international.national.International Shipping Industry",
"flare.national.local.Public Safety Canada"]
}, {
"name": "flare.national.local.CanNor",
"citation": "CanNor is an agency within the federal government of Canada with the role of helping to develop a diversified, sustainable, and dynamic economy in Canada's three territories and contributing to Canada's prosperity.",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.local.Territorial Governments",
"flare.international.national.Mining Industry",
"flare.local.Inuit Commercial Fishing"]
}, {
"name": "flare.national.local.Domestic Shipping Industry",
"citation": "Covers the companies operating only within the Canadian Arctic (e.g. FEDNAV, NEAS, NTCL).",
"size": 3812,
"imports": ["flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.national.Ice Navigators",
"flare.AllScales.DFO",
"flare.international.IMO",
"flare.international.national.Banks/Insurance Market",
"flare.national.Transport Canada",
"flare.national.Environment Canada",
"flare.local.Inuit Population",
"flare.local.Northern Population",
"flare.national.local.Public Safety Canada",
"flare.local.Territorial Governments",
"flare.international.national.Mining Industry",
"flare.international.Oil & Gas Industry",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.national.local.Public Safety Canada",
"citation": "PSC is a federal department in Canada with the role of keeping Canadians safe from a range of risks such as natural disasters, crime and terrorism.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Security, Safety & Defence",
"flare.AllScales.Cruise Companies",
"flare.international.local.Adventure Tourists",
"flare.national.local.Domestic Shipping Industry",
"flare.AllScales.DFO",
"flare.international.national.Foreign Affairs, Trade & Development",
"flare.national.Transport Canada",
"flare.international.national.International Shipping Industry"]
}, {
"name": "flare.international.local.Adventure Tourists",
"citation": "Adventure tourists are independent individuals/explorators who take their a recreational vessel, such as a yacht, into the Canadian Arctic for tourism purposes.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Security, Safety & Defence",
"flare.national.local.Public Safety Canada",
"flare.AllScales.DFO",
"flare.national.Environment Canada",
"flare.international.national.Banks/Insurance Market",
"flare.national.Transport Canada",
"flare.local.Territorial Governments"]
}, {
"name": "flare.AllScales.Cruise Companies",
"citation": "Arctic cruise activity is a type of shipping. They are predominantly made in ice-free waters in the summer season. Arctic cruises is a fast growing business (Ostreng et al., 2013).",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Inuit Interests",
"flare.national.Environment Canada",
"flare.AllScales.DFO",
"flare.international.national.Foreign Affairs, Trade & Development",
"flare.international.national.Banks/Insurance Market",
"flare.national.local.Public Safety Canada",
"flare.national.Transport Canada",
"flare.local.Inuit Population",
"flare.local.Northern Population",
"flare.local.Territorial Governments",
"flare.international.IMO",
"flare.AllScales.NGOs",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.AllScales.DFO",
"citation": "DFO is a federal department in Canada that has the role of supporting strong economic growth in marine and fisheries sectors by supporting exports and advancing safe maritime trade; supporting innovation through research in expanding sectors such as aquaculture and biotechnology; contributing to a clean and health environment and sustainable aquatic ecosystems through habitat protection, oceans management, and ecosystems research. ",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.AllScales.Cruise Companies",
"flare.international.local.Adventure Tourists",
"flare.national.Environment Canada",
"flare.national.Ice Navigators",
"flare.international.national.International Shipping Industry",
"flare.national.local.Domestic Shipping Industry",
"flare.local.Inuit Commercial Fishing",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.AllScales.National Defence",
"flare.local.Inuit Population",
"flare.local.Northern Population",
"flare.international.national.Mining Industry",
"flare.international.Oil & Gas Industry",
"flare.AllScales.Research Community/Consultants",
"flare.national.local.Public Safety Canada",
"flare.local.Territorial Governments",
"flare.national.Transport Canada"]
}, {
"name": "flare.AllScales.National Defence",
"citation": "DND is a federal department in Canada with the role of providing advice and support to the Minister of National Defence and implementing government decisions regarding the defence of Canadian interests at home and abroad.",
"size": 3812,
"imports": ["flare.interest.Security, Safety & Defence",
"flare.interest.Inuit Interests",
"flare.AllScales.DFO",
"flare.AllScales.Research Community/Consultants"]
}, {
"name": "flare.AllScales.NGOs",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.local.Inuit Population",
"flare.local.Northern Population",
"flare.AllScales.Cruise Companies",
"flare.international.Oil & Gas Industry",
"flare.AllScales.Research Community/Consultants",
"flare.local.Territorial Governments",
"flare.national.Transport Canada",
"flare.international.Arctic Council",
"flare.local.Inuit Commercial Fishing"]
}, {
"name": "flare.AllScales.Non Inuit Commercial Fishing",
"citation": "Non-Inuit commercial fisheries are those fishermen/fisherwomen who do not identify as Inuit and are engaged in a commercial fishery (in contrast to a traditional fishery).",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.international.IMO",
"flare.international.national.Banks/Insurance Market",
"flare.national.Environment Canada",
"flare.AllScales.DFO",
"flare.local.Inuit Commercial Fishing",
"flare.AllScales.NGOs",
"flare.national.Transport Canada",
"flare.AllScales.Research Community/Consultants",
"flare.local.Inuit Population"]
}, {
"name": "flare.AllScales.Research Community/Consultants",
"citation": "The research community and consultants are those who work to improve the equipment used and knowledge and management of Arctic shipping.",
"size": 3812,
"imports": ["flare.interest.Climate & Environment",
"flare.interest.Economy",
"flare.interest.Security, Safety & Defence",
"flare.interest.Health & Social",
"flare.interest.Inuit Interests",
"flare.international.Arctic Council",
"flare.international.IMO",
"flare.AllScales.Cruise Companies",
"flare.international.national.International Shipping Industry",
"flare.international.national.Banks/Insurance Market",
"flare.national.local.Domestic Shipping Industry",
"flare.international.Oil & Gas Industry",
"flare.national.Environment Canada",
"flare.AllScales.DFO",
"flare.national.Ice Navigators",
"flare.local.Inuit Population",
"flare.international.national.Mining Industry",
"flare.AllScales.National Defence",
"flare.national.NRCan",
"flare.AllScales.NGOs",
"flare.AllScales.Non Inuit Commercial Fishing",
"flare.local.Northern Population",
"flare.local.Territorial Governments",
"flare.national.Transport Canada"]
}, {
"name": "flare.interest.Climate & Environment",
"citation": "pollution (spills, ejections, discharges, noise, light, invasive species); response; environmental protection; sustainable development; environmental hazards to and from ships; climate change",
"size": 743,
"imports": []
}, {
"name": "flare.interest.Economy",
"citation": "business development; cost-efficiency; trade; financial gains; economic utilization of natural resources (petroleum, gas, minerals, fish); competitiveness; employment; income; sustainability",
"size": 3534,
"imports": []
}, {
"name": "flare.interest.Security, Safety & Defence",
"citation": "Search & Rescue (SAR); safety of navigation; maritime security; sustainability. Safety, Security & Defence are grouped for our analysis because of the similarities in concerns within the three topics. Based on a presentation given by Major Pascal Sévigny of the Department of National Defence at the Warming of the North Conference -2015 held in Ottawa, Ontario, they are viewed along a gradient rather than as three distinct areas of interest.",
"size": 5731,
"imports": []
}, {
"name": "flare.interest.Health & Social",
"size": 7840,
"citation": "Primarily addresses the impacts on health, happiness, well-being, tensions and social problems and welfare of Arctic marine shipping.",
"imports": []
}, {
"name": "flare.interest.Inuit Interests",
"size": 5914,
"citation": "Primarily addresses the impacts of Arctic marine shipping on local cultural and traditional aspects.",
"imports": []
}];
console.log(flaredata);
var diameter = 900,
radius = diameter / 2,
innerRadius = radius - 180,
m0,
pi = Math.PI;
var cluster = d3.layout.cluster()
.size([360, innerRadius])
.sort(null)
.value(function (d) {
return d.size;
});
var bundle = d3.layout.bundle();
var tip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.style("z-index", "10")
.html(function (d) {
return "<span style='color:grey'>" + d.citation + "</span>";
});
var line = d3.svg.line.radial()
.interpolate("bundle")
.tension(.85)
.radius(function (d) {
return d.y;
})
.angle(function (d) {
return d.x / 180 * Math.PI;
});
var svg = d3.select("body").append("svg")
.attr("width", diameter)
.attr("height", diameter)
.append("g")
.attr("transform", "translate(" + radius + "," + radius + ")")
.call(tip);
var link = svg.append("g").selectAll(".link"),
node = svg.append("g").selectAll(".node");
//d3.json(flaredata, function(error, classes) {
var nodes = cluster.nodes(packageHierarchy(flaredata)),
links = packageImports(nodes);
var unique_links = links.reduce(function (p, c) {
var index = p.map(function (d, i) {
if (d.source === c.target && d.target === c.source) return i;
}).filter(function (e, i, a) {
return e != undefined;
}).shift();
if (!isNaN(index)) p[index].both = true;
else p.push(c);
return p;
}, []);
link = link.data(bundle(unique_links))
.enter().append("path")
.each(function (d) {
d.source = d[0],
d.target = d[d.length - 1],
d.both = unique_links.filter(function (v) {
if (v.source === d.source && v.target === d.target) return v.both;
}).shift();
})
.attr("class", "link")
.attr("d", line);
node = node.data(nodes.filter(function (n) {
return !n.children;
}))
.enter().append("text")
.attr("class", "node")
.attr("dy", ".31em")
.attr("transform", function (d) {
return "rotate(" + (d.x - 90) + ")translate(" + (d.y + 8) + ",0)" + (d.x < 180 ? "" : "rotate(180)");
})
.style("text-anchor", function (d) {
return d.x < 180 ? "start" : "end";
})
.text(function (d) {
return d.key;
})
.on("mousedown", tip.show)
.on("mouseup", tip.hide)
.on("mouseover", mouseovered)
.on("mouseout", mouseouted);
//});
function tipshow(d) {
d3.select(this).append("text")
.attr("class", "mousedown")
.attr('transform', function (d) {
return 'translate(5, -10)';
})
.text(d.citation);
}
function mouseovered(d) {
node.each(function (n) {
n.target = n.source = false;
});
link.classed("link--both", function (l) {
if ((l.target === d || l.source === d) && l.both) return l.source.source = l.source.target = l.target.source = l.target.target = true;
})
.classed("link--target", function (l) {
if (l.target === d && !l.both) return l.source.source = true;
})
.classed("link--source", function (l) {
if (l.source === d && !l.both) return l.target.target = true;
})
.filter(function (l) {
return l.target === d || l.source === d;
})
.each(function () {
this.parentNode.appendChild(this);
});
node.classed("node--both", function (n) {
return n.source && n.target;
})
.classed("node--target", function (n) {
return n.target;
})
.classed("node--source", function (n) {
return n.source;
});
}
function mouseouted(d) {
link.classed("link--both", false)
.classed("link--target", false)
.classed("link--source", false);
node.classed("node--both", false)
.classed("node--target", false)
.classed("node--source", false);
}
d3.select(self.frameElement).style("height", diameter + "px");
// Lazily construct the package hierarchy from class names.
function packageHierarchy(classes) {
var map = {};
function find(name, data) {
var node = map[name],
i;
if (!node) {
node = map[name] = data || {
name: name,
children: []
};
if (name.length) {
node.parent = find(name.substring(0, i = name.lastIndexOf(".")));
node.parent.children.push(node);
node.key = name.substring(i + 1);
}
}
return node;
}
classes.forEach(function (d) {
find(d.name, d);
});
return map[""];
}
// Return a list of imports for the given array of nodes.
function packageImports(nodes) {
var map = {},
imports = [];
// Compute a map from name to node.
nodes.forEach(function (d) {
map[d.name] = d;
});
// For each import, construct a link from the source to target node.
nodes.forEach(function (d) {
if (d.imports) d.imports.forEach(function (i) {
imports.push({
source: map[d.name],
target: map[i]
});
});
});
return imports;
}
</script>
So, after inserting the d3 script in the body tag, I created a local csv data layer connected with datalayer linked and passed data using json data element connected with the linked layer in the script through variable However, no chart is made.
After implementing this it shows up Blank Screen Let me know the desired solution for this
-
Official comment
Hi Anvita,
Thank you for the inquiry.
Assuming 'flaredata' was the JsonVarName set in the report, the DataLayer.Linked seems to return data correctly. We are missing the tip.js file, so we cannot run the sample you shared locally. At least when I tried I got "Uncaught TypeError: d3.tip is not a function" in "var tip = d3.tip()" and it looks like this is related to the tip.js file.
You may want to take a look at the D3 sample application in the Logi Info knowledge base https://devnet.logianalytics.com/hc/en-us/articles/360050736373-D3-js-Sample-Application - it will probably help you with your D3 chart.
Otherwise, you want to submit a support ticket so we can take a closer look at your report.
Regards,
Manuel.
Please sign in to leave a comment.
Comments
1 comment