question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

4.0 `attr` not support object as parameter

See original GitHub issue

In 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:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
saun4appcommented, Feb 5, 2017

@mbostock, would you please help us understand why d3-selection-multi is not recommended. Thank you.

3reactions
mbostockcommented, Apr 19, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found