asantibanez / livewire-charts

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

Issue on rendering charts with float values #43

Open invaders-xx opened 3 years ago

invaders-xx commented 3 years ago

Dear,

I use this php array of values: "2021-04-01" => 0 "2021-04-02" => 12.62 "2021-04-03" => 12.39 "2021-04-04" => 12.36 "2021-04-05" => 6.24 "2021-04-06" => 12.43 "2021-04-07" => 12.37 "2021-04-08" => 12.6 "2021-04-09" => 0 "2021-04-10" => 12.54 "2021-04-11" => 649.84 "2021-04-12" => 0 "2021-04-14" => 31.44 "2021-04-15" => 0 "2021-04-16" => 6.25 "2021-04-13" => 0 "2021-04-17" => 0 "2021-04-18" => 12.27 "2021-04-19" => 0 "2021-04-20" => 12.32 "2021-04-21" => 12.33 "2021-04-22" => 12.52 "2021-04-23" => 12.48 "2021-04-24" => 12.58 "2021-04-25" => 25.2 "2021-04-26" => 24.77 "2021-04-27" => 18.52 "2021-04-28" => 6.25 "2021-04-29" => 24.79 "2021-04-30" => 25.22 "2021-05-01" => 24.85

And the graph result looks like this: it's a multi-line graph and I use addSeriesPoint function to add points.

image

Do you have any ideas why the values are shown like this ?

Many thanks in advance for your help and feedback.

davidhsianturi commented 3 years ago

@invaders-xx I am having the same issue, did you find a workaround for this?

@asantibanez any thought about this?

WanaPhyoHtun commented 2 years ago

@invaders-xx, @davidhsianturi I also having this issue with decimal places, @asantibanez any solution?

ZayRTun commented 1 year ago

You can round them...

$areaChartModel->addPoint($date, round($data->total));
tahirafridi commented 7 months ago

@ZayRTun @asantibanez is there any way to group the x-axis dates? Like I want to show it as a group of months and if there are many years then group by years, let say we have 100's of data daily, the each day date is showing very ugly in the bottom. Thank you!

Like this one, see the All time option is selected and it showing data from many months but in a nice way. Thank you! image

tahirafridi commented 7 months ago

@ZayRTun @asantibanez is there any way to group the x-axis dates? Like I want to show it as a group of months and if there are many years then group by years, let say we have 100's of data daily, the each day date is showing very ugly in the bottom. Thank you!

Like this one, see the All time option is selected and it showing data from many months but in a nice way. Thank you! image

Note, the are using other charts, but I need to know if this can be achievable here? Thank you!

ZayRTun commented 7 months ago

If you want to group then by month or year, I think that should be done at the query level, and the user can choose to view by month or year.

tahirafridi commented 7 months ago

If you want to group then by month or year, I think that should be done at the query level, and the user can choose to view by month or year.

@ZayRTun thanks for your response, yeah that is totally understandable. If we group by month/year than it will only show the sum of the position, or avg position of that month/year but the screenshot I shared is showing the labels as group in the footer but if you hover the arrow on the line, it shows you the data for each day/date.