How to change the margin of a component in code

How to change the margin of a component in code? Can we?
I want to set the background colour of a button depending on the height the user entered. But the height should show from a beginning line.
Let’s say I have a starting line and depending on the height the user entered I have to decrease the height from a starting line.

Hi @charvi2k9gsbk2i, welcome to the Thunkable Community :wave:

I’m not fully sure what you’re trying to do - but I think you’re wanting to change the border or margin of a component, when the app is running, via blocks, is that right?

It depends on the components you’re using, but in most cases (for now at least) there’s no way to change the border dimensions in blocks.

What sort of app are you trying to build?

1 Like

So basically in one of my screens i want to add a bar graph feature without using any kind of 3rd party app. The and bar graph value should change depending on user indirect value. I hope ur understanding what im trying to say. So, is there any component we can use to change the margin of a component in the code?

1 Like

Yes, this can easily be done using the way you described because you are changing the size, height and width not margin

1 Like

yes sir, but after I change the height it is decreasing its size at a position that I have other components. as I said I’m making a bar graph and I want it to colour the value depending on a formula im performing and decrease its increase size accordingly but start from the beginning value that’s at 0%. Hope you understood ?

1 Like

I made a quick mock up to show what I mean. You may use it as a start and enhance on it

https://x.thunkable.com/projectPage/608d4c470e17710011171894

thank you sir will this work by the formula like eg
x/total x 100…
Whatever percentage i get referring to that the bar graph should change?

1 Like

why is the list viewer component used? For user to check from 1 to 5?

1 Like

so it shouldnt depend on what user entered it should depend on formula

1 Like

You need to check it. I did it quickly as proof of concept and did not code every possible scenario in it

will it work sir?

the way i want

I just chose the list viewer to restrict the user on the selection of bars in the chart. You can choose the way you like and this is not an essential part of the solution. The solution is to draw a Bar Char using only Thunkable.

so sir i need to use a column instead of a button. Ok let me try it like that

1 Like

I thought a row/column is more appropriate for the situation but you can choose other components should you wish to.

ok sir

1 Like

1 Like

will this work?

1 Like

I don’t know. You need to test and see the outcome.

its not working.