Track selected row id(s).
Supply selected data row id to image plot request.
Use Chart::Gnuplot to render graphs.
Drop debug output.