Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultipleColumn somehow grouping results wrongly #88

Open
djowebdev opened this issue Mar 3, 2023 · 3 comments
Open

MultipleColumn somehow grouping results wrongly #88

djowebdev opened this issue Mar 3, 2023 · 3 comments

Comments

@djowebdev
Copy link

Describe the bug
When I create a multiple column graph, it seems to group non-existing values and display them wrongly into the previous column. Basically it does not consider empty or non-existing entries for the group.

Picture:

image

Data:

...
->addSeriesColumn('Peter', '2022-02-27', 20)
->addSeriesColumn('Peter', '2022-02-28', 40)
->addSeriesColumn('Harry', '2022-02-26', 15)
->addSeriesColumn('Harry', '2022-03-02', 35)
->addSeriesColumn('Sarah', '2022-02-02', 15)
->addSeriesColumn('Sarah', '2022-03-02', 35)
...

To Reproduce
Steps to reproduce the behavior:

Component:
public function render() { $multiColumnChartModel = (new ColumnChartModel()) ->setTitle('Expenses by Name') ->multiColumn() ->addSeriesColumn('Peter', '2022-02-27', 20) ->addSeriesColumn('Peter', '2022-02-28', 40) ->addSeriesColumn('Harry', '2022-02-26', 15) ->addSeriesColumn('Harry', '2022-03-02', 35) ->addSeriesColumn('Sarah', '2022-02-02', 15) ->addSeriesColumn('Sarah', '2022-03-02', 35) ; return view('livewire.statistics-component') ->with([ 'multiColumnChartModel' => $multiColumnChartModel, ]); }

View:
<livewire:livewire-column-chart key="{{ $multiColumnChartModel->reactiveKey() }}" :column-chart-model="$multiColumnChartModel" />

Expected behavior
I would expect all the dates to be on the X-axis, even if there is no entry for the person.

Here is a mockup of what I would expect:

image

@rhnkyr
Copy link

rhnkyr commented Apr 5, 2023

Hi @djowebdev. Do you have any solution for this one?

@djowebdev
Copy link
Author

Hi @djowebdev. Do you have any solution for this one?

Unfortunately no a perfect one. The workaround is to create 0-entries for the other dates, actually this is what I did for the mockup (just add "0-entries" via addSeriesColumn('Name', '2022-xx-xx', 0)). So the data preparation is not done by livewire-charts it seems.

It is tedious but potentially a nice-to-have thing and not a bug?! Not sure what the developers think

@vekkon
Copy link

vekkon commented Mar 15, 2024

What about just changing up the name values with the date values? Works for me..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants