Joystick Examples and Reference


Default Joystick

An example of a default Joystick without any extra properties.

import dash
from dash.dependencies import Input, Output
import dash_daq as daq
import dash_html_components as html

app = dash.Dash(__name__)

app.layout = html.Div([
    daq.Joystick(
        id='my-joystick-1',
        label="Default",
        angle=0
    ),
    html.Div(id='joystick-output-1')
])

@app.callback(
    Output('joystick-output-1', 'children'),
    Input('my-joystick-1', 'angle'),
    Input('my-joystick-1', 'force')
)
def update_output(angle, force):
    return ['Angle is {}'.format(angle), html.Br(), 'Force is {}'.format(force)]

if __name__ == '__main__':
    app.run_server(debug=True)

Label

Change the label and label orientation with label and labelPosition.

import dash_daq as daq

daq.Joystick(
  label="Label",
  labelPosition="bottom"
)

Size

Change the size of the joystick with size.

import dash_daq as daq

daq.Joystick(
  size=250
)

Joystick Properties

Access this documentation in your Python terminal with:
```python

help(dash_daq.Joystick)
```

Our recommended IDE for writing Dash apps is Dash Enterprise’s
Data Science Workspaces,
which has typeahead support for Dash Component Properties.
Find out if your company is using
Dash Enterprise
.

id (string; optional):
The ID used to identify the color picker in Dash callbacks.

angle (number; optional):
Joystick angle in degrees, 0 = right, 90 = up, 180 = left, 270 = down.

className (string; optional):
Class to apply to the root component element.

disabled (boolean; optional):
If True, color cannot be picked.

force (number; optional):
Joystick force: distance between cursor and center in big-circle radii.

label (dict; optional):
Description to be displayed alongside the control. To control styling,
pass an object with label and style properties.

label is a string | dict with keys:

labelPosition (a value equal to: ‘top’ or ‘bottom’; default 'top'):
Where the indicator label is positioned.

size (number; default 100):
Size (width) of the component in pixels.

style (dict; optional):
Style to apply to the root component element.

theme (dict; default light):
Theme configuration to be set by a ThemeProvider.