Hi folks,
Is there a way to add datasources dynamically (no ajax reload), maybe based on some div-attributes?
I have numerous charts, all sharing the same settings and createNode() function. Only difference is the datasource (and export filename). Currently I have to repeat the full $(...).orgchart(){} js for all of these charts again and again.
Instead I'd like to do something like
<div class="chart-container" data-chartsource-info="foo"></div><div class="chart-container" data-chartsource-info="bar"></div>etc.
Then start all charts at once with
$('.chart-container').orgchart({ [...]
where the data-attribute is a function returning the actual chart data. Something like:
'data': function($the-original-chart-dom-object) {// do something, like reading the// data-chartsource-info attribute to prepare the datasetreturn mydataobject;}
I could think of alternative ways to do this, maybe call a setDatasource()-method after instanciating the charts by $('.chart-container') without a data-source set, but above seems more handy to me.
Hi @norbertsch17 , I wonder what's your concrete demands? Why do you need to display multiple orgcharts within one page ? From my point of view, it's truly not common use case.
Hi folks, Is there a way to add datasources dynamically (no ajax reload), maybe based on some div-attributes? I have numerous charts, all sharing the same settings and createNode() function. Only difference is the datasource (and export filename). Currently I have to repeat the full $(...).orgchart(){} js for all of these charts again and again.
Instead I'd like to do something like
<div class="chart-container" data-chartsource-info="foo"></div>
<div class="chart-container" data-chartsource-info="bar"></div>
etc.
Then start all charts at once with$('.chart-container').orgchart({ [...]
where the data-attribute is a function returning the actual chart data. Something like:'data': function($the-original-chart-dom-object) {
// do something, like reading the
// data-chartsource-info attribute to prepare the dataset
return mydataobject;
}
I could think of alternative ways to do this, maybe call a
setDatasource()
-method after instanciating the charts by$('.chart-container')
without a data-source set, but above seems more handy to me.Any hints on this?
Cheers, Norbert Thanks or this little marvel!