Get data for current zoom view if X and Y axis values contains string values

Referring to the code in this post Get data for current zoomed in view How can we do the same for bar chart in the following codepen https://codepen.io/plotly/pen/74a638752a41ac9672a05f628e4ddaff . Is there a way to get the data from current zoom view when x or y contains string values?