Sha256: b6fe64d5ef131a2150d68f0cd1045ee4605e8fb3d4b37a26e5bb29b26937bddf

Contents?: true

Size: 1.56 KB

Versions: 41

Compression:

Stored size: 1.56 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,
  toggleLegendClick?: Boolean,
  height?: String,
}

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

  componentDidMount() {
    const {
      axisTitle,
      xAxisCategories,
      yAxisMin,
      yAxisMax,
      className,
      chartData,
      id,
      pointStart,
      subTitle,
      title,
      type,
      legend,
      height,
      toggleLegendClick,
    } = 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,
      toggleLegendClick: toggleLegendClick,
      height: height,
    })
  }

  props: BarGraphProps

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

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

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
playbook_ui-6.0.1.pre.alpha5 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-6.0.1.pre.alpha4 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-6.0.1.pre.alpha3 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-6.0.1.pre.alpha2 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.2.0.pre.alpha15 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.2.0.pre.alpha14 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.2.0.pre.alpha13 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-6.0.1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.2.0.pre.alpha12 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-6.0.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.2.0.pre.alpha11 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.5.1.pre.alpha4 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.5.1.pre.alpha3 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.5.1.pre.alpha2 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.5.1.pre.alpha1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.2.0.pre.alpha10 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.5.1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.5.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.5.0.pre.alpha1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-5.2.0.pre.alpha9 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx