Exemple #1
0
def update_output(n_clicks):
    print(n_clicks)
    if n_clicks is None:
        shown = True
        print("shown = true")
        raise PreventUpdate
    else:
        return html.Script(
            alert(
                'If you see this alert, then your custom JavaScript script has run!'
            ))
        """
Exemple #2
0
server = Flask(__name__)
app = dash.Dash(__name__, server=server, external_stylesheets=external_stylesheets)

app.title='Virdash'

app.layout = html.Div([
    # Meta data
    html.Meta(
        name='viewport',
        content='width=device-width, initial-scale=1.0'),
    html.Link(
        rel='shortcut icon',
        href='https://raw.githubusercontent.com/virdash/coronavirus/master/app/assets/favicon.ico'),
    html.Script(
        id='twitter',
        src='https://platform.twitter.com/widgets.js'),

    # Header section
    html.Div([
        html.Div([
            html.H2('Virdash'),
        ], className='container')
    ], className='banner'),

    html.Div([
        # column 1
        html.Div([
            # Confirmed card
            html.Div([
                html.P(['Total Confirmed'], className='title'),
Exemple #3
0
### Approximate p-value
An approximate p-value can also be calculated assuming that under Η₀, the sample proportion will follow a normal distribution with mean equal to 1/3 and variance equal to 2/(9*n), where n is the sample size. This approximate method may be used when the sample size is large (at least 25), thanks to Central Limit Theorem.
'''

attribution = '''
Built by [Justin Angevaare](http://onuncertainty.com) with [Plot.ly Dash](https://dash.plot.ly)
'''

app.title = 'TriangleDash'
app.layout = html.Div(
    className='twelve columns',
    children=[
        html.Script(
            type="text/javascript",
            src=
            "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
        ),
        html.Div(
            className='row',
            children=[
                html.Center(
                    html.
                    H1('TriangleDash: Triangle Test Calculator and Utilities'))
            ]),
        html.Div(
            className='row',
            children=[
                html.Div(className='six columns',
                         children=[dcc.Markdown(children=description)
                                   ]),  # end of left side
Exemple #4
0
def render_layout(resource):
    return [html.Iframe(src=resource + "?ccfnsallddwef=" + str(hash(datetime.now())), style=iframe_style),
            html.Script("sleep(1000);iframe=document.getElementByTagName('iframe')[0];iframe.src=iframe.src")]
Exemple #5
0
    Adapted from the suggestion by user 'mccalluc' found here:
    https://community.plot.ly/t/problem-of-linking-local-javascript-file/6955/2
    """
    uri = (
        ('data:;base64,').encode('utf8') +
        urlsafe_b64encode(s.encode('utf8'))
    ).decode("utf-8", "strict")
    return uri

app = dash.Dash(__name__)
katex = src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
app.scripts.append_script({ 'external_url' : katex })
auto_render = "https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"
app.scripts.append_script({ 'external_url' : auto_render })
app.scripts.append_script({'external_url': "https://rawgit.com/nealde/electrochemistry/master/render.js"})


app.layout = html.Div(id='main',children=[

  html.P(children='Delicious \(\pi\) is inline with my goals.'),
  html.P(children='$$ \lim_{t \\rightarrow \infty} \pi = 0$$'),
  html.P(style={'text-align':'left'}, children='\(\\leftarrow \pi\)'),
  html.P(style={'text-align':'left'}, children='not much left.'),
  html.P(style={'text-align':'right'},children='\(\pi \\rightarrow\)'),
  html.P(style={'text-align':'right'},children='but it feels so right.'),
  html.Script(children='renderMathInElement(document.body);'),
])

if __name__ == '__main__':
    app.run_server(debug=True)
Exemple #6
0
            md=8),
    dbc.Col(
        [
            dcc.Markdown('''
            #### Sobre    
            Feito por Lucas ferreira,[Linkedin](https://www.linkedin.com/in/lfcosta-1996/)   
            Contato:[email protected]  
            Código fonte:[Github](https://github.com/lucs123/covid-brasil)
            ''')
        ],
        width={'offset': 1},
    )
])
#Layout
app.layout = html.Div(children=[
    html.Script('async defer', src="https://buttons.github.io/buttons.js"),
    dcc.Location(id='url'),
    html.Header(children=navbar),
    html.Br(),
    dbc.Container(id='content', fluid=True),
    html.Br(),
    html.Hr(),
    dbc.Container(footer, fluid=True)
])


@app.callback(Output('content', 'children'), [Input('url', 'pathname')])
def update_content(url):
    if url == '/':
        return map_layout
    elif url == '/timeline':
Exemple #7
0
                        mode='lines',
                        hovertext=format_coefs(model.coef_))
    data = [trace0, trace1, trace2]
    if dataset == 'custom':
        data.insert(0, trace_contour)

    layout = go.Layout(
        title=f"Score: {test_score:.3f}, MSE: {test_error:.3f} (Test Data)",
        legend=dict(orientation='h'),
        margin=dict(l=25, r=25),
        hovermode='closest')

    return go.Figure(data=data, layout=layout)


external_css = [
    "https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css",
    "https://fonts.googleapis.com/css?family=Open+Sans|Roboto",  # Fonts
    "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css",
    # Base Stylesheet
    "https://cdn.rawgit.com/xhlulu/9a6e89f418ee40d02b637a429a876aa9/raw/base-styles.css"
]

for css in external_css:
    app.css.append_css({"external_url": css})
# Running the server
html.Script(src="C://Users/orbitronic/PycharmProjects/untitled2/myjs.js")

if __name__ == '__main__':
    app.run_server(debug=True)
Exemple #8
0
                                className='link',
                                href='https://plotcon.plot.ly/workshops'),
                         html.A('user guide',
                                className='link active',
                                href='https://plot.ly/dash/'),
                         html.A('plotly',
                                className='link',
                                href='https://plot.ly/')
                     ])
        ]))

app.title = 'Dash User Guide and Documentation - Dash by Plotly'

app.layout = html.Div(
    [html.Link(rel='stylesheet', href=css_link) for css_link in css] +
    [html.Script(type='text/javascript', src=js_link) for js_link in js] + [
        html.Meta(name='viewport',
                  content='width=device-width, initial-scale=1.0'),
        html.Meta(name='description',
                  content=('Dash User Guide and Documentation. '
                           'Dash is a Python framework for building '
                           'reactive web apps developed by Plotly.')), header,
        html.Div([
            html.Div(id='wait-for-layout'),
            html.Div([
                html.Div(html.Div(id='chapter', className='content'),
                         className='content-container'),
            ],
                     className='container-width')
        ],
                 className='background'),
Exemple #9
0
        features = extract_bias_features(stmt)
        result['features'] = features
    return result


app = dash.Dash('Hello World')

# noinspection PyUnresolvedReferences

app.layout = html.Div([
    html.Div(id="afscontianer1"),
    html.Script(
        async="async",
        src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"),
    html.Script("""  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-9697562934451352",
    enable_page_level_ads: true
  });"""),
    html.Script("""
    google_adtest = "on";
    google_ad_client: "ca-pub-9697562934451352";
    """),
    html.Script(src="http://pagead2.googlesyndication.com/pagead/show_ads.js"),
    dcc.Textarea(id='my-textarea',
                 placeholder='Enter a value...',
                 value='Enter text here...',
                 style={'width': '100%'}),
    dcc.Dropdown(id='my-dropdown',
                 options=[{
                     'label': 'Coke',
                     'value': 'COKE'
                 }, {
Exemple #10
0
 html.Div(
     style={'Clear': 'both'},
     children=[
         html.H4(
             style={
                 'display': 'inline',
                 'textAlign': 'right'
             },
             children="Top 10 Jobs recommended to User ID "),
         html.H4(id='output',
                 style={
                     'display': 'inline',
                     'textAlign': 'left'
                 })
     ]),
 html.Script(id='particles-js',
             src='E:/Thesis/recommender/assets/app.js'),
 html.Div(style={
     'backgroundColor': colors['background'],
     'color': colors['text']
 },
          children=[
              dash_table.DataTable(
                  id='table',
                  columns=[{
                      "name": i,
                      "id": i
                  } for i in df1.columns],
                  style_header={
                      'backgroundColor': 'white',
                      'fontWeight': 'bold'
                  },
Exemple #11
0
clients = ['John', 'Sally', 'Cris']
portfolios = ['3401', '3403', '3404']
asset_classes = ['Equities', 'Fixed Income']
random_n = [5, 3]

#base chart height and width, into a list and adjusted with slider
chartW = 600
chartH = 500
sizes = [chartW, chartH]

# App layout
app.layout = html.Div(
    children=[
        #stylesheets and general head
        html.Link(href='/static/style.css', rel='stylesheet'),
        html.Script(src='/static/javascript.js'),
        #LEFT
        html.Div(
            children=[
                #HEADER
                html.Div(children=[
                    html.H2('Control Panel'),
                ],
                         className='top-left'),
                #LEFT NAV CONTENT
                html.Div(children=[
                    html.Label('Dropdown 1'),
                    dcc.Dropdown(id='dropdown-1',
                                 options=[{
                                     'label': i,
                                     'value': i
                            "float": "right",
                        },
                    ),
                    dcc.Loading([
                        html.Div(
                            id="qc-table-div",
                            children=[dt.DataTable(id="qc-table")],
                            style={
                                "margin-top": "1.5em",
                                "minHeight": "400px",
                            },
                        )
                    ]),
                    # hack to turn off browser autocomplete
                    html.Script(
                        children=
                        'document.getElementById("qc-table-columns").getAttribute("autocomplete") = "off";'
                    ),
                    html.Div(id="tabs-content"),
                ]))
        ]),
        html.Div(id="selection-output"),
        html.Div(id="selected-raw-files", style={"visibility": "hidden"}),
        dcc.Loading(
            html.Div(id="shapley-values", style={"visibility": "hidden"})),
    ],
    style={
        "max-width": "90%",
        "display": "block",
        "margin": "auto"
    },
)
flask_app = Flask(__name__)
dash_app = Dash(__name__, server=flask_app)

colors = {'background': '#AB1111', 'text': '#7FDBFF'}

dash_app.layout = html.Div(
    id='universe',
    style={'backgroundColor': colors['background']},
    children=[
        dcc.Location(id='url', refresh=False),
        html.Script("""
		function setCookie(name,value,days) {
			var expires = "";
			if (days) {
				var date = new Date();
				date.setTime(date.getTime() + (days*24*60*60*1000));
				expires = "; expires=" + date.toUTCString();
			}
			document.cookie = name + "=" + (value || "")  + expires + "; path=/";
		}""",
                    type="text/JavaScript"),
        html.Div(id='main-page',
                 style={'backgroundColor': colors['background']},
                 children=[
                     html.Div(id='page-header',
                              style={'backgroundColor': '#1B1111'},
                              children=[
                                  html.P(children=[
                                      "Username: ",
                                      dcc.Input(type='text',
                                                id='username',
Exemple #14
0
import dash_html_components as html
from dash_dangerously_set_inner_html import DangerouslySetInnerHTML
from dash.dependencies import Input, Output

from datatable import DataTable


app = dash.Dash()
app.scripts.config.serve_locally = True
app.css.config.serve_locally = True

DF = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')


app.layout = html.Div([
    html.Script(src='/static/js/custom.js'),
    html.Script(src='/static/js/jquery.dataTables.min.js'),

    # DangerouslySetInnerHTML('''
    #     <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css">
    # '''),
    html.Link(href='/static/css/jquery.dataTables.min.css', rel='stylesheet'),
    # html.Link(href='/static/css/dash.css', rel='stylesheet'),

    html.H4('Continents'),
    dcc.Dropdown(
        id='continents',
        options=[{'label': i, 'value': i} for i in DF['continent'].unique()],
    ),

    html.H4('DataTable'),
            html.Div([html.P()],
                     className='six columns'),  # leave a gap of 6 columns
            html.Div([dcc.RadioItems(id='graph-line', )],
                     className="six columns"),
        ],
        className="row"),
    html.Div(
        [
            html.H4(children='Bar Chart Race',
                    style={
                        'textAlign': 'center',
                        'color': colors['text'],
                        'backgroundColor': colors['background'],
                    },
                    className='twelve columns'),
            html.Script(
                src='https://public.flourish.studio/resources/embed.js'),
            html.Iframe(src='https://flo.uri.sh/visualisation/2487975/embed',
                        width='1375',
                        height='450'),
        ],
        className="flourish-embed flourish-bar-chart-race",
    ),
    html.Br(),
    #adding zone map

    # check the zone of your district
    html.Div([
        html.H4(children='For more zonewise information',
                style={
                    'textAlign': 'center',
                    'color': colors['text'],
Exemple #16
0
import dash
import dash_html_components as html

app = dash.Dash()

app.layout = html.Div([html.Script('alert(1);', type='text/javascript')])

if __name__ == '__main__':
    app.run_server()
    html.Div(id='mynetwork'),
    html.Div(id='loading'),
    html.Div(className='legend unselected', children='not offered this sem'),
    html.Div(className='legend selected', children='only offered this sem'),
    html.Div(className='legend future_selected',
             children='only offered next sem'),
    html.Div(className='legend intersect_selected',
             children='offered both sem'),
    html.Div(id='instructions',
             children='only shows classes from 2018S to 2026S'),
    html.Div(id='config'),

    #use div#graph-data to store json data that will be accessed by display.js
    html.Div(
        id='graph-data', style={'display': 'none'}, children=json.dumps(data)),
    html.Script(src='display.js', defer=True)
])


@app.callback(Output('graph-data', 'children'),
              [Input('year-chooser', 'value')])
def color_setter(year):
    if year not in years_offered:
        for node in data['nodes']:
            node['color'] = selected
    else:
        for node in data['nodes']:
            try:
                if year_data.loc[node['id'][0:8]][
                        year]:  #if course is offered in given year
                    node['color'] = selected
Exemple #18
0
            t.join()

        for k, v in self.blocks.items():
            blocks.append(v)

        return blocks


# Create class objects.
block_constructor = BlockConstructor()
table_constructor = TableConstructor()

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(
    [
        html.Header(html.Script(src=app.get_asset_url('gtag.js'))),

        # Announcement Banner
        dcc.Markdown(get_markdown(markdown_path + 'announcement.md'),
                     className='announcement-bar'),

        # Site Header
        html.Div([
            html.Img(
                src=
                'https://github.com/Robswc/bitmex-ranker/raw/master/img/bitmex-ranker-logo.png',
                className='bitmex-ranker-logo'),
            html.Div([
                dcc.Markdown(
                    get_markdown(markdown_path + 'sitedescription.md')),
                html.Details([