Sha256: a66c249fb2f9e24425e80609fa3409c405dc134227f8fc37d512f7f59a6cfa44

Contents?: true

Size: 1.7 KB

Versions: 72

Compression:

Stored size: 1.7 KB

Contents

/* @flow */

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

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

type BarGraphProps = {
  axisTitle: string,
  dark?: Boolean,
  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',
    dark: false,
    type: 'column',
    legend: false,
    toggleLegendClick: true,
  }

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

    new pbChart(`.${className}`, {
      axisTitle: axisTitle,
      dark,
      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

72 entries across 72 versions & 1 rubygems

Version Path
playbook_ui-11.11.0.pre.alpha.paginate2 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.11.0.pre.alpha.dialog2 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.11.0.pre.alpha.paginate1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.11.0.pre.alpha.renderer1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.11.0.pre.alpha.dialog1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.11.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.10.0.pre.alpha.pre.bold1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.10.0.pre.alpha.pagination1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.10.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.9.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.9.0.pre.alpha.fileupload1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.8.1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.8.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.7.0.pre.alpha.table1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.7.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.6.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.5.0.pre.alpha.fontawesome app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.7.0.pre.alpha.pre.guagechart1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.6.0 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx
playbook_ui-11.5.0.pre.alpha.datepicker1 app/pb_kits/playbook/pb_bar_graph/_bar_graph.jsx