2024-01-02 13:36:08 +00:00
|
|
|
from pandas import date_range, Series
|
2023-12-29 13:37:30 +00:00
|
|
|
from plotly.basedatatypes import BaseTraceType
|
2024-01-01 14:00:09 +00:00
|
|
|
from typing import List
|
2023-12-29 13:37:30 +00:00
|
|
|
|
|
|
|
class Chart:
|
|
|
|
|
2024-01-02 13:36:08 +00:00
|
|
|
x: Series = None
|
2024-01-03 14:32:29 +00:00
|
|
|
title: str = None
|
2024-01-02 13:36:08 +00:00
|
|
|
|
2024-01-01 14:00:09 +00:00
|
|
|
def traces(self) -> List[BaseTraceType]:
|
2024-01-02 13:36:08 +00:00
|
|
|
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)]
|