@@ -1279,80 +1279,67 @@ def test_df_dataframe_all_args(self):
1279
1279
1280
1280
# check if gantt chart matches with expected output
1281
1281
1282
- df = pd .DataFrame ([['Job A' , '2009-01-01' , '2009-02-30' , 'A' ],
1283
- ['Job B' , '2009-03-05' , '2009-04-15' , 'B' ]],
1284
- columns = ['Task' , 'Start' , 'Finish' , 'Resource' ])
1282
+ df = pd .DataFrame ([['Job A' , '2009-01-01' , '2009-02-30' ],
1283
+ ['Job B' , '2009-03-05' , '2009-04-15' ]],
1284
+ columns = ['Task' , 'Start' , 'Finish' ])
1285
1285
1286
1286
test_gantt_chart = tls .FigureFactory .create_gantt (
1287
- df , colors = 'Blues' , index_col = 'Resource'
1287
+ df , colors = 'Blues'
1288
1288
)
1289
1289
1290
1290
exp_gantt_chart = {
1291
+
1291
1292
'data' : [{'marker' : {'color' : 'white' },
1292
- 'name' : '' ,
1293
- 'x' : ['2009-01-01' , '2009-02-30' ],
1294
- 'y' : [0 , 0 ]},
1295
- {'marker' : {'color' : 'white' },
1296
- 'name' : '' ,
1297
- 'x' : ['2009-03-05' , '2009-04-15' ],
1298
- 'y' : [1 , 1 ]}],
1299
- 'layout' : {'height' : 600 ,
1300
- 'hovermode' : 'closest' ,
1301
- 'shapes' : [{'fillcolor' : 'rgb(5.0, 10.0, 172.0)' ,
1302
- 'line' : {'width' : 0 },
1303
- 'opacity' : 1 ,
1304
- 'type' : 'rect' ,
1305
- 'x0' : '2009-01-01' ,
1306
- 'x1' : '2009-02-30' ,
1307
- 'xref' : 'x' ,
1308
- 'y0' : - 0.2 ,
1309
- 'y1' : 0.2 ,
1310
- 'yref' : 'y' },
1311
- {'fillcolor' : 'rgb(220.0, 220.0, 220.0)' ,
1312
- 'line' : {'width' : 0 },
1313
- 'opacity' : 1 ,
1314
- 'type' : 'rect' ,
1315
- 'x0' : '2009-03-05' ,
1316
- 'x1' : '2009-04-15' ,
1317
- 'xref' : 'x' ,
1318
- 'y0' : 0.8 ,
1319
- 'y1' : 1.2 ,
1320
- 'yref' : 'y' }],
1321
- 'showlegend' : False ,
1322
- 'title' : 'Gantt Chart' ,
1323
- 'width' : 900 ,
1324
- 'xaxis' : {'rangeselector' : {'buttons' : [
1325
- {'count' : 7 ,
1326
- 'label' : '1w' ,
1327
- 'step' : 'day' ,
1328
- 'stepmode' : 'backward' },
1329
- {'count' : 1 ,
1330
- 'label' : '1m' ,
1331
- 'step' : 'month' ,
1332
- 'stepmode' : 'backward' },
1333
- {'count' : 6 ,
1334
- 'label' : '6m' ,
1335
- 'step' : 'month' ,
1336
- 'stepmode' : 'backward' },
1337
- {'count' : 1 ,
1338
- 'label' : 'YTD' ,
1339
- 'step' : 'year' ,
1340
- 'stepmode' : 'todate' },
1341
- {'count' : 1 ,
1342
- 'label' : '1y' ,
1343
- 'step' : 'year' ,
1344
- 'stepmode' : 'backward' },
1345
- {'step' : 'all' }
1346
- ]},
1347
- 'showgrid' : False ,
1348
- 'type' : 'date' ,
1349
- 'zeroline' : False },
1350
- 'yaxis' : {'autorange' : False ,
1351
- 'range' : [- 1 , 3 ],
1352
- 'showgrid' : False ,
1353
- 'ticktext' : ['Job A' , 'Job B' ],
1354
- 'tickvals' : [0 , 1 ],
1355
- 'zeroline' : False }}
1293
+ 'name' : '' ,
1294
+ 'x' : ['2009-01-01' , '2009-02-30' ],
1295
+ 'y' : [0 , 0 ]},
1296
+ {'marker' : {'color' : 'white' },
1297
+ 'name' : '' ,
1298
+ 'x' : ['2009-03-05' , '2009-04-15' ],
1299
+ 'y' : [1 , 1 ]}],
1300
+ 'layout' : {'height' : 600 ,
1301
+ 'hovermode' : 'closest' ,
1302
+ 'shapes' : [{'fillcolor' : 'rgb(5.0, 10.0, 172.0)' ,
1303
+ 'line' : {'width' : 0 },
1304
+ 'opacity' : 1 ,
1305
+ 'type' : 'rect' ,
1306
+ 'x0' : '2009-01-01' ,
1307
+ 'x1' : '2009-02-30' ,
1308
+ 'xref' : 'x' ,
1309
+ 'y0' : - 0.2 ,
1310
+ 'y1' : 0.2 ,
1311
+ 'yref' : 'y' },
1312
+ {'fillcolor' : 'rgb(220.0, 220.0, 220.0)' ,
1313
+ 'line' : {'width' : 0 },
1314
+ 'opacity' : 1 ,
1315
+ 'type' : 'rect' ,
1316
+ 'x0' : '2009-03-05' ,
1317
+ 'x1' : '2009-04-15' ,
1318
+ 'xref' : 'x' ,
1319
+ 'y0' : 0.8 ,
1320
+ 'y1' : 1.2 ,
1321
+ 'yref' : 'y' }],
1322
+ 'showlegend' : False ,
1323
+ 'title' : 'Gantt Chart' ,
1324
+ 'width' : 900 ,
1325
+ 'xaxis' : {'rangeselector' : {'buttons' : [{'count' : 7 ,
1326
+ 'label' : '1w' ,
1327
+ 'step' : 'day' ,
1328
+ 'stepmode' : 'backward' },
1329
+ {'count' : 1 , 'label' : '1m' , 'step' : 'month' , 'stepmode' : 'backward' },
1330
+ {'count' : 6 , 'label' : '6m' , 'step' : 'month' , 'stepmode' : 'backward' },
1331
+ {'count' : 1 , 'label' : 'YTD' , 'step' : 'year' , 'stepmode' : 'todate' },
1332
+ {'count' : 1 , 'label' : '1y' , 'step' : 'year' , 'stepmode' : 'backward' },
1333
+ {'step' : 'all' }]},
1334
+ 'showgrid' : False ,
1335
+ 'type' : 'date' ,
1336
+ 'zeroline' : False },
1337
+ 'yaxis' : {'autorange' : False ,
1338
+ 'range' : [- 1 , 3 ],
1339
+ 'showgrid' : False ,
1340
+ 'ticktext' : ['Job A' , 'Job B' ],
1341
+ 'tickvals' : [0 , 1 ],
1342
+ 'zeroline' : False }}
1356
1343
}
1357
1344
1358
1345
self .assertEqual (test_gantt_chart ['data' ][0 ],
0 commit comments