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

multiline chart mode am i using it correctly? #123

Open
ndarproj opened this issue Mar 4, 2024 · 1 comment
Open

multiline chart mode am i using it correctly? #123

ndarproj opened this issue Mar 4, 2024 · 1 comment

Comments

@ndarproj
Copy link

ndarproj commented Mar 4, 2024

$multiLineChartModel = $aggregatedData->reduce(
                function ($chartModel, $data) {
                    // Assuming $data->date_interval is your column category (x-axis)
                    $chartModel->addSeriesPoint('Notified Users', $data->date_interval, $data->total_sent);
                    $chartModel->addSeriesPoint('Opted-Out Users', $data->date_interval, $data->total_not_sent);
                    $chartModel->addSeriesPoint('Clicks', $data->date_interval, $data->total_open_count);

                    return $chartModel;
                },
                LivewireCharts::multiLineChartModel()
                    ->setTitle('Notification Stats')
                    ->setAnimated(true)
                    ->setDataLabelsEnabled(true)
                    ->withOnPointClickEvent('onPointClick')
                    ->setSmoothCurve()
                    ->multiLine()
                    ->setColors(['#15803d', '#b91c1c', '#1d4ed8']) // Set your colors accordingly
            );

image

i don't understand as to why the line is off. jan'24 blue line should have been in 5 but instead it is in 20, same as the red line..

@sinarahmany
Copy link

It looks like your issue might be related to the data points not aligning correctly with your x-axis labels. Ensure that the $data->date_interval values are consistent and correctly formatted. Additionally, verify that the addSeriesPoint method is receiving the expected data.

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

2 participants