# Tank Examples and Reference

### Default Tank

An example of a default tank without any extra properties.

    library(dash)
    library(dashDaq)
    library(dashHtmlComponents)
    library(dashCoreComponents)

    app <- Dash$new()

    app$layout(htmlDiv(list(
      daqTank(
        id = 'my-tank',
        value = 5,
        min = 0,
        max = 10,
        style = list('margin-left' = '50px')
      ),
      dccSlider(
        id = 'tank-slider',
        value = 5,
        min = 0,
        max = 10
      )
    )))

    app$callback(
      output(id = "my-tank", property = "value"),
      params = list(input(id = "tank-slider", property = "value")),

      update_output <- function(value) {
        return(value)
      }
    )

    app$run_server()

0
2
4
6
8
10
0 2 4 6 8 10

### Current value with units

Display the current value, along with optional units with the `units` and `showCurrentValue` properties.

    library(dashDaq)

    daqTank(
        value = 6,
        showCurrentValue = TRUE,
        units = "gallons",
        style = list("margin-left" = "50px")
    )

0
2
4
6
8
10
6
gallons

### Height and width

Control the size of the tank by setting `height` and `width`.

    library(dashDaq)

    daqTank(
        height = 75,
        width = 200,
        value = 6,
        style = list("margin-left" = "50px")
    )

0
2
4
6
8
10

### Label

Display a label alongside your tank in the specified position with `label` and `labelPosition`.

    library(dashDaq)

    daqTank(
        value = 3,
        label = "Tank label",
        labelPosition = "bottom"
    )

0
2
4
6
8
10
Tank label

### Custom scales

Control the intervals at which labels are displayed, as well as the labels themselves with the `scale` property.

    library(dashDaq)

    daqTank(
      value = 3,
      scale = list(
        "interval" = 2,
        "labelInterval" = 2,
        "custom" = list("5" = "Set point")
      ),
      style = list("margin-left" = "50px")
    )

0
4
Set point
8
10

### Logarithmic

Use a logarithmic scale for the tank with the specified base by setting `logarithmic=TRUE`.

    library(dashDaq)

    daqTank(
        min = 0,
        max = 10,
        value = 300,
        logarithmic = TRUE,
        base = 3,
        style = list("margin-left" = "50px")
    )

30
32
34
36
38
310

## Tank Properties

> 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` (character; optional): The ID used to identify this component in Dash callbacks.

`value` (numeric; optional): The value of tank. If logarithmic, the displayed value will be the logarithm of the inputted value.

`height` (numeric; default `192`): The height of the tank in pixels.

`width` (numeric; default `112`): The width of the tank in pixels.

`color` (character; optional): The color of tank fill.

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

`currentValueStyle` (named list; optional): text style of current value.

`min` (numeric; default `0`): The minimum value of the tank. If logarithmic, represents minimum exponent.

`max` (numeric; default `10`): The maximum value of the tank. If logarithmic, represents the maximum exponent.

`base` (numeric; default `10`): Base to be used in logarithmic scale.

`logarithmic` (logical; optional): If set to TRUE, a logarithmic scale will be used.

`showCurrentValue` (logical; optional): If TRUE, the current value of the tank will be displayed.

`units` (character; optional): Label for the current value.

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

`label` is a character | named list with keys:

- `label` (character; optional)

- `style` (named list; optional)

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

`scale` (named list; optional): Configuration for the component scale.

`scale` is a named list with keys:

- `custom` (named list; optional): Custom scale marks. The key determines the position and the value determines what will show. If you want to set the style of a specific mark point, the value should be an object which contains style and label properties.

  `custom` is a numeric | named list with keys:

  - `label` (character; optional)

  - `style` (character; optional)

- `interval` (numeric; optional): Interval by which the scale goes up. Attempts to dynamically divide min-max range by default.

- `labelInterval` (numeric; optional): Interval by which labels are added to scale marks. Defaults to 2 (every other mark has a label).

- `start` (numeric; optional): Value to start the scale from. Defaults to min.

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

`style` (named list; optional): Style to apply to the root component element.

`exceedMessage` (character; optional): Warning message when value exceed max.

`lagingMessage` (character; optional): Warning message when value is laging from min.

`textColor` (character; optional): text color.