JQuery UI Dialog

JQuery UI Dialog

Dear Sirs,
I have web page that displays many graphs. The user has to click a button to view the graph. My JQuery UI Code is shown below
$(function() {
  $(".graph_1, .graph_2, .graph_3, .graph_4")
   
    .dialog({
    autoOpen: false,
    height: 254,
    width: 420,
    show: "blind",
    hide: "explode",
    buttons: {
      Close: function() {
        $(this).dialog("close");
      }
    }
  });
  $(".view_graph_1").click(function() {
    $(".graph_1").dialog("open");
  });
   
    $(".view_graph_2").click(function() {
    $(".graph_2").dialog("open");
  });
    $(".view_graph_3").click(function() {
    $(".graph_3").dialog("open");
  });
    $(".view_graph_4").click(function() {
    $(".graph_4").dialog("open");
  });

Now, I have four graphs. As the graph increases the code will increase as well. Is there a way that I have only one JQuery UI Dialog code that I can use as may graphs as possible.

Your help is very much appreciated.

Thank you in advance