The margin is the collateral (or money) that an investor has to deposit with their stock broker or an exchange to cover the risk the holder poses for the broker or the exchange.
An investor usually adds money to their trading account with the Stock Broker, and then on the basis of the margin requirements that are specified by the Stock Exchange and that by the Risk Policy of the Stock Broker, the amount is blocked based on the orders placed by the investor.
On Dhan, you can view the margin requirements of each order on the order placement screen, before you actually place the order.
For example, if you have to buy a Stock which trades at Rs. 100 for delivery, then the amount required to place the order on Stock Exchange is Rs. 100, and Leverage is 1X since you have to put the full amount before you place the order. If you have to do an intraday in that same stock, the amount required may be less, say Rs. 20 since you will have to square off that position at the end of trading session. In this case, the margin required is Rs. 20 and leverage is 5X.