Skip to content

Commit 687645c

Browse files
committed
Test simple dicts and series
Fix #4
1 parent 8e0c40f commit 687645c

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
0.1.0 (2019-12-02)
1+
0.1.2 (2019-12-??)
22
==================
33

4-
Added
4+
Fixed
55
-----
6+
- Sunburst and Treemap charts also work with dictionaries and pandas Series with a one-dimensional index (#4)
7+
8+
9+
0.1.1 (2019-12-02)
10+
==================
611

12+
Added
13+
-----
714
- `Sunburst`, `Treemap` and `Sankey` accept the same arguments as the corresponding Plotly object.
815
- Nested arguments like `marker_colors` are also supported (this is Plotly's _magic underscore notation_).
916

easyplotly/internals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def sunburst_or_treemap(values, root_label=None, branchvalues='total', **kwargs)
3535

3636
for item in org_tree:
3737
if isinstance(item, tuple):
38-
value = values[item]
38+
value = org_tree[item]
3939
if value < 0:
4040
raise ValueError('Negative value {} for {}'.format(value, item))
4141

tests/test_sunburst.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ def test_sunburst_with_root(sunburst_with_root, sunburst_input):
4343
assert Sunburst(sunburst_input, root_label='') == sunburst_with_root
4444

4545

46+
def test_sunburst_simple_index():
47+
sunburst_input = {'A': 2, 'B': 3}
48+
sunburst_expected = go.Sunburst(
49+
ids=['/A', '/B'],
50+
labels=['A', 'B'],
51+
parents=[None, None],
52+
values=[2, 3],
53+
branchvalues='total'
54+
)
55+
assert Sunburst(sunburst_input) == sunburst_expected
56+
57+
4658
def test_sunburst_remainder(sunburst_expected, sunburst_input):
4759
sunburst_expected.branchvalues = 'remainder'
4860
sunburst_expected.values = [1, 2, 1, 0, 0]

0 commit comments

Comments
 (0)