Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Steam Data Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Max Väistö
Steam Data Project
Commits
02105114
Commit
02105114
authored
1 year ago
by
Max Väistö
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parent
27fe3123
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dash_plot_generation/dash_plot_generator.py
+104
-0
104 additions, 0 deletions
dash_plot_generation/dash_plot_generator.py
with
104 additions
and
0 deletions
dash_plot_generation/dash_plot_generator.py
0 → 100644
+
104
−
0
View file @
02105114
import
os
import
pandas
from
dash
import
dash
,
dcc
,
html
,
ctx
,
callback
csv_path
=
os
.
path
.
normpath
(
os
.
getcwd
()
+
os
.
sep
+
os
.
pardir
+
os
.
sep
+
"
api_exploration
"
)
split_csv_path
=
os
.
path
.
join
(
csv_path
,
"
file_segments
"
)
df
=
None
APP
=
None
DASH_ASSETS_PATH
=
"
dash_assets
"
def
initialize_data
():
global
df
files
=
os
.
listdir
(
split_csv_path
)
dataframe
=
None
for
file
in
os
.
listdir
(
split_csv_path
):
file_path
=
os
.
path
.
join
(
split_csv_path
,
file
)
dataframe
=
pandas
.
concat
([
dataframe
,
pandas
.
read_csv
(
file_path
)])
if
dataframe
is
not
None
\
else
pandas
.
read_csv
(
file_path
)
df
=
dataframe
def
initialize_dash
(
host
:
str
=
"
0.0.0.0
"
,
**
kwargs
):
"""
Runs the Dash server.
Args:
host: IP address of the server
kwargs: Variables which are passed down to APP.run function as named arguments.
Note:
The server IP is not actually 0.0.0.0; if the dash app is not accessible via this address, use the same port
number but replace the IP address with your local network IP instead.
"""
global
APP
,
df
unique_developers
=
[
dev
for
dev_list
in
df
[
"
developer
"
].
fillna
(
"
Valve
"
).
unique
()
for
dev
in
dev_list
.
split
(
"
,
"
)]
unique_publishers
=
df
[
"
developer
"
].
fillna
(
"
Valve
"
).
unique
()
# This is ok but the results are still unsatisfactory due to the game company names containing a comma
# unique_publishers = [publisher for publisher_list in df["developer"].fillna("Valve").unique() for publisher
# unique_developers = [dev for dev_list in df["developer"].fillna("Valve").unique() for dev in dev_list.split(",")]
APP
=
dash
.
Dash
(
name
=
__name__
,
assets_folder
=
DASH_ASSETS_PATH
,
external_stylesheets
=
[
'
https://codepen.io/chriddyp/pen/bWLwgP.css
'
]
)
APP
.
layout
=
html
.
Div
(
children
=
[
html
.
Nav
(
className
=
"
nav nav-pills
"
,
children
=
[
html
.
H6
(
"
STEAM-SAVVY
"
,
style
=
{
"
margin-left
"
:
"
30px
"
,
"
width
"
:
"
20%
"
,
"
display
"
:
"
inline-block
"
}),
html
.
A
(
'
About
'
,
className
=
"
nav-item nav-link btn
"
,
href
=
'
/apps/App1
'
,
style
=
{
"
margin-left
"
:
"
300px
"
}),
html
.
A
(
'
Process paper
'
,
className
=
"
nav-item nav-link active btn
"
,
href
=
'
/apps/App2
'
,
style
=
{
"
margin-left
"
:
"
150px
"
})
],
style
=
{
"
background-color
"
:
"
rgb(30,30,30)
"
,
"
color
"
:
"
rgb(255,255,255)
"
}),
html
.
H6
(
"
TEXT
"
),
html
.
Div
(
className
=
"
row
"
,
children
=
[
html
.
Div
(
children
=
[
dcc
.
Tabs
(
id
=
"
tabs_main_plots1
"
,
value
=
"
tab1
"
,
children
=
[
dcc
.
Tab
(
label
=
"
Genre performance
"
,
value
=
"
tab1
"
),
dcc
.
Tab
(
label
=
"
Game popularity
"
,
value
=
"
tab2
"
),
dcc
.
Tab
(
label
=
"
Company revenues
"
,
value
=
"
tab3
"
),
dcc
.
Tab
(
label
=
"
Market performance
"
,
value
=
"
tab4
"
),
],
style
=
{
'
width
'
:
'
80%
'
,
'
display
'
:
'
inline-block
'
,
"
outline
"
:
"
2px dotted black
"
}),
],
style
=
{
'
width
'
:
'
48%
'
,
'
display
'
:
'
inline-block
'
}),
html
.
Div
(
children
=
[
dcc
.
Tabs
(
id
=
"
tabs_main_plots2
"
,
value
=
"
tab3
"
,
children
=
[
dcc
.
Tab
(
label
=
"
Developer infromation
"
,
value
=
"
Valve
"
,
children
=
[
dcc
.
Dropdown
(
id
=
"
developer_dropdown
"
,
options
=
[{
"
label
"
:
developer
,
"
value
"
:
developer
}
for
developer
in
unique_developers
]
)
]),
dcc
.
Tab
(
label
=
"
Publisher information
"
,
value
=
"
tab4
"
,
children
=
[
dcc
.
Dropdown
(
id
=
"
publisher_dropdown
"
,
options
=
[{
"
label
"
:
publisher
,
"
value
"
:
publisher
}
for
publisher
in
unique_publishers
]
),
])
],
style
=
{
'
width
'
:
'
48%
'
,
'
display
'
:
'
inline-block
'
}),
],
style
=
{
'
width
'
:
'
48%
'
,
'
display
'
:
'
inline-block
'
,
"
outline
"
:
"
2px dotted black
"
})
],
style
=
{
'
width
'
:
'
100%
'
}),
])
APP
.
run
(
host
=
host
,
**
kwargs
)
print
(
"
The server has closed!
"
)
if
__name__
==
"
__main__
"
:
initialize_data
()
initialize_dash
()
print
(
csv_path
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment