You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a donut chart that I populate from a reactive source, and therefore I don't have any data to hand when the initial c3.generate is called. Some time later I add the data.
The problem seems to be that generation of the title uses:
// Define g for arc chart area
main.select('.' + CLASS.chart).append("g")
.attr("class", CLASS.chartArcs)
.attr("transform", translate.arc)
.append('text')
.attr('class', CLASS.chartArcsTitle)
.style("text-anchor", "middle")
.text(getArcTitle());
... with ...
function getArcTitle() {
return hasDonutType(c3.data.targets) ? __donut_title : "";
}
but during init the hasDonutType() returns false because c3.data.targets is empty, and the title doesn't seem to be regenerated when adding data sources.
If this isn't a bug, what is the preferred way to do this lazy initialisation?
I did try having a dummy data source called 'Loading...' which I remove afterwards, but that felt a bit clunky.
I could also keep a separate flag to indicate that I should generate things - but this is also clunky as I would rather keep my data updates completely independent of the chart configuration.
The text was updated successfully, but these errors were encountered:
I have a donut chart that I populate from a reactive source, and therefore I don't have any data to hand when the initial c3.generate is called. Some time later I add the data.
I add the data later with:
The problem seems to be that generation of the title uses:
but during init the hasDonutType() returns false because c3.data.targets is empty, and the title doesn't seem to be regenerated when adding data sources.
If this isn't a bug, what is the preferred way to do this lazy initialisation?
I did try having a dummy data source called 'Loading...' which I remove afterwards, but that felt a bit clunky.
I could also keep a separate flag to indicate that I should generate things - but this is also clunky as I would rather keep my data updates completely independent of the chart configuration.
The text was updated successfully, but these errors were encountered: