# Need assistance figuring out the logic for my controller

**URL:** <https://www.ruby-forum.com/t/need-assistance-figuring-out-the-logic-for-my-controller/114275>\
**Category:** Rails\
**Created:** [September 10, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/need-assistance-figuring-out-the-logic-for-my-controller/114275 "2007-09-10T21:03:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [September 10, 2007, 9:03pm UTC](https://www.ruby-forum.com/t/need-assistance-figuring-out-the-logic-for-my-controller/114275/1 "2007-09-10T21:03:27Z")

</div>

Good afternoon,

I’m working on a small app that generates some dynamic charts using  
JFreeCharts.

I have a view that contains some different chart links in a side bar.  
Then in the center of the page I have a div for the charts. When  
clicking a chart link I would like to do the following:

- Place a spinner in the chart display div
- Generate CSV file of data to disk (I’ve got an array with the data,  
writing it is no problem)
- Generate chart from CSV file (done using this technique:  
[http://wiki.rubyonrails.org/rails/pages/HowtoGenerateJFreeCharts](http://wiki.rubyonrails.org/rails/pages/HowtoGenerateJFreeCharts))
- Display chart in the main div

Can this be done using an RJS template?

I built a skeleton RJS template so it would mimic what I ultimately  
want to do for my page:

page.replace\_html :chartStatus, ‘

## Generating your chart data.
’  
page.visual\_effect :highlight, ‘chartStatus’, :duration =\> 3  
page.replace\_html :chartDisplay, ‘ ![]()’  
page.delay(5) do  
page.replace\_html :chartStatus, ‘
## Done. Click chart for larger version or right click to save.
’  
page.visual\_effect :highlight, ‘chartStatus’, :duration =\> 3  
page.replace\_html :chartDisplay, ‘Chart goes here.’  
end

I’ll plug away and see if I can find any other instances of this,  
thanks in advance for any help.  
-Matt
