I have made a small chart using D3.js.
There are 3 different kind of load functions for different kinds of input data types.
My chart can be rendered on any of these datasets, one at a time based on the parameter passed to the render function.
The data loading code is async which creates a problem because my render function starts drawing even before data has fully loaded.
I have given separate load functions instead of calling them inside render function because user might want to just load the data sets initially and render the chart later.
I thought of waiting on a flag before starting drawing and set this flag when all the data sets have uploaded, but looks ugly to me coz of an infinite loop.
Any ideas in term of design I could use to make this work ?
var visualization = new Chart()
.width(1000)
.height(1000)
.loadDissimilarityMatrix('dataSet1.csv')
.loadAdjacencyMatrix('dataSet2.csv')
.loadLaplacianMatrix('dataSet3.csv')
.render('Dissimilarity')
// .render('Adjacency') for using the adjacency dataset.
Aucun commentaire:
Enregistrer un commentaire