Fix defaults handling
This commit is contained in:
parent
a4723d19d1
commit
fb61033421
3 changed files with 13 additions and 9 deletions
|
|
@ -6,9 +6,7 @@ const Component = withComponent();
|
|||
class Heatmap extends Component {
|
||||
static props = {
|
||||
timeseries: props.string,
|
||||
days: props.number({
|
||||
default: 7,
|
||||
}),
|
||||
days: props.number,
|
||||
interpolate: props.boolean,
|
||||
accumulate: props.boolean,
|
||||
};
|
||||
|
|
@ -22,6 +20,10 @@ class Heatmap extends Component {
|
|||
}
|
||||
|
||||
render({ timeseries, interpolate, accumulate, days }) {
|
||||
let daySlots = days;
|
||||
if (!daySlots) {
|
||||
daySlots = 7;
|
||||
}
|
||||
const el = document.createElement('div');
|
||||
if (!this.enableFetch) {
|
||||
// Not yet connected
|
||||
|
|
@ -31,7 +33,7 @@ class Heatmap extends Component {
|
|||
// We're re-rendering, cancel previous
|
||||
this.ts.canceled = true;
|
||||
}
|
||||
const ts = new Timeseries(timeseries, new Date(), days);
|
||||
const ts = new Timeseries(timeseries, new Date(), daySlots);
|
||||
const data = [{
|
||||
x: ts.getSlotLabels(),
|
||||
y: ts.getDayLabels(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue