Skip to content

Commit

Permalink
passing width and height to apexchart (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
miki131 authored Jul 23, 2020
1 parent c0193c7 commit 7d5eeb7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
10 changes: 2 additions & 8 deletions resources/js/components/NovaApexChart.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<card class="px-6 py-4">
<apexchart :type="card.type" :options="options" :series="card.series"></apexchart>
<apexchart :width="card.chartWidth" :height="card.chartHeight" :type="card.type" :options="options" :series="card.series"></apexchart>
</card>
</template>

Expand Down Expand Up @@ -50,10 +50,4 @@
}
}
}
</script>

<style lang="scss" scoped>
.p-10 {
padding: 2.5rem;
}
</style>
</script>
16 changes: 14 additions & 2 deletions src/NovaApexChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);

}
Expand All @@ -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 ]);
Expand Down

0 comments on commit 7d5eeb7

Please sign in to comment.