Sha256: b3397bb2ab735cc574b3e43a3732aeeaab08891952184a53d5a44fa6e2deec74

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 KB

Contents

/* @flow */

import React from 'react'
import classnames from 'classnames'
import { spacing } from '../utilities/spacing.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,
  height?: String,
}

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

  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: LineGraphProps

  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_line_graph/_line_graph.jsx
playbook_ui-4.18.0 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx
playbook_ui-4.17.0 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx