Tache du sprint 3 en rapport avec le graphe : Toutes ces tâches devrait ce compléter en même temps.
Les graphes doivents forcément être connexe.
Le graphe ne dois pas changer quand on recharge la page.
Faire en sorte que les joueurs ont la même disposition pour le graphe.
Tache du sprint 3 en rapport avec le graphe :
*Toutes ces tâches devrait ce compléter en même temps.*
- [x] Les graphes doivents forcément être connexe.
- [x] Le graphe ne dois pas changer quand on recharge la page.
- [x] Faire en sorte que les joueurs ont la même disposition pour le graphe.
// Sauvegarder l'état dans localStorage
localStorage.setItem('graphState', JSON.stringify(graphState));
// Réinitialiser le graphe
const savedGraphState = JSON.parse(localStorage.getItem('graphState'));
network.setData(savedGraphState);
const savedGraphStateString = localStorage.getItem('graphState');
if (savedGraphStateString !== null) {
const savedGraphState = JSON.parse(savedGraphStateString);
network.setData(savedGraphState);
} else {
// La clé 'graphState' n'existe pas dans le localStorage, prenez une action en conséquence.
}
code trouvé pour réinitialisé :
// Capturer l'état actuel du graphe
const nodes = network.getNodes();
const edges = network.getEdges();
const graphState = { nodes, edges };
// Sauvegarder l'état dans localStorage
localStorage.setItem('graphState', JSON.stringify(graphState));
// Réinitialiser le graphe
const savedGraphState = JSON.parse(localStorage.getItem('graphState'));
network.setData(savedGraphState);
const savedGraphStateString = localStorage.getItem('graphState');
if (savedGraphStateString !== null) {
const savedGraphState = JSON.parse(savedGraphStateString);
network.setData(savedGraphState);
} else {
// La clé 'graphState' n'existe pas dans le localStorage, prenez une action en conséquence.
}
Tache du sprint 3 en rapport avec le graphe :
Toutes ces tâches devrait ce compléter en même temps.
creuser au niveau de https://visjs.github.io/vis-network/docs/network/layout.html#
code trouvé pour réinitialisé :
// Capturer l'état actuel du graphe
const nodes = network.getNodes();
const edges = network.getEdges();
const graphState = { nodes, edges };
// Sauvegarder l'état dans localStorage
localStorage.setItem('graphState', JSON.stringify(graphState));
// Réinitialiser le graphe
const savedGraphState = JSON.parse(localStorage.getItem('graphState'));
network.setData(savedGraphState);
const savedGraphStateString = localStorage.getItem('graphState');
if (savedGraphStateString !== null) {
const savedGraphState = JSON.parse(savedGraphStateString);
network.setData(savedGraphState);
} else {
// La clé 'graphState' n'existe pas dans le localStorage, prenez une action en conséquence.
}