All files / answers-chart/components/Chart index.jsx

16.67% Statements 1/6
100% Branches 0/0
0% Functions 0/2
16.67% Lines 1/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18            1x                      
import React from 'react';
import PropTypes from 'prop-types';
import ReactHighcharts from 'react-highcharts';
import chartOptions from './chartOptions';
import Answers from '../../Answers/index';
 
const Chart = ({ answers, metricType }) => {
  const formatter = function () {
    const answer = Answers.forType(this.chart.series[0].userOptions.metricType);
    return answer.getChartLabel(this.value);
  };
  const options = chartOptions(answers[metricType].metrics, metricType, formatter);
 
  return <ReactHighcharts config={options} />;
};
 
export default Chart;