Sha256: bad1804d9d02aed2ec2d9c248cc18e1f55cb789a2d61964b94779572bc215849

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 KB

Contents

/* @flow */

import React from 'react'

import { pbChart } from '../'

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

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

  componentDidMount() {
    const {
      axisTitle,
      className,
      chartData,
      id,
      pointStart,
      subTitle,
      title,
      type,
    } = this.props

    new pbChart(`.${className}`, {
      axisTitle: axisTitle,
      chartData: chartData,
      id: id,
      pointStart: pointStart,
      subtitle: subTitle,
      type,
      title: title,
    })
  }

  props: LineGraphProps

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

    return (
      <div
          className={className}
          id={id}
      />
    )
  }
}

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
playbook_ui-3.2.0 app/pb_kits/playbook/pb_line_graph/_line_graph.jsx