Sha256: 5f5222784dc6e0d4fbd53d729f7219c1499a71f67c5e36d356940ec6732f6fd3

Contents?: true

Size: 1.64 KB

Versions: 13

Compression:

Stored size: 1.64 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'

import { globalProps } from '../utilities/globalProps.js'
import pbChart from '../plugins/pb_chart'

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,
  colors: array,
}

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,
      colors  = [],
    } = this.props

    new pbChart(`.${className}`, {
      axisTitle: axisTitle,
      chartData: chartData,
      colors: colors,
      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(globalProps(this.props), className)}
          id={id}
      />
    )
  }
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
playbook_ui-10.23.0.pre.cachetest app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.21.0.pre.alpha.rg1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.21.0.pre.alpha.jg1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.21.0.pre.alpha.na1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.21.0.pre.alpha.jd1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.20.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.19.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.19.0.pre.lightbox app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.18.2 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.19.0.pre.popover.alpha1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.18.1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.18.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-10.17.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx