import React, { PropTypes } from 'react';
import * as V from 'victory';
import theme from '../../../components/VictoryTheme';
import moment from 'moment';
import { schemeCategory20c } from 'd3-scale';
import Legend from './Legend';
const propTypes = {
data: PropTypes.array.isRequired,
label1: PropTypes.string.isRequired,
};
export default class TimeSeriesLineChart extends React.Component {
constructor(props) {
super(props);
this.keysToColorsMap = this.mapKeysToColors(props.data);
}
mapKeysToColors(data) {
// todo: what if there are more lines than colors in schemeCategory20c?
const keysToColorsMap = {};
data.forEach((d, i) => {
keysToColorsMap[d.key] = schemeCategory20c[i];
});
return keysToColorsMap;
}
renderLines() {
return this.props.data.map((d) => (