There are many ways to do this.
IF you really want to change the displayed x-range, you can get the current beginning and end with a property node of the graph using the properties (xscale-range-minimum and ...-maximum). If you are using custom scaling (offset, increment) you would need some simple math to get the indices for the desired subarray.
It is typically more intuitive to select the desired subrange with two cursors. Personally, I would go with Shahina's solution or similar.
🙂(Instead of using property "cursor position X" you might want to read the "Cursor Index" property instead, it gives you directly the array index of the data point at the cursor position. Also ensure that your cursor is locked to your plot for this).