To make a scrollable container, you'll have to create a separate svg for the legends itself and contain it within a div and position the div to the coordinates you need. (Of course, you'll have to add CSS to the div i.e. max-height to be pie-chart height and overflow: auto; to have the feature of auto-scrolling)
Let me know if you need help with that.
For the alternative, you can just do this without altering the original data:
var legend = svg.selectAll('.legend') .data(color.domain().slice(0, 10))
- d3.js - Autoscroll for pie chart legend
- How to Increase the width of C3 pie chart Legend only. Not for the whole graph
- Legend toggling for d3.js pie chart
- How to customize legend text in pie chart for angular-nvd3?
- How to add a nice legend to a d3 pie chart
- how to add legend to a pie chart using D3js? And how to centralise the pie chart?
- Return multiple values from a crossfilter dimension for a pie chart
- d3js Create legend for bar chart
- Error in A Simple D3 Line chart with Legend and Tooltips for D3v 3.5.13
- Creating a legend for a bubble chart using D3
- How create legend for bubble chart in d3? Legend not showing up
- D3.js method for converting pie chart into spectrum display
- d3v4 checkout chart - making sure the color scheme is correct for the legend and circles
- How to word wrap the legend text for a donut chart
- dc-js disable selecting slices on click for pie chart
- hack for d3 pie chart with 'zero' data
- d3.js - Smooth transition on arc draw for pie chart
- How do I color labels for my pie chart in D3?
- d3 how to tween inner radius for pie chart
- Hide legend items if value is equal to 0 in NVD3.js Pie Chart
- Tooltips for multiple lines chart with legend click d3.js
- Pie chart legend in dc.js 1.7 not showing up
- Couldn't replace numbers with values in d3 js pie chart legend
- d3 - label placement for a nested pie chart
- SVG Legend for multi line chart d3 v6
- How to add legend to a pie chart D3.js?
- D3.js pie chart labels for slices not tweening
- legend not visible in d3.js pie chart
- How to put a legend in a pie chart in d3.js
- dc.js: expense tracker, show distribution for each month in a pie chart
More Query from same tag
- How can add text to the center of a D3 sunburst diagram
- d3.behavior.zoom() moves graph to corner instead of center
- select options are not being shown using d3.js?
- Drawing states separately with d3 js and country topojson file
- How to switch csv dataset of d3.js graph to another csv by clicking on button
- d3 height function returns NaN
- Why the attrTween doesn't work
- d3 pie labels aren't in right place, centroids are way off for some reason
- Cannot display links between Nodes in D3.JS and Angular Typescript
- Add ellipses to overflowing text in SVG?
- d3 preventing drag on specific elements
- R / d3heatmap / shiny - is there a way to embed images in d3 tooltip?
- plotting data points on waves from dynamically generated data using d3.js
- D3.js: Clustered Force layout with text and tool tips
- D3 axis ticks and grid lines do not align
- Can't see circles in d3.js
- d3 histogram and barchart data
- Drag events not getting fired easily using d3-drag on svg elements
- Complication in accessing Object's value in D3 V4
- how to use zoom.wheelDelta in d3 v4
- Not able to use python-nvd3
- How to make seperate file of d3.js pie chart and load it to html page
- d3 enter().append() not appending all elements of my array
- adding mouseover event to d3.js bar chart
- D3 chart doesn't show up
- How to flip by Y venn diagramm? (venn.js)
- d3-tip: the tooltip appears in the wrong place when I display more than one chart