コード例 #1
0
    For example, when you click on an option in a `dcc.Dropdown` component, the
    `value` property of that component changes.

    The `dcc.Graph` component has four attributes that can change
    through user-interaction: `hoverData`, `clickData`, `selectedData`,
    `relayoutData`.
    These properties update when you hover over points, click on points, or
    select regions of points in a graph.

    '''.replace('    ', '')),
    Syntax(examples['simple-graph-events'][0],
           summary="""
            Here's an simple example that
            prints these attributes in the screen.
    """),
    Example(examples['simple-graph-events'][1]),
    html.Hr(),
    html.H3('Update Graphs on Hover'),
    Syntax(examples['world-indicators'][0],
           summary="""
    Let's update our world indicators example from the previous chapter
    by updating time series when we hover over points in our scatter plot.
    """),
    Example(examples['world-indicators'][1]),
    dcc.Markdown(
        s('''
    Try mousing over the points in the scatter plot on the left.
    Notice how the line graphs on the right update based off of the point that
    you are hovering over.
    ''')),
    html.Hr(),
コード例 #2
0
    Syntax(examples[0][0], summary='''
        To get started, create a file named `app.py` with the following code:
    '''),
    dcc.Markdown('''
    Run the app with

    ```
    $ python app.py
    ...Running on http://127.0.0.1:8050/ (Press CTRL+C to quit)
    ```

    and visit [http:127.0.0.1:8050/](http:127.0.0.1:8050/)
    in your web browser. You should see an app that looks like this.
    '''.replace('    ', '')),

    Example(examples[0][1]),

    dcc.Markdown('''
        Note:
        1. The `layout` is composed of a tree of "components" like `html.Div`
           and `dcc.Graph`.
        2. The `dash_html_components` library has a component for every HTML
           tag. The `html.H1(children='Hello Dash')` component generates
           a `<h1>Hello Dash</h1>` HTML element in your application.
        3. Not all components are pure HTML. The `dash_core_components` describe
           higher-level components that are interactive and are generated with
           JavaScript, HTML, and CSS through the React.js library.
        4. Each component is described entirely through keyword attributes.
           Dash is _declarative_: you will primarily describe your application
           through these attributes.
        5. The `children` property is special. By convention, it's always the
コード例 #3
0
    `contents` is a base64 encoded string that contains the files contents,
    no matter what type of file: text files, images, zip files,
    excel spreadsheets, etc.

    ''')),

    Syntax(examples['upload-datafile'][0], summary=dcc.Markdown(s('''
        Here's an example that parses CSV or Excel files and displays
        the results in a table. Note that this example uses the
        `DataTable` prototype from the
        [dash-table-experiments](https://github.com/plotly/dash-table-experiments)
        project.
    '''))),

    Example(examples['upload-datafile'][1]),

    html.Hr(),

    Syntax(examples['upload-image'][0], summary=dcc.Markdown(s('''
        This next example responds to image uploads by displaying them
        in the app with the `html.Img` component.
    '''))),
    Example(examples['upload-image'][1]),

    Syntax(examples['upload-gallery'][0], summary=dcc.Markdown(s('''
        The `children` attribute of the `Upload` component accepts any
        Dash component. Clicking on the children element will trigger the
        upload action, as will dragging and dropping files.
        Here are a few different ways that you could style the upload
        component using standard dash components.
コード例 #4
0
ファイル: state.py プロジェクト: niejn/dash-docs
examples = {
    'basic-input': tools.load_example('tutorial/examples/basic-input.py'),
    'basic-state': tools.load_example('tutorial/examples/basic-state.py')
}

layout = html.Div([
    html.H1('Dash State'),
    dcc.Markdown(
        s('''
        In the previous chapter on
        [basic dash callbacks](/getting-started-part-2),
        our callbacks looked something like:
    ''')),
    Syntax(examples['basic-input'][0]),
    Example(examples['basic-input'][1]),
    dcc.Markdown(
        s('''
        In this example, the callback function is fired whenever any of the
        attributes described by the `dash.dependencies.Input` change.
        Try it for yourself by entering data in the inputs above.

        `dash.dependencies.State` allows you to pass along extra values without
        firing the callbacks. Here's the same example as above but with the
        `dcc.Input` as `dash.dependencies.State` and a button as
        `dash.dependencies.Input`.
    ''')),
    Syntax(examples['basic-state'][0]),
    Example(examples['basic-state'][1]),
    dcc.Markdown(
        s('''
コード例 #5
0
ファイル: graphing.py プロジェクト: thoughtsociety/dash-docs
    For example, when you click on an option in a `dcc.Dropdown` component, the
    `value` property of that component changes.

    The `dcc.Graph` component has four attributes that can change
    through user-interaction: `hoverData`, `clickData`, `selectedData`,
    `relayoutData`.
    These properties update when you hover over points, click on points, or
    select regions of points in a graph.

    '''.replace('    ', '')),
    Syntax(examples['simple-graph-events'][0],
           summary="""
            Here's an simple example that
            prints these attributes in the screen.
    """),
    Example(examples['simple-graph-events'][1]),
    html.Hr(),
    html.H3('Update Graphs on Hover'),
    Syntax(examples['world-indicators'][0],
           summary="""
    Let's update our world indicators example from the previous chapter
    by updating time series when we hover over points in our scatter plot.
    """),
    Example(examples['world-indicators'][1]),
    dcc.Markdown(
        s('''
    Try mousing over the points in the scatter plot on the left.
    Notice how the line graphs on the right update based off of the point that
    you are hovering over.
    ''')),
    html.Hr(),
コード例 #6
0
    `contents` is a base64 encoded string that contains the files contents,
    no matter what type of file: text files, images, zip files,
    excel spreadsheets, etc.

    ''')),

    Syntax(examples['upload-datafile'][0], summary=dcc.Markdown(s('''
        Here's an example that parses CSV or Excel files and displays
        the results in a table. Note that this example uses the
        `DataTable` prototype from the
        [dash-table-experiments](https://github.com/plotly/dash-table-experiments)
        project.
    '''))),

    Example(examples['upload-datafile'][1]),

    html.Hr(),

    Syntax(examples['upload-image'][0], summary=dcc.Markdown(s('''
        This next example responds to image uploads by displaying them
        in the app with the `html.Img` component.
    '''))),
    Example(examples['upload-image'][1]),

    Syntax(examples['upload-gallery'][0], summary=dcc.Markdown(s('''
        The `children` attribute of the `Upload` component accepts any
        Dash component. Clicking on the children element will trigger the
        upload action, as will dragging and dropping files.
        Here are a few different ways that you could style the upload
        component using standard dash components.