According to the model of perfectly competitive markets, the demand curve for wheat should be a horizontal line, which is true for a single firm. In perfectly competitive markets there is no differentiation of products making the firms that reside in these market price takers. Therefore the farmer can sell as much wheat as he wishes at the market price, but cannot sell any at a higher price because there is no demand for it.
This is why the demand curve is a horizontal line at the market price. But in the market supply and demand, when the price of wheat rises, the quantity of wheat demanded falls, and when the price of wheat falls, the quantity of wheat demanded rises. Therefore, the demand curve for the entire wheat market is a diagonal line. Where the demand curve intersects with the supply curve in the model of the entire market is where the market price is set. This is where a single firms horizontal demand curve will be placed.