plotting/chart.py

19 lines
552 B
Python
Raw Normal View History

from pandas import date_range, Series
2023-12-29 13:37:30 +00:00
from plotly.basedatatypes import BaseTraceType
from typing import List
2023-12-29 13:37:30 +00:00
class Chart:
x: Series = None
2024-01-03 14:32:29 +00:00
title: str = None
def traces(self) -> List[BaseTraceType]:
pass
def range_breaks(self) -> List[dict]:
# Assuming x is either a date or timestamp.
start_date = self.x.min()
end_date = self.x.max()
all_dates = date_range(start = start_date, end = end_date)
missing_dates = all_dates.difference(self.x)
return [dict(values = missing_dates)]