-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_Gantt.py
70 lines (48 loc) · 2.16 KB
/
run_Gantt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""
Gantt_chart
"""
# Import required packages
import pandas as pd
import pathlib as Path
import plotly.express as px
import plotly
import plotly.graph_objects as go
# Import utils if needeed
import utils_Gantt as utils
def main():
# Standalone input text file
input_file = 'settings.txt'
excel_file, title_name , title_size, font, font_size, font_color, colorbar_colouring, colobar_title_position, chart_name = utils.readSettings(input_file)
# Open excel file as a data frame
excel_file = 'Tasks.xlsx'
df = pd.read_excel(excel_file)
print(df)
# generate the chart
arguments = (df, title_name , title_size, font, font_size, font_color,
colorbar_colouring, colobar_title_position, chart_name)
generateChart(*arguments)
return
def generateChart(df, title_name , title_size, font, font_size, font_color,
colorbar_colouring, colobar_title_position, chart_name):
# Extract information from the data frame
tasks, content, start, end, progression = utils.getInfo(df);
# Generate the chart
fig = px.timeline(df, x_start= start, x_end=end, y = content,
color = progression, title = title_name,
color_continuous_scale = colorbar_colouring)
# Customise
fig.update_yaxes(autorange = 'reversed'); # reverse the heat map
labels_config = dict(family=font, size=font_size, color = font_color)
axis_config = dict(tickfont = dict(family=font, size=font_size, color = font_color));
colorbar_config = dict( title = dict(font=dict(family=font, size=font_size),
side = colobar_title_position) ,
tickfont=dict(family=font, size=font_size) )
fig.update_layout( title_font_size = title_size, title_font_family=font,
font = labels_config,
yaxis = axis_config, xaxis = axis_config,
coloraxis_colorbar = colorbar_config)
# Show the chart
plotly.offline.plot(fig, filename = chart_name)
return
if __name__ == "__main__":
main()