# See the License for the specific language governing permissions and
# limitations under the License.
-"""Instantiate a Dash app."""
+"""Instantiate the Report Dash application.
+"""
+
import dash
from dash import dcc
from dash import html
from .layout import html_layout
-def init_dashboard(server):
+def init_report(server):
"""Create a Plotly Dash dashboard.
:param server: Flask server.
:returns: Dash app server.
:rtype: Dash
"""
+
dash_app = dash.Dash(
server=server,
- routes_pathname_prefix="/trending/",
+ routes_pathname_prefix=u"/report/",
external_stylesheets=[
- "/static/dist/css/styles.css",
- "https://fonts.googleapis.com/css?family=Lato",
+ u"/static/dist/css/styles.css",
+ u"https://fonts.googleapis.com/css?family=Lato",
],
)
children=[
create_data_table(df),
],
- id="dash-container",
+ id=u"dash-container",
)
return dash_app.server
def create_data_table(df):
- """Create Dash datatable from Pandas DataFrame."""
+ """Create Dash datatable from Pandas DataFrame.
+
+ DEMO
+ """
+
table = dash_table.DataTable(
- id="database-table",
- columns=[{"name": i, "id": i} for i in df.columns],
- data=df.to_dict("records"),
- sort_action="native",
- sort_mode="native",
- page_size=300,
+ id=u"database-table",
+ columns=[{u"name": i, u"id": i} for i in df.columns],
+ data=df.to_dict(u"records"),
+ sort_action=u"native",
+ sort_mode=u"native",
+ page_size=5,
)
return table