Columns not displayed in expected order in legend after adding columns
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.4k
- Avg merge
- 6d 16h
- Merged PRs (30d)
- 1
Description
Demo of issue: http://jsfiddle.net/h2s3ftqo/
I would expect chart.load to insert any new columns in the order specified.
```
chart.load({
columns: [
['18-24', 234],
['25-34', 43],
['35-44', 484],
],
```
Instead, new columns are added to end of the legend, so the legend is in this order:
```
'18-24'
'35-44'
'25-34'
```
(Where the first two age groups were already existing on the chart, and the third age group was added dynamically.)
You can work around this by adding unload:true but then the chart flickers.

Contributor guide
Research direction
Start with the linked JSFiddle demo and trace chart.load when columns are added dynamically, focusing on how the legend order is updated. Confirm that the columns array order is preserved without relying on unload:true, and verify that the legend no longer flickers or places new columns at the end.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- d3, javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100