livewire-charts icon indicating copy to clipboard operation
livewire-charts copied to clipboard

Issue on rendering charts with float values

Open invaders-xx opened this issue 3 years ago • 7 comments

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.

invaders-xx avatar May 14 '21 14:05 invaders-xx

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

@asantibanez any thought about this?

davidhsianturi avatar Jun 02 '21 03:06 davidhsianturi

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

WanaPhyoHtun avatar Aug 26 '21 06:08 WanaPhyoHtun

You can round them...

$areaChartModel->addPoint($date, round($data->total));

ZayRTun avatar Nov 07 '22 08:11 ZayRTun

@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 avatar Nov 21 '23 11:11 tahirafridi

@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!

tahirafridi avatar Nov 21 '23 11:11 tahirafridi

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 avatar Nov 21 '23 11:11 ZayRTun

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.

tahirafridi avatar Nov 21 '23 12:11 tahirafridi