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 {
|
class Heatmap extends Component {
|
||||||
static props = {
|
static props = {
|
||||||
timeseries: props.string,
|
timeseries: props.string,
|
||||||
days: props.number({
|
days: props.number,
|
||||||
default: 7,
|
|
||||||
}),
|
|
||||||
interpolate: props.boolean,
|
interpolate: props.boolean,
|
||||||
accumulate: props.boolean,
|
accumulate: props.boolean,
|
||||||
};
|
};
|
||||||
|
@ -22,6 +20,10 @@ class Heatmap extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render({ timeseries, interpolate, accumulate, days }) {
|
render({ timeseries, interpolate, accumulate, days }) {
|
||||||
|
let daySlots = days;
|
||||||
|
if (!daySlots) {
|
||||||
|
daySlots = 7;
|
||||||
|
}
|
||||||
const el = document.createElement('div');
|
const el = document.createElement('div');
|
||||||
if (!this.enableFetch) {
|
if (!this.enableFetch) {
|
||||||
// Not yet connected
|
// Not yet connected
|
||||||
|
@ -31,7 +33,7 @@ class Heatmap extends Component {
|
||||||
// We're re-rendering, cancel previous
|
// We're re-rendering, cancel previous
|
||||||
this.ts.canceled = true;
|
this.ts.canceled = true;
|
||||||
}
|
}
|
||||||
const ts = new Timeseries(timeseries, new Date(), days);
|
const ts = new Timeseries(timeseries, new Date(), daySlots);
|
||||||
const data = [{
|
const data = [{
|
||||||
x: ts.getSlotLabels(),
|
x: ts.getSlotLabels(),
|
||||||
y: ts.getDayLabels(),
|
y: ts.getDayLabels(),
|
||||||
|
|
|
@ -6,9 +6,7 @@ const Component = withComponent();
|
||||||
class Polar extends Component {
|
class Polar extends Component {
|
||||||
static props = {
|
static props = {
|
||||||
timeseries: props.string,
|
timeseries: props.string,
|
||||||
days: props.number({
|
days: props.number,
|
||||||
default: 7,
|
|
||||||
}),
|
|
||||||
interpolate: props.boolean,
|
interpolate: props.boolean,
|
||||||
accumulate: props.boolean,
|
accumulate: props.boolean,
|
||||||
percentage: props.boolean,
|
percentage: props.boolean,
|
||||||
|
@ -25,6 +23,10 @@ class Polar extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render({ timeseries, interpolate, accumulate, percentage, days }) {
|
render({ timeseries, interpolate, accumulate, percentage, days }) {
|
||||||
|
let daySlots = days;
|
||||||
|
if (!daySlots) {
|
||||||
|
daySlots = 7;
|
||||||
|
}
|
||||||
const el = document.createElement('div');
|
const el = document.createElement('div');
|
||||||
if (!this.enableFetch) {
|
if (!this.enableFetch) {
|
||||||
// Not yet connected
|
// Not yet connected
|
||||||
|
@ -34,7 +36,7 @@ class Polar extends Component {
|
||||||
// We're re-rendering, cancel previous
|
// We're re-rendering, cancel previous
|
||||||
this.ts.canceled = true;
|
this.ts.canceled = true;
|
||||||
}
|
}
|
||||||
const ts = new Timeseries(timeseries, new Date(), days);
|
const ts = new Timeseries(timeseries, new Date(), daySlots);
|
||||||
const layout = {
|
const layout = {
|
||||||
orientation: 270,
|
orientation: 270,
|
||||||
direction: 'clockwise',
|
direction: 'clockwise',
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
<cbase-heatmap timeseries="crew.online" interpolate></cbase-heatmap>
|
<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>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue