Fix string type dates not being parsed.

Fix table flex alignment

Topbar switcher values now update immediately
This commit is contained in:
louisnw
2024-01-12 17:09:23 +00:00
parent 92b8fd0a04
commit 74db7b5353
5 changed files with 8 additions and 4 deletions

View File

@ -100,7 +100,7 @@ if __name__ == '__main__':
df1 = pd.read_csv('ohlc.csv')
# Columns: time | price
df2 = pd.read_csv('ticks.csv', parse_dates=['time'])
df2 = pd.read_csv('ticks.csv')
chart = Chart()

View File

@ -7,7 +7,7 @@ if __name__ == '__main__':
df1 = pd.read_csv('ohlc.csv')
# Columns: time | price
df2 = pd.read_csv('ticks.csv', parse_dates=['time'])
df2 = pd.read_csv('ticks.csv')
chart = Chart()

View File

@ -210,7 +210,10 @@ class SeriesCommon(Pane):
def _single_datetime_format(self, arg):
if isinstance(arg, (str, int, float)) or not pd.api.types.is_datetime64_any_dtype(arg):
try:
arg = pd.to_datetime(arg, unit='ms')
except ValueError:
arg = pd.to_datetime(arg)
arg = self._interval * (arg.timestamp() // self._interval)+self.offset
return arg

View File

@ -18,7 +18,7 @@ if (!window.Table) {
this.reSize(width, height)
this.container.style.display = 'flex'
this.container.style.flexDirection = 'column'
this.container.style.justifyContent = 'space-between'
// this.container.style.justifyContent = 'space-between'
this.container.style.borderRadius = '5px'
this.container.style.color = 'white'

View File

@ -43,6 +43,7 @@ class SwitcherWidget(Widget):
if option not in self.options:
raise ValueError(f"option '{option}' does not exist within {self.options}.")
self.run_script(f'{self.id}.onItemClicked("{option}")')
self.value = option
class MenuWidget(Widget):