Sha256: 9f3077751f9e818fb6c4fb8eb6885e7f4a8eeae13ad6776fa3caac008623e4e7

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { pbChart } from '../'
import { spacing } from '../utilities/spacing.js'

type BarGraphProps = {
  axisTitle: String,
  xAxisCategories: Array,
  yAxisMin: Number,
  yAxisMax: Number,
  chartData: Array<{
    name: String,
    data: Array<Number>,
  }>,
  className?: String,
  id: Number,
  pointStart: Number,
  subTitle?: String,
  title: String,
  type?: String,
  legend?: Boolean,
  height?: String,
}

export default class BarGraph extends React.Component<BarGraphProps> {
  static defaultProps = {
    className: 'pb_bar_graph',
    type: 'column',
  }

  componentDidMount() {
    const {
      axisTitle,
      xAxisCategories,
      yAxisMin,
      yAxisMax,
      className,
      chartData,
      id,
      pointStart,
      subTitle,
      title,
      type,
      legend,
      height,
    } = this.props

    new pbChart(`.${className}`, {
      axisTitle: axisTitle,
      chartData: chartData,
      id: id,
      pointStart: pointStart,
      subtitle: subTitle,
      type,
      title: title,
      xAxisCategories: xAxisCategories,
      yAxisMin: yAxisMin,
      yAxisMax: yAxisMax,
      legend: legend,
      height: height,
    })
  }

  props: BarGraphProps

  render() {
    const { className, id } = this.props

    return (
      <div
          className={classnames(className, spacing(this.props))}
          id={id}
      />
    )
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
playbook_ui-4.18.1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-4.18.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-4.17.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx