score:1
Accepted answer
Converting the function() {}
syntax into arrow functions will allow you to maintain the this
.
So:
function(d) { return this.get('xScale'); }
becomes
(d) => this.get('xScale')
or
(d) => {
return this.get('xScale');
}
For more information on arrow functions: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions - https://hackernoon.com/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4
Source: stackoverflow.com
Related Query
- How to add updating labels in D3 Vertical Bar Chart in an Ember Application
- D3 : How to add labels top of in each bar in grouped bar chart
- d3.js How to add lines to a bar chart
- How do I add labels to d3.js force bubble chart
- d3.js bar chart sorting: can't figure out how to sort x-axis labels along with bars
- How to add a line on x-axis on a horizontal bar chart in d3
- How to add a fixed range vertical line to a D3.js chart
- Add labels to bar chart D3
- How to add space between bars in a grouped bar chart in a nvd3 grouped multibar chart?
- How to modify axis labels in d3 for a stacked bar chart when the axis labels are mapped as part of the scale's domain
- D3 updating a vertical stacked bar chart
- Dimple.js - Add data labels to each bar of the bar chart
- reverse how vertical bar chart is drawn
- How to add svg rectangles as background behind axis tick labels in d3js if ticks are inside chart
- d3 v4 how to add data labels to bar graph
- How to add text legends in bars of a bar chart in D3?
- How to add live data to stacked bar chart
- Add vertical line to d3js bar chart
- how to add tooltip bar chart d3.js
- How to add labels for regions in c3.js line chart or detail chart?
- How to add a tooltip that shows a bar chart onto a d3.js map
- d3.js How to draw line chart with vertical x axis labels
- d3 bar chart labels not getting updated on updating the chart with the new data
- How add vertical line to bar char in d3js?
- How to add data labels to dimple.js bar charts?
- How to center align text labels on bar chart using d3js
- Add labels under every bar of the grouped bar chart on D3
- How to add multiple tool tips to a bar chart
- Updating d3 bar chart labels with new data of variable length
- D3 How to add rounded top border to a stacked bar chart
More Query from same tag
- How to calculate sum of arc values
- How do i change the styling of a nodes CSS through javascript(d3)
- d3 Sankey - Highlight all connected paths from start to end
- D3.js map projections on a canvas image
- What is the proper way in Node.js/Express framework to pass data to d3 for rendering graphical data
- SVG not drawn outside the visible area of Google Maps
- D3 Change color and scale based on radio button
- d3.js - rotate axis and boxes together
- Finding x,y coordinates of a point on an Archimedean spiral
- how to inject d3 dependency?
- Convert object created in HTML to React
- d3.js forced directed graph effects on enter
- d3 donut chart not visible entirely when in mobile view
- d3 scoping causes SVG to revert to initial data?
- Inconsistent behavior when applying multiple colorAxis objects to line vs. bubble plots in dimple.js
- change range for date in d3 graph
- Calling D3 Tooltip in context of data visualization in AngularJS
- How can I fill gaps in a dc.js series chart?
- Error dragging with Ctrl key being pressed
- how to draw a d3 bubble chart for a local geojson file
- Code adapted from D3 v3 to v5 needs an extra update to render correctly
- d3.Js - How to set custom("string") values to `y-Axis` - ticks
- Find a point on an SVG path
- Stepline Chart with D3.js with individual lines
- dc.js x-axis default domain - strange results
- D3 js - line not showing in real time line graph
- SVG path goes beyond chart area on d3 brush
- Don't show negative sign d3 axis labels
- Why is d3.histogram merging the last two bins of this chart?
- Why isn't the C3 Chart appearing?