title: Google chart :Create dynamic data view columns
body: <p>Using google chart am trying to set data view .i have to create data view based on columns.</p>
  
  <p>currently i have two functions to create data columns for 4 and 2. How can i combine these two functions and how can i create a function which dynamically
  create data view </p>
  
  <pre><code> var dataView = new google.visualization.DataView(chartData);
   setDataViewMultipleChart(dataView);
  
  
  
   function setDataViewMultiple(dataView) {
                  dataView.setColumns([0, 1, {
                  calc: function(dt, row) {
                  return getTooltip(dt, row, 1);
                  },
                  role: 'tooltip',
                  type: 'string',
                  p: {
                  html: true
                  }
                  }, 2, {
                  calc: function(dt, row, ) {
                  return getTooltip(dt, row, 2);
                  },
                  role: 'tooltip',
                  type: 'string',
                  p: {
                  html: true
                  }
                  }, 3, {
                  calc: function(dt, row) {
                  return getTooltip(dt, row, 1);
                  },
                  role: 'tooltip',
                  type: 'string',
                  p: {
                  html: true
                  }
                  }, 4, {
                  calc: function(dt, row) {
                  return getTooltip(dt, row, 2);
                  },
                  role: 'tooltip',
                  type: 'string',
                  p: {
                  html: true
                  }
                  }]);
        }
  
  
  
        function setDataViewSingleChart(dataView) {
                  dataView.setColumns([0, 1, {
                  calc: function(dt, row) {
                  return getTooltip(dt, row, 1);
                  },
                  role: 'tooltip',
                  type: 'string',
                  p: {
                  html: true
                  }
                  }, 2, {
                  calc: function(dt, row, ) {
                  return getTooltip(dt, row, 2);
                  },
                  role: 'tooltip',
                  type: 'string',
                  p: {
                  html: true
                  }
  
                  }]);
        }
  </code></pre>