File size: 1,171 Bytes
976166f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import panel as pn\n",
    "\n",
    "pn.extension('perspective', template='fast', sizing_mode='stretch_width')\n",
    "df = pd.DataFrame(np.random.randn(10, 4), columns=list('ABCD')).cumsum()\n",
    "\n",
    "rollover = pn.widgets.IntInput(name='Rollover', value=15)\n",
    "\n",
    "perspective = pn.pane.Perspective(df, height=400)\n",
    "\n",
    "def stream():\n",
    "    data = df.iloc[-1] + np.random.randn(4)\n",
    "    perspective.stream(data, rollover=rollover.value)\n",
    "\\\n",
    "cb = pn.state.add_periodic_callback(stream, 50)\n",
    "\n",
    "pn.Column(\n",
    "    pn.Row(cb.param.period, rollover, perspective.param.theme),\n",
    "    perspective\n",
    ").servable()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "portfolio_risk_assesment",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3.11.4"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}