0
I have a graph that is created from the id div "#Chart", the problem is that I have a modal that registers more information on the graph and when clicking "back" I want to update it with this new data through the $.load() method. Any idea how to do that ?
<html>
<body>
<div id="grafico" style="width:99.5%">
<div id="chart"></div>
<div id="info" style="display:none"></div>
</div>
</body>
</html>
if (window.location.hash === "") {
d3.json("Paineis/gerencias.json", function(err, res) {
if (!err) {
console.log(res);
var data = d3.nest().key(function(d) { return d.gerencia; }).key(function(d) { return d.key; }).entries(res);
main({title: "Demandas em andamento"}, {key: "Total de demandas", values: data});
}
});
}
can you please put the code that initializes the D3.js. Generally libraries of the kind always have methods to update etc...
– Cristiano Gilberto João
ready. I edited the code above
– Gabriel Lopes
the graph is a Zoomable treemap
– Gabriel Lopes
After inserting new data into the chart, try calling again the
d3.json("Paineis/gerencias.json", function(err, res) {...
– Sam
This worked, pórem, the old chart still remains on the page. And if I call the function " $("#Chart"). remove() " before calling the new json, no chart appears on the screen. Have any idea what might be happening ?
– Gabriel Lopes