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;
|