configureChart isn’t an event. So it doesn’t have an event variable. Look at the top line to see the arguments passed in. Construct your code with those. For example, use self instead of event.source.
You’ve cut and pasted code that doesn’t seem to be for an XY Chart (classic chart in XY Plot mode). (A button with some customized chart as a sibling, it seems.) The getDynamicProps("ranges") looks suspicious/custom. The only dynamic props in the classic chart are the data series.
Almost certainly. I just haven’t done exactly that, so have no code to supply. The comment in the configureChart() extension function is your next step: dig into the JFreeChart library.