Skip to content

Commit

Permalink
fix(_psych): fix the order of elements
Browse files Browse the repository at this point in the history
  • Loading branch information
devang-chauhan committed Jan 7, 2022
1 parent 1cfd549 commit 311f7d6
Showing 1 changed file with 69 additions and 68 deletions.
137 changes: 69 additions & 68 deletions ladybug_charts/_psych.py
Expand Up @@ -89,74 +89,6 @@ def _psych_chart(psych: PsychrometricChart, data: BaseCollection = None,
psych_dummy = PsychrometricChart(dbt, rh, base_point=base_point, x_dim=1, y_dim=1)

fig = go.Figure()
###########################################################################
# Add lines
###########################################################################

# add relative humidity lines
for count, polyline in enumerate(psych_dummy.rh_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(polyline.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="RH " + psych_dummy.rh_labels[count] + "%",
line=dict(width=1, color="#85837f"),
)
)

# add enthalpy lines
for count, line in enumerate(psych_dummy.enthalpy_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(line.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="Enthalpy " + psych_dummy.enthalpy_labels[count],
line=dict(width=1, color="#85837f"),
)
)

# add temperature lines
for count, line in enumerate(psych_dummy.temperature_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(line.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="Temperature " +
psych_dummy.temperature_labels[count] + ' C',
line=dict(width=1, color="#85837f"),
)
)

# add humidity ratio lines
for count, line in enumerate(psych_dummy.hr_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(line.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="Humidity Ratio " + psych_dummy.hr_labels[count],
line=dict(width=1, color="#85837f"),
)
)

###########################################################################
# if no data is provided, plot frequency
Expand Down Expand Up @@ -268,6 +200,75 @@ def _psych_chart(psych: PsychrometricChart, data: BaseCollection = None,
# add the dummy trace to the figure
fig.add_trace(colorbar_trace)

###########################################################################
# Add lines
###########################################################################

# add relative humidity lines
for count, polyline in enumerate(psych_dummy.rh_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(polyline.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="RH " + psych_dummy.rh_labels[count] + "%",
line=dict(width=1, color="#85837f"),
)
)

# add enthalpy lines
for count, line in enumerate(psych_dummy.enthalpy_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(line.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="Enthalpy " + psych_dummy.enthalpy_labels[count],
line=dict(width=1, color="#85837f"),
)
)

# add temperature lines
for count, line in enumerate(psych_dummy.temperature_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(line.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="Temperature " +
psych_dummy.temperature_labels[count] + ' C',
line=dict(width=1, color="#85837f"),
)
)

# add humidity ratio lines
for count, line in enumerate(psych_dummy.hr_lines):
# get cordinates from vertices of polygons
x_cords, y_cords = verts_to_coordinates(line.vertices, close=False)
fig.add_trace(
go.Scatter(
x=x_cords,
y=y_cords,
showlegend=False,
mode="lines",
name="",
hovertemplate="Humidity Ratio " + psych_dummy.hr_labels[count],
line=dict(width=1, color="#85837f"),
)
)

###########################################################################
# add polygons if requested
###########################################################################
Expand Down

0 comments on commit 311f7d6

Please sign in to comment.