Sha256: f7227ba7247c3a3ea15782bf6f7966c0700a2f82dae10cc48541f1e0bf705e82

Contents?: true

Size: 1.5 KB

Versions: 69

Compression:

Stored size: 1.5 KB

Contents

/* @flow */

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

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

type TreemapChartProps = {
  chartData: array<{
    name: string,
    parent?: string | number,
    value: number,
    color?: string,
    id?: string | number,
  }>,
  className?: string,
  colors: array,
  dark?: boolean,
  drillable: boolean,
  grouped: boolean,
  height?: string,
  id: number,
  title: string,
  tooltipHtml: string,
  type?: string,
}

export default class TreemapChart extends React.Component<TreemapChartProps> {
  static defaultProps = {
    className: 'pb_treemap_chart',
    dark: false,
    drillable: false,
    grouped: false,
    type: 'treemap',
  }

  componentDidMount() {
    const {
      chartData,
      className,
      colors  = [],
      dark,
      drillable,
      grouped,
      height,
      id,
      title = "",
      tooltipHtml = '<span style="font-weight: bold; color:{point.color};">&#9679; </span>{point.name}: <b>{point.value}</b>',
      type,
    } = this.props

    new pbChart(`.${className}`, {
      chartData: chartData,
      colors: colors,
      dark,
      drillable,
      grouped,
      height: height,
      id: id,
      title: title,
      tooltipHtml,
      type,
    })
  }

  props: TreemapChartProps

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

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

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
playbook_ui-11.3.0.pre.alpha2 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.3.0.pre.alpha1 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.3.0 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.7 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.6 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.5 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.4 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.4.pre.alpha1 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.3 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.2 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.1 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.2.0 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.1.2 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.1.2.pre.alpha1 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.1.1 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.1.1.pre.alpha1 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.1.0 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.0.1 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.0.0 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx
playbook_ui-11.0.0.pre.alpha.2 app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.jsx