R U kidding me. This is amazing. You should have 70K subscribers not 70 ... Just wrote a medium article explaining how we are using this in our sleep tacking app. Linking back to your video to help promote the channel.
Congratulations, this is awesome! I watched the other video with Circular Progress Indicator, and it is awesome as well! Thank you for sharing this! Have you tried to combined those two, drag gestures with Pie Chart, where you can drag every piece of Pie Chart in order to change the percentage of each part manually?
Hi, How can I know what is height of this composable in db? If I remove fillMaxSize() property from Canvas and place PieChart between two composables it will overlap eachother. Do you have any tips for that?
You should always pass a modifier to the canvas which defines the height. You can also pass a relative height or if you want a fixed one. The exact dp can then be accessed inside the Canvas with the size property. If you need this height outside of your Canvas you can pass a lambda function and pass the height in there and collect the value from the outside
@@kapps7407 I need exact dp outside of canvas composable. I know i can access size value, but that gives value in float value, not in dp if I am correct?
First of all my congratulations and thanks, you are really good at what you do. I was trying to feed this graph with the Room database but I get an error on the line "if (inputList.first().isTapped)" I'm racking my brain to solve it rsrs
Hello Daniel, thank you! What error do you get? Maybe the input list is empty so there is no first element and you are trying to access it. If Room takes some amount of time and your list is empty at the beginning when you invoke the composable the first time this could happen. But to give you an exact hint I need more information.
@@kapps7407 that's exactly it, the first time compose draws the screen, the list is empty and the "isTapped" property is false, where the error happens. I used "firstOrNull" or instead of just "first", but even so, the layout doesn't recompose and doesn't fetch the data in the database, and it doesn't feed the graph. I'm trying to see what I can do, but still nothing =/
You should make your input list state which then triggers the recomposition (For example in a view model). Then when the Room result is there you can map the result to the InputList and update your list. This should trigger the recomposition. For the first case when the list is empty by default you could for example make an if statement inside the chart composable and show the chart when list.size>0 and otherwise show a placeholder text with "Currently no data available" or something like this.
@@kapps7407 Yes, I'm using the viewModel, and I even check it. I have a state class that contains " val isEmpty: Boolean", when collecting the list I check if it is empty and depending on the condition, true or false, I assign it to this property. I can't understand why compose doesn't recompose itself. I made an if in the "inputList" if it is greater than 0 or not, and I put a text if it is less, saying that there is no data, however, it stays there, it doesn't recompose itself, I'm almost there, I just need to know why it it is not recovering.
How does your state list (The list For the Piechart) look and how do you update it when there is a Room result? I am pretty sure there is just a little problem with updating the state properly.
R U kidding me. This is amazing. You should have 70K subscribers not 70 ...
Just wrote a medium article explaining how we are using this in our sleep tacking app. Linking back to your video to help promote the channel.
Congratulations, this is awesome! I watched the other video with Circular Progress Indicator, and it is awesome as well! Thank you for sharing this!
Have you tried to combined those two, drag gestures with Pie Chart, where you can drag every piece of Pie Chart in order to change the percentage of each part manually?
keep doing man...that's really good
Thank you for this video. This video is so good and great. This video really helps me to create Pie Chart in compose. I recommend you to watch it
Woaah you really did it, Thanks that was amazing.
This is great, l have to create something similar to this.
Thanks a lot bro.
How to add the selected part to the outside with the same width and colour should be transparent to selected part?
Hi, How can I know what is height of this composable in db? If I remove fillMaxSize() property from Canvas and place PieChart between two composables it will overlap eachother. Do you have any tips for that?
You should always pass a modifier to the canvas which defines the height. You can also pass a relative height or if you want a fixed one. The exact dp can then be accessed inside the Canvas with the size property. If you need this height outside of your Canvas you can pass a lambda function and pass the height in there and collect the value from the outside
@@kapps7407 I need exact dp outside of canvas composable. I know i can access size value, but that gives value in float value, not in dp if I am correct?
You can convert this float value which are actually pixels to dp then :)
may I know your device your currently using?
I mean what specs your device have
This emulator is a Google Pixel 4XL if I remember correctly
@@kapps7407 I mean your laptop or pc that you use for development :)
Oh okay - It is a 27 inch iMac 2020 with an i7 processor and 64gb RAM
Thank you
Source code please
First of all my congratulations and thanks, you are really good at what you do.
I was trying to feed this graph with the Room database but I get an error on the line "if (inputList.first().isTapped)"
I'm racking my brain to solve it rsrs
Hello Daniel, thank you! What error do you get? Maybe the input list is empty so there is no first element and you are trying to access it. If Room takes some amount of time and your list is empty at the beginning when you invoke the composable the first time this could happen. But to give you an exact hint I need more information.
@@kapps7407 that's exactly it, the first time compose draws the screen, the list is empty and the "isTapped" property is false, where the error happens.
I used "firstOrNull" or instead of just "first", but even so, the layout doesn't recompose and doesn't fetch the data in the database, and it doesn't feed the graph.
I'm trying to see what I can do, but still nothing =/
You should make your input list state which then triggers the recomposition (For example in a view model). Then when the Room result is there you can map the result to the InputList and update your list. This should trigger the recomposition. For the first case when the list is empty by default you could for example make an if statement inside the chart composable and show the chart when list.size>0 and otherwise show a placeholder text with "Currently no data available" or something like this.
@@kapps7407 Yes, I'm using the viewModel, and I even check it. I have a state class that contains " val isEmpty: Boolean", when collecting the list I check if it is empty and depending on the condition, true or false, I assign it to this property. I can't understand why compose doesn't recompose itself. I made an if in the "inputList" if it is greater than 0 or not, and I put a text if it is less, saying that there is no data, however, it stays there, it doesn't recompose itself, I'm almost there, I just need to know why it it is not recovering.
How does your state list (The list For the Piechart) look and how do you update it when there is a Room result? I am pretty sure there is just a little problem with updating the state properly.