When sketching you have to be careful not to draw things parallel that might not be parallel. This can easily lead to errors (and I think that you have made such an error in your equation). In particular, in your diagram line AC looks parallel to the "Y axis" when it isn't always the case (otherwise x would simply be 45°).
So the first step is to get the sketch fully correct. I've had a go at re-drawing (I swapped the axis labels to be more traditional!)...
View attachment 21421
I am curious about what point "P" actually is, and why line CP is always purpendicular to the x-axis. Or maybe I should not have drawn the right-angle symbol at P? I guess this question is tied up with another question:- what is the device that actually measures angle y?