/**
 * Created by baoyinghai on 6/22/17.
 */
import React from 'react';
import {Doughnut} from 'react-chartjs-2';

const data = {
  labels: [
    'Red',
    'Green',
    'Yellow'
  ],
  datasets: [{
    data: [300, 50, 100],
    backgroundColor: [
      '#FF6384',
      '#36A2EB',
      '#FFCE56'
    ],
    hoverBackgroundColor: [
      '#FF6384',
      '#36A2EB',
      '#FFCE56'
    ]
  }]
};

export default class MXDoughnut extends React.Component {


  render() {
    const { width, height } = this.props;
    return (
      <div>
        <Doughnut data={data} width={width} height={height - 15} />
      </div>
    );
  }
}


export const DoughnutSetting = {
  getKeys: keys => keys,
  setFormItems: (key, setting) => {
    return {
      key,
      label: key,
      comp: <Input />,
      initData: (setting && setting[key]) || key
    };
  }
};