@@ -1514,18 +1514,32 @@ def test_gannt_groups_and_descriptions(self):
1514
1514
group_tasks = True
1515
1515
)
1516
1516
1517
- exp_gantt_chart = {'data' : [{'x' : ['2008-10-05' ,
1518
- '2009-04-15' ,
1519
- '2008-12-06' ,
1520
- '2009-03-15' ,
1521
- '2008-09-07' ,
1522
- '2009-03-15' ,
1523
- '2009-05-08' ,
1524
- '2009-04-15' ,
1525
- '2009-04-20' ,
1526
- '2009-05-30' ],
1527
- 'y' : [2 , 2 , 1 , 1 , 0 , 0 , 0 , 0 , 2 , 2 ],
1528
- 'mode' : 'markers' ,
1517
+ exp_gantt_chart = {'layout' : {'showlegend' : True ,
1518
+ 'yaxis' : {'range' : [- 1 , 4 ],
1519
+ 'zeroline' : False ,
1520
+ 'ticktext' : ['Task C' , 'Task B' , 'Task A' ],
1521
+ 'tickvals' : [0 , 1 , 2 ],
1522
+ 'autorange' : False ,
1523
+ 'showgrid' : False },
1524
+ 'title' : 'Gantt Chart' ,
1525
+ 'height' : 600 ,
1526
+ 'shapes' : [],
1527
+ 'width' : 900 ,
1528
+ 'xaxis' : {'zeroline' : False ,
1529
+ 'rangeselector' : {'buttons' : [{'count' : 7 ,
1530
+ 'step' : 'day' ,
1531
+ 'stepmode' : 'backward' ,
1532
+ 'label' : '1w' },
1533
+ {'count' : 1 , 'step' : 'month' , 'stepmode' : 'backward' , 'label' : '1m' },
1534
+ {'count' : 6 , 'step' : 'month' , 'stepmode' : 'backward' , 'label' : '6m' },
1535
+ {'count' : 1 , 'step' : 'year' , 'stepmode' : 'todate' , 'label' : 'YTD' },
1536
+ {'count' : 1 , 'step' : 'year' , 'stepmode' : 'backward' , 'label' : '1y' },
1537
+ {'step' : 'all' }]},
1538
+ 'type' : 'date' ,
1539
+ 'showgrid' : False },
1540
+ 'hovermode' : 'closest' },
1541
+ 'data' : [{'showlegend' : False ,
1542
+ 'name' : '' ,
1529
1543
'text' : ['Task A - 1' ,
1530
1544
'Task A - 1' ,
1531
1545
'Task B - 1' ,
@@ -1547,9 +1561,31 @@ def test_gannt_groups_and_descriptions(self):
1547
1561
'rgb(220, 0, 0)' ,
1548
1562
'rgb(220, 0, 0)' ],
1549
1563
'size' : 1 },
1550
- 'name' : '' ,
1551
- 'showlegend' : False },
1552
- {'x' : ['2008-10-05' ,
1564
+ 'mode' : 'markers' ,
1565
+ 'y' : [2 , 2 , 1 , 1 , 0 , 0 , 0 , 0 , 2 , 2 ],
1566
+ 'x' : ['2008-10-05' ,
1567
+ '2009-04-15' ,
1568
+ '2008-12-06' ,
1569
+ '2009-03-15' ,
1570
+ '2008-09-07' ,
1571
+ '2009-03-15' ,
1572
+ '2009-05-08' ,
1573
+ '2009-04-15' ,
1574
+ '2009-04-20' ,
1575
+ '2009-05-30' ]},
1576
+ {'name' : 'TB' ,
1577
+ 'fillcolor' : 'rgb(170, 14, 200)' ,
1578
+ 'mode' : 'none' ,
1579
+ 'hoverinfo' : 'name' ,
1580
+ 'y' : [0.8 , 0.8 , 1.2 , 1.2 ],
1581
+ 'x' : ['2008-12-06' , '2009-03-15' , '2009-03-15' , '2008-12-06' ],
1582
+ 'fill' : 'toself' },
1583
+ {'name' : 'TA' ,
1584
+ 'fillcolor' : 'rgb(220, 0, 0)' ,
1585
+ 'mode' : 'none' ,
1586
+ 'hoverinfo' : 'name' ,
1587
+ 'y' : [1.8 , 1.8 , 2.2 , 2.2 , None , 1.8 , 1.8 , 2.2 , 2.2 ],
1588
+ 'x' : ['2008-10-05' ,
1553
1589
'2009-04-15' ,
1554
1590
'2009-04-15' ,
1555
1591
'2008-10-05' ,
@@ -1558,20 +1594,13 @@ def test_gannt_groups_and_descriptions(self):
1558
1594
'2009-05-30' ,
1559
1595
'2009-05-30' ,
1560
1596
'2009-04-20' ],
1561
- 'y' : [1.8 , 1.8 , 2.2 , 2.2 , None , 1.8 , 1.8 , 2.2 , 2.2 ],
1562
- 'mode' : 'none' ,
1563
- 'fill' : 'toself' ,
1564
- 'hoverinfo' : 'name' ,
1565
- 'fillcolor' : 'rgb(220, 0, 0)' ,
1566
- 'name' : 'TA' },
1567
- {'x' : ['2008-12-06' , '2009-03-15' , '2009-03-15' , '2008-12-06' ],
1568
- 'y' : [0.8 , 0.8 , 1.2 , 1.2 ],
1597
+ 'fill' : 'toself' },
1598
+ {'name' : 'TC' ,
1599
+ 'fillcolor' : 'rgb(255, 230, 41)' ,
1569
1600
'mode' : 'none' ,
1570
- 'fill' : 'toself' ,
1571
1601
'hoverinfo' : 'name' ,
1572
- 'fillcolor' : 'rgb(170, 14, 200)' ,
1573
- 'name' : 'TB' },
1574
- {'x' : ['2008-09-07' ,
1602
+ 'y' : [- 0.2 , - 0.2 , 0.2 , 0.2 , None , - 0.2 , - 0.2 , 0.2 , 0.2 ],
1603
+ 'x' : ['2008-09-07' ,
1575
1604
'2009-03-15' ,
1576
1605
'2009-03-15' ,
1577
1606
'2008-09-07' ,
@@ -1580,52 +1609,12 @@ def test_gannt_groups_and_descriptions(self):
1580
1609
'2009-04-15' ,
1581
1610
'2009-04-15' ,
1582
1611
'2009-05-08' ],
1583
- 'y' : [- 0.2 , - 0.2 , 0.2 , 0.2 , None , - 0.2 , - 0.2 , 0.2 , 0.2 ],
1584
- 'mode' : 'none' ,
1585
- 'fill' : 'toself' ,
1586
- 'hoverinfo' : 'name' ,
1587
- 'fillcolor' : 'rgb(255, 230, 41)' ,
1588
- 'name' : 'TC' }],
1589
- 'layout' : {'title' : 'Gantt Chart' ,
1590
- 'showlegend' : True ,
1591
- 'height' : 600 ,
1592
- 'width' : 900 ,
1593
- 'shapes' : [],
1594
- 'hovermode' : 'closest' ,
1595
- 'yaxis' : {'showgrid' : False ,
1596
- 'ticktext' : ['Task C' , 'Task B' , 'Task A' ],
1597
- 'tickvals' : [0 , 1 , 2 ],
1598
- 'range' : [- 1 , 4 ],
1599
- 'autorange' : False ,
1600
- 'zeroline' : False },
1601
- 'xaxis' : {'showgrid' : False ,
1602
- 'zeroline' : False ,
1603
- 'rangeselector' : {'buttons' : [{'count' : 7 ,
1604
- 'label' : '1w' ,
1605
- 'step' : 'day' ,
1606
- 'stepmode' : 'backward' },
1607
- {'count' : 1 , 'label' : '1m' , 'step' : 'month' , 'stepmode' : 'backward' },
1608
- {'count' : 6 , 'label' : '6m' , 'step' : 'month' , 'stepmode' : 'backward' },
1609
- {'count' : 1 , 'label' : 'YTD' , 'step' : 'year' , 'stepmode' : 'todate' },
1610
- {'count' : 1 , 'label' : '1y' , 'step' : 'year' , 'stepmode' : 'backward' },
1611
- {'step' : 'all' }]},
1612
- 'type' : 'date' }}
1613
- }
1612
+ 'fill' : 'toself' }]}
1614
1613
1615
- self .assertEqual (test_gantt_chart ['data' ][0 ],
1616
- exp_gantt_chart ['data' ][0 ])
1617
1614
1618
- self .assertEqual (test_gantt_chart ['data' ][1 ],
1619
- exp_gantt_chart ['data' ][1 ])
1620
1615
1621
- self .assertEqual (test_gantt_chart ['data' ][2 ],
1622
- exp_gantt_chart ['data' ][2 ])
1623
-
1624
- self .assertEqual (test_gantt_chart ['data' ][3 ],
1625
- exp_gantt_chart ['data' ][3 ])
1626
-
1627
- self .assertEqual (test_gantt_chart ['layout' ],
1628
- exp_gantt_chart ['layout' ])
1616
+ self .assertDictEqual (test_gantt_chart ['data' ][0 ],
1617
+ exp_gantt_chart ['data' ][0 ])
1629
1618
1630
1619
def test_gantt_all_args (self ):
1631
1620
@@ -1646,57 +1635,57 @@ def test_gantt_all_args(self):
1646
1635
height = 500 , width = 500
1647
1636
)
1648
1637
1649
- exp_gantt_chart = {'data' : [{'x' : ['2010-01-01' , '2011-02-02' , '2011-01-01' , '2012-06-05' ],
1650
- 'y' : [0 , 0 , 1 , 1 ],
1651
- 'mode' : 'markers' ,
1638
+ exp_gantt_chart = {'layout' : {'showlegend' : False ,
1639
+ 'yaxis' : {'range' : [- 1 , 3 ],
1640
+ 'zeroline' : False ,
1641
+ 'ticktext' : ['Run' , 'Fast' ],
1642
+ 'tickvals' : [0 , 1 ],
1643
+ 'autorange' : False ,
1644
+ 'showgrid' : True },
1645
+ 'title' : 'Title' ,
1646
+ 'height' : 500 ,
1647
+ 'shapes' : [],
1648
+ 'width' : 500 ,
1649
+ 'xaxis' : {'zeroline' : False ,
1650
+ 'rangeselector' : {'buttons' : [{'count' : 7 ,
1651
+ 'step' : 'day' ,
1652
+ 'stepmode' : 'backward' ,
1653
+ 'label' : '1w' },
1654
+ {'count' : 1 , 'step' : 'month' , 'stepmode' : 'backward' , 'label' : '1m' },
1655
+ {'count' : 6 , 'step' : 'month' , 'stepmode' : 'backward' , 'label' : '6m' },
1656
+ {'count' : 1 , 'step' : 'year' , 'stepmode' : 'todate' , 'label' : 'YTD' },
1657
+ {'count' : 1 , 'step' : 'year' , 'stepmode' : 'backward' , 'label' : '1y' },
1658
+ {'step' : 'all' }]},
1659
+ 'type' : 'date' ,
1660
+ 'showgrid' : True },
1661
+ 'hovermode' : 'closest' },
1662
+ 'data' : [{'showlegend' : False ,
1663
+ 'name' : '' ,
1652
1664
'text' : [None , None , None , None ],
1653
1665
'marker' : {'color' : ['rgb(220.0, 220.0, 220.0)' ,
1654
1666
'rgb(220.0, 220.0, 220.0)' ,
1655
1667
'rgb(166.25, 167.5, 208.0)' ,
1656
1668
'rgb(166.25, 167.5, 208.0)' ],
1657
1669
'size' : 1 },
1658
- 'name' : '' ,
1659
- 'showlegend' : False },
1660
- {'x' : ['2010-01-01' , '2011-02-02' , '2011-02-02' , '2010-01-01' ],
1661
- 'y' : [- 0.5 , - 0.5 , 0.5 , 0.5 ],
1670
+ 'mode' : 'markers' ,
1671
+ 'y' : [0 , 0 , 1 , 1 ],
1672
+ 'x' : ['2010-01-01' , '2011-02-02' , '2011-01-01' , '2012-06-05' ]},
1673
+ {'showlegend' : False ,
1674
+ 'name' : '25' ,
1675
+ 'fillcolor' : 'rgb(166.25, 167.5, 208.0)' ,
1662
1676
'mode' : 'none' ,
1663
- 'fill' : 'toself' ,
1664
- 'showlegend' : False ,
1665
1677
'hoverinfo' : 'name' ,
1666
- 'fillcolor' : 'rgb(220.0, 220.0, 220.0)' ,
1667
- 'name' : '0' },
1668
- {'x' : ['2011-01-01' , '2012-06-05' , '2012-06-05' , '2011-01-01' ],
1669
1678
'y' : [0.5 , 0.5 , 1.5 , 1.5 ],
1679
+ 'x' : ['2011-01-01' , '2012-06-05' , '2012-06-05' , '2011-01-01' ],
1680
+ 'fill' : 'toself' },
1681
+ {'showlegend' : False ,
1682
+ 'name' : '0' ,
1683
+ 'fillcolor' : 'rgb(220.0, 220.0, 220.0)' ,
1670
1684
'mode' : 'none' ,
1671
- 'fill' : 'toself' ,
1672
- 'showlegend' : False ,
1673
1685
'hoverinfo' : 'name' ,
1674
- 'fillcolor' : 'rgb(166.25, 167.5, 208.0)' ,
1675
- 'name' : '25' }],
1676
- 'layout' : {'title' : 'Title' ,
1677
- 'showlegend' : False ,
1678
- 'height' : 500 ,
1679
- 'width' : 500 ,
1680
- 'shapes' : [],
1681
- 'hovermode' : 'closest' ,
1682
- 'yaxis' : {'showgrid' : True ,
1683
- 'ticktext' : ['Run' , 'Fast' ],
1684
- 'tickvals' : [0 , 1 ],
1685
- 'range' : [- 1 , 3 ],
1686
- 'autorange' : False ,
1687
- 'zeroline' : False },
1688
- 'xaxis' : {'showgrid' : True ,
1689
- 'zeroline' : False ,
1690
- 'rangeselector' : {'buttons' : [{'count' : 7 ,
1691
- 'label' : '1w' ,
1692
- 'step' : 'day' ,
1693
- 'stepmode' : 'backward' },
1694
- {'count' : 1 , 'label' : '1m' , 'step' : 'month' , 'stepmode' : 'backward' },
1695
- {'count' : 6 , 'label' : '6m' , 'step' : 'month' , 'stepmode' : 'backward' },
1696
- {'count' : 1 , 'label' : 'YTD' , 'step' : 'year' , 'stepmode' : 'todate' },
1697
- {'count' : 1 , 'label' : '1y' , 'step' : 'year' , 'stepmode' : 'backward' },
1698
- {'step' : 'all' }]},
1699
- 'type' : 'date' }}}
1686
+ 'y' : [- 0.5 , - 0.5 , 0.5 , 0.5 ],
1687
+ 'x' : ['2010-01-01' , '2011-02-02' , '2011-02-02' , '2010-01-01' ],
1688
+ 'fill' : 'toself' }]}
1700
1689
1701
1690
self .assertEqual (test_gantt_chart ['data' ][0 ],
1702
1691
exp_gantt_chart ['data' ][0 ])
0 commit comments