-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onrendered event not (immediately) fired after resize #1969
Comments
Hi @tjohannto One of the possibility to apply is turn off the animation by: transition: {
duration: 0
}, And to make a customized legend, legend.contents.template looks more adequate, because you can make your own legend. Also, consider using .export() API to export as image. |
This does not work within my example. thank you. |
I haven't looked in very detail, try modifying for (var i = 0; i < columns.length; i++) {
if (i > 0) {
setTimeout(function(column) {
chart.load({
columns: [
columnData[column],
],
done: redrawLegend
});
}, (i * 5000 / columnData.length), i);
}
}
function redrawLegend() {
chart.$.legend.selectAll("text")
.filter(function() {
return !this.querySelector("tspan");
})
.each(function() {
const [id, value, ratio] = this.innerHTML.split(';');
this.innerHTML = `
<tspan class='id-row' text-anchor='start'>${id}:</tspan>
<tspan class='value-row' x='100' text-anchor='end'>${value} = </tspan>
<tspan class='ratio-row' x='130' text-anchor='end'>${ratio}</tspan>`;
this.parentNode.querySelector("rect").setAttribute("width", 190);
});
} |
thx @netil well, the workaround is to call the |
Make to accept option to specify in different size. Ref naver#815, naver#1969
# [3.0.0-next.3](3.0.0-next.2...3.0.0-next.3) (2021-03-19) ### Bug Fixes * **axis:** fix axis.x.max error throw ([de06361](de06361)), closes [#1981](#1981) * **axis:** fix axis.x.tick.tooltip on rotated axis ([eed2f86](eed2f86)), closes [#1990](#1990) * **axis:** remove x axis transition during resize ([a938681](a938681)), closes [#1949](#1949) * **tooltip:** fix linked tooltip recursive call ([b6af8ec](b6af8ec)), closes [#1979](#1979) * **zoom:** fix zoom on latest chrome ([37edc9b](37edc9b)), closes [/github.com/d3/d3-zoom/issues/231#issuecomment-802305692](https://github.com//github.com/d3/d3-zoom/issues/231/issues/issuecomment-802305692) [#1992](#1992) ### Features * **api:** Enhance .export() option to specify size ([3c2de80](3c2de80)), closes [#815](#815) [#1969](#1969)
@tjohannto, added new feature to export image as desired size. chart.export({
width: 1200,
height: 800
});
// will return image dataURL string To use new feature, it needs to install next # install the next tagged version
npm i billboard.js@next |
# [3.0.0](2.2.6...3.0.0) (2021-03-26) ### Bug Fixes * **axis:** fix axis.x.max error throw ([de06361](de06361)), closes [#1981](#1981) * **axis:** fix axis.x.tick.tooltip on rotated axis ([eed2f86](eed2f86)), closes [#1990](#1990) * **subchart:** fix duplicated node generation on data load ([d9a5d9a](d9a5d9a)), closes [#2003](#2003) * **zoom:** fix zoom on latest chrome ([37edc9b](37edc9b)), closes [/github.com/d3/d3-zoom/issues/231#issuecomment-802305692](https://github.com//github.com/d3/d3-zoom/issues/231/issues/issuecomment-802305692) [#1992](#1992) ### Features * **all:** update for d3 v6 ([2752e55](2752e55)), closes [#1641](#1641) * **api:** Enhance .export() option to specify size ([3c2de80](3c2de80)), closes [#815](#815) [#1969](#1969) * **api:** Intent to ship subchart APIs ([5572dc9](5572dc9)), closes [#1993](#1993) * **candlestick:** Intent to ship candlestick ([8d37bd8](8d37bd8)), closes [#76](#76) [#1167](#1167) * **candlestick:** Intent to ship candlestick type ([42307cb](42307cb)) ### BREAKING CHANGES * **all:** - Update to work on d3 v6 - Added getPoint() to get event's position coordinate https://github.com/d3/d3/blob/master/CHANGES.md https://observablehq.com/d/f91cccf0cad5e9cb
I am using the chart onrendered event to create a custom legend including values and ratios for Pie-charts.
These charts are exported to PDF/PNG or PPTx using canvg. For this export the charts are upscaled to a higher resolution than used on screen. During this upscaling via bb.resize() the onrendered event does not seem to be fired immediately. Then the legend looks odd ;)
If have created a fiddle to show the issue:
https://jsfiddle.net/c3egh71u/
(click export to canvas)
Is there any way to prevent this or a better (and working) solution?
The text was updated successfully, but these errors were encountered: