Sha256: 65f1ba669f91ccea2ccba373f38bcf7dee175282422439ffa000fab2f9dc08ca

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

/* @flow */

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

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

export default class LineGraph extends React.Component<LineGraphProps> {
  static defaultProps = {
    className: 'pb_bar_graph',
    gradient: false,
    type: 'line',
    legend: false,
    toggleLegendClick: true,
  }

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

  props: LineGraphProps

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
playbook_ui-6.1.0.pre.alpha5 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
playbook_ui-6.1.0.pre.alpha4 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
playbook_ui-6.1.0.pre.alpha3 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
playbook_ui-6.1.0.pre.alpha2 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
playbook_ui-6.1.0.pre.alpha1 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
playbook_ui-6.1.0 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
playbook_ui-6.0.1.pre.alpha6 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx