4.0 `attr` not support object as parameter
See original GitHub issueIn 3.X, we can use syntax like:
.attr({
cx: d => d.x,
cy: d => d.y,
r: d => colorScale(d.value),
fill: '#D0021B',
opacity: 0.5,
})
But now, it’s not work and no error prompt. Need change it to
.attr('cx', d=> d.x)
.......
What’s the reason the syntax changed?
Thanks in advance.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Cannot use attr with an object in D3 v4 - Stack Overflow
New answer. Because d3-selection-multi has been deprecated, the adequate solution is just using the regular attr method: selection.attr("foo" ...
Read more >Function Attributes - Using the GNU Compiler Collection (GCC)
Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly...
Read more >OpenAPI Specification - Version 3.0.3 - Swagger
Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect...
Read more >Attribute Class (System) - Microsoft Learn
Encapsulates a method that has no parameters and returns a value of the type specified by the TResult parameter. Activator Class (System). Contains...
Read more >Deprecations Added in Ember 3.x
As part of supporting ES5 getter computed properties, assigning computed properties directly is deprecated. You should replace these assignments with calls to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mbostock, would you please help us understand why
d3-selection-multi
is not recommended. Thank you.In D3 4.0, multi-value map support has moved to the d3-selection-multi repository as an optional plugin, using distinct names (e.g., selection.attrs instead of selection.attr) to avoid ambiguity.