Browse Source

fix TimelineChart: deal with non-array data (#3385)

pull/3392/head
何乐 7 years ago
committed by 陈帅
parent
commit
186abaca0b
  1. 10
      src/components/Charts/TimelineChart/index.js

10
src/components/Charts/TimelineChart/index.js

@ -17,15 +17,11 @@ class TimelineChart extends React.Component {
y2: 'y2', y2: 'y2',
}, },
borderWidth = 2, borderWidth = 2,
data = [ data: sourceData,
{
x: 0,
y1: 0,
y2: 0,
},
],
} = this.props; } = this.props;
const data = Array.isArray(sourceData) ? sourceData : [{ x: 0, y1: 0, y2: 0 }];
data.sort((a, b) => a.x - b.x); data.sort((a, b) => a.x - b.x);
let max; let max;

Loading…
Cancel
Save