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
Annotations type change dynamically #46
Comments
I should post a better example of this, if you re-call the function on the selection it should update the type. So assuming you were doing something like this to create the annotations d3.select("svg")
.append("g")
.attr("class", "annotation-group")
.call(makeAnnotations) You would then change you onClick to something like this : function onClick(annotation) {
annotation.color = "#000000";
annotation.type = d3.annotationLabel;
// makeAnnotation.update(); <- this does reset type
d3.select(".annotation-group") //<- this should
.call(makeAnnotations)
} |
And type doesn't change to d3.annotationLabel too (visualisation not changed) |
I believe this version fixes this |
Oh no there was a bug in that version |
Hi,
I have a problem with dynamically changing annotation type. I tring change annotation type when I click on note.
var makeAnnotation= d3.annotation().annotations(annotations0).type(d3.annotationCallout).on('noteclick', onClick)
function onClick(annotation)
{
annotation.color = "#000000"; - it works
annotation.type = d3.annotationLabel; - it doesn't work
makeAnnotation.update();
}
I can change type for all items from annotations0, but I need change a single annotation type.
It works:
makeAnnotation.type(d3.annotationLabel)
d3.select("#groupId0").select("g.annotation-group").call(makeAnnotation)
How can I change a single annotation type?
Thanks.
The text was updated successfully, but these errors were encountered: