Skip to content

Commit

Permalink
fix height + add disable date
Browse files Browse the repository at this point in the history
  • Loading branch information
LonnyX committed Jul 18, 2022
1 parent 306a048 commit 328114f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/js/nova-apex-chart.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion resources/js/components/BaseNovaApexChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<HelpTextTooltip v-if="helpText" :text="helpText" :width="helpWidth" />

<div class="ml-auto w-[16rem] flex-shrink-0">
<div v-if="!disableDate" class="ml-auto w-[16rem] flex-shrink-0">
<litepie-datepicker :placeholder="datePlaceHolder || '-'" :formatter="dateFormatter" separator=" - " v-model="dateValue">
</litepie-datepicker>
</div>
Expand Down Expand Up @@ -66,6 +66,7 @@ export default {
helpText: {},
helpWidth: {},
maxWidth: {},
disableDate: false,
},
methods: {
Expand Down Expand Up @@ -100,6 +101,7 @@ export default {
if (!this.options) {
return;
}
console.log(this.chartHeight + '/' + this.chartWidth + '/' + this.series);
const options = this.options
this.handleFormatter(options)
return options
Expand Down
10 changes: 7 additions & 3 deletions resources/js/components/NovaApexChart.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<template>
<BaseNovaApexChart
@selected="handleSelected"
:width="chartWidth"
:height="chartHeight"
:chartWidth="chartWidth"
:chartHeight="chartHeight"
:height="height"
:width="width"
:chartType="chartType"
:series="series"
:options="options"
:title="name"
:help-text="helpText"
:help-width="helpWidth"
:datePlaceHolder="datePlaceHolder"
:disableDate="disableDate"
:loading="loading" />
</template>

Expand Down Expand Up @@ -64,7 +67,6 @@ export default {
methods: {
handleSelected(dateValue) {
this.selectedDateValue = {...dateValue};
console.log('handleSelected', this.selectedDateValue);
this.fetch();
},
fetch() {
Expand All @@ -81,6 +83,7 @@ export default {
width,
height,
datePlaceHolder,
disableDate,
},
},
}) => {
Expand All @@ -92,6 +95,7 @@ export default {
this.width = width;
this.height = height;
this.datePlaceHolder = datePlaceHolder;
this.disableDate = disableDate || false;
this.loading = false;
}
)
Expand Down
5 changes: 5 additions & 0 deletions src/ApexMetric.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public function chartHeight(string $type): self
return $this->withMeta([ 'chartHeight' => $type ]);
}

public function disableDate(bool $disabled = true): self
{
return $this->withMeta([ 'disableDate' => $disabled ]);
}

public function options(array $options): self
{
return $this->withMeta([ 'options' => (object) $options ]);
Expand Down

0 comments on commit 328114f

Please sign in to comment.