Sha256: 50406a48887953dbc5e12936bb80914f9431a2e1afdb6b01373b235a3dcdd7b2

Contents?: true

Size: 971 Bytes

Versions: 948

Compression:

Stored size: 971 Bytes

Contents

import React, { useState } from 'react'
import { Button, Gauge } from 'playbook-ui'

const GaugeLiveData = (props) => {
  const [value, setValue] = useState(50)
  const [name, setName] = useState('Name')

  const updateValue = () => {
    setValue(Math.floor(Math.random() * 100))
  }
  const updateName = () => {
    let index = namesArray.indexOf(name)
    if (namesArray.indexOf(name) == 5) {
      index = 0
    } else {
      index += 1
    }
    setName(namesArray[index])
  }
  const namesArray = ['Name', 'Windows', 'Doors', 'Roofing', 'Siding', 'Gutters']

  return (
    <div>
      <Button
          onClick={updateValue}
          text="Update Value"
          {...props}
      />
      <Button
          onClick={updateName}
          text="Update Name"
          {...props}
      />
      <Gauge
          chartData={[{ name: name, value: value }]}
          id="gauge-live-data"
          {...props}
      />
    </div>
  )
}

export default GaugeLiveData

Version data entries

948 entries across 948 versions & 2 rubygems

Version Path
playbook_ui-14.10.0.pre.rc.22 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.10.0.pre.rc.21 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.10.0.pre.rc.21 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.9.0.pre.alpha.play1703errorstatealignment5060 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.9.0.pre.alpha.play1703errorstatealignment5060 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.10.0.pre.rc.20 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.10.0.pre.rc.20 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.10.0.pre.rc.19 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.10.0.pre.rc.19 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.10.0.pre.rc.18 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.10.0.pre.rc.18 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.9.0.pre.alpha.PLAY1660reactdropzone5020 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.9.0.pre.alpha.PLAY1660reactdropzone5020 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.10.0.pre.rc.17 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.10.0.pre.rc.17 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.10.0.pre.rc.16 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.10.0.pre.rc.16 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.9.0.pre.alpha.play17004992 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui-14.9.0.pre.alpha.play17004992 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx
playbook_ui_docs-14.9.0.pre.alpha.play1703errorstatealignment4991 app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx