asantibanez / livewire-charts

Neat Livewire Charts for your Laravel projects
MIT License
788 stars 116 forks source link

Allow setting type on Pie Chart Model #53

Closed nicko170 closed 2 years ago

nicko170 commented 2 years ago

Summary

Adds a ->setType() method to Pie Chart, which allows for donut charts and defaults to pie charts!

$accountTermChart = LivewireCharts::pieChartModel()
    ->setAnimated($this->firstRun)
    ->withoutDataLabels()
    ->withoutGrid()
    ->addSlice('Term Elapsed', Auth::user()->currentAccount->currentAccountTerm->termAsPercentageFromToday(), '#006eb6', ['opacity' => 0.7])
    ->addSlice('Term Remaining', 100 - Auth::user()->currentAccount->currentAccountTerm->termAsPercentageFromToday(), '#66a8d3')
    ->setOpacity(1)
    ->setType('donut')
    ->withoutLegend()
    ->setSparklineEnabled(true);

Issue

[If exists, provide a link to the corresponding issue(s).]

Type of Change

Screenshot/Video

Screen Shot 2021-08-27 at 4 24 42 pm

asantibanez commented 2 years ago

Great addition @nicko170 ! Thanks!