how to load graph after loading other data

I'm using rails 3.2.1

My page is divided into 5 parts

part-1 header part-2 div area part-3 graph part part-4 data in tabular format part-5 footer

Now my problem is that graph take too much time to upload. Due to which this page take too much time to load.

Please tell me any method so that my graph load in the last but other data will display.

I'm using rails 3.2.1

My page is divided into 5 parts

part-1 header part-2 div area part-3 graph part part-4 data in tabular format part-5 footer

Now my problem is that graph take too much time to upload. Due to which this page take too much time to load.

Please tell me any method so that my graph load in the last but other data will display.

You can use JavaScript to lazy-load the graph, as long as there is no legal requirement that the graph be universally available, since it will just not load in the absence of a scripted client. Note that Google will skip it as well, if that matters to you.

Refactor your graph code so you can request the graph from its own URL, then use an Ajax request to load it asynchronously into the page.

Using Prototype, put the following in a script block below the div where your graph will appear:

  new Ajax.Updater('div_where_the_graph_goes', 'url/to/the/graph');

For extra credit, add an inline placeholder div within your div_where_the_graph_goes element, with its background set to a loading spinner GIF. This will be replaced when the Updater finishes.

Walter