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(),
|
||||
|
|
|
@ -6,9 +6,7 @@ const Component = withComponent();
|
|||
class Polar extends Component {
|
||||
static props = {
|
||||
timeseries: props.string,
|
||||
days: props.number({
|
||||
default: 7,
|
||||
}),
|
||||
days: props.number,
|
||||
interpolate: props.boolean,
|
||||
accumulate: props.boolean,
|
||||
percentage: props.boolean,
|
||||
|
@ -25,6 +23,10 @@ class Polar extends Component {
|
|||
}
|
||||
|
||||
render({ timeseries, interpolate, accumulate, percentage, days }) {
|
||||
let daySlots = days;
|
||||
if (!daySlots) {
|
||||
daySlots = 7;
|
||||
}
|
||||
const el = document.createElement('div');
|
||||
if (!this.enableFetch) {
|
||||
// Not yet connected
|
||||
|
@ -34,7 +36,7 @@ class Polar 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 layout = {
|
||||
orientation: 270,
|
||||
direction: 'clockwise',
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<body>
|
||||
<main>
|
||||
<cbase-heatmap timeseries="crew.online" interpolate></cbase-heatmap>
|
||||
<cbase-polar timeseries="bar.open" days=90 percentage></cbase-polar>
|
||||
<cbase-polar timeseries="bar.open" days="90" percentage></cbase-polar>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue