The analog inputs is used to measure the joystick position. The analog input values can be range between 0 and 1023. Keep in mind that the input values may vary. I suggest you test the joystick position so you could get an accurate result. See the figure for the common output orientation of the joystick.
Notice on the joystick orientation that there's no negative values. the value x=512 and y=512 means that the position of the joystick handle is in the middle or the user did no touch it. If value of x= 512 and y= 1023, the joystick handle is pushed-up. If the joystick values that you received do not match on the diagram, you may calibrate it or you may experiment and map all the positions with the right values.
See the code below for joystick controller module
Setup the joystick controller module.
Connect the X pin of joystick to A1 of Arduino, Y pin of joystick module to A2 of Arduino and switch pin of joystick to digital pin 3 of Arduino. Connect the GND pin of joystick to GND of Arduino and the VCC pin of joystick to 5V of Arduino. Once completed, upload the code to Arduino. If the code has been uploaded successfully, open the Serial Monitor of Arduino Editor and watch out the display as you move the joystick handle and pushing the joystick switch. You will see the values of x, y and the switch.