Skip to content

Commit

Permalink
Move get_line_mode function to LineProperties class.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoliver committed Jan 11, 2024
1 parent 6d3703d commit 8d52fa0
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions dimes/dimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,24 @@ class LineProperties:
marker_fill_color: Union[str, None] = None
is_visible: bool = True

def get_line_mode(self):
if all(
variables is None
for variables in (
self.marker_size,
self.marker_symbol,
self.marker_line_color,
self.marker_fill_color,
)
):
return "lines"
else:
return "lines+markers"


class TimeSeriesData:
"""Time series data."""

class LineMode:
def determine_line_mode(
self, marker_symbol, marker_size, marker_line_color, marker_fill_color
):
if all(
variables is None
for variables in (
marker_size,
marker_symbol,
marker_line_color,
marker_fill_color,
)
):
return "lines"
else:
return "lines+markers"

def __init__(
self,
data_values: list,
Expand Down Expand Up @@ -72,13 +69,6 @@ def __init__(

self.line_properties = line_properties

self.mode = self.LineMode().determine_line_mode(
line_properties.marker_symbol,
line_properties.marker_size,
line_properties.marker_line_color,
line_properties.marker_fill_color,
)


class TimeSeriesAxis:
"""Time series 'Y' axis. May contain multiple `TimeSeriesData` objects."""
Expand Down Expand Up @@ -165,7 +155,7 @@ def finalize_plot(self):
),
name=time_series.name,
yaxis=f"y{axis_id}",
mode=time_series.mode,
mode=time_series.line_properties.get_line_mode(),
visible="legendonly"
if not time_series.line_properties.is_visible
else True,
Expand Down

0 comments on commit 8d52fa0

Please sign in to comment.