From 7d5eeb7947bb1891e58b99ec0fbb25cedf0e1647 Mon Sep 17 00:00:00 2001 From: miki131 Date: Thu, 23 Jul 2020 15:40:14 +0300 Subject: [PATCH] passing width and height to apexchart (#4) --- resources/js/components/NovaApexChart.vue | 10 ++-------- src/NovaApexChart.php | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/resources/js/components/NovaApexChart.vue b/resources/js/components/NovaApexChart.vue index 5fbb6b0..9f60089 100644 --- a/resources/js/components/NovaApexChart.vue +++ b/resources/js/components/NovaApexChart.vue @@ -1,6 +1,6 @@ @@ -50,10 +50,4 @@ } } } - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/NovaApexChart.php b/src/NovaApexChart.php index af2b46a..224b242 100644 --- a/src/NovaApexChart.php +++ b/src/NovaApexChart.php @@ -15,11 +15,13 @@ class NovaApexChart extends Card public function __construct($component = null) { - parent::__construct($component); + $this->withMeta([ 'options' => (object) [], - 'type' => 'bar' + 'type' => 'bar', + 'chartWidth' => '100%', + 'chartHeight' => 'auto', ]); } @@ -44,6 +46,16 @@ public function type(string $type): self return $this->withMeta([ 'type' => $type ]); } + public function chartWidth(string $width): self + { + return $this->withMeta([ 'chartWidth' => $width ]); + } + + public function chartHeight(string $type): self + { + return $this->withMeta([ 'chartHeight' => $type ]); + } + public function options(array $options): self { return $this->withMeta([ 'options' => (object) $options ]);