winston / google_visualr

A Ruby Gem for the Google Visualization API. Write Ruby code. Generate Javascript. Display a Google Chart.

Home Page:http://googlevisualr.heroku.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Gantt charts stopped working

vanhob opened this issue · comments

hi, it seems the gantt charts stopped working over the past couple of days/weeks? As Gantt charts are still in beta at Google, did they change the API? :

Here is my ruby code with the view definition:

def party_life_gantt_charts

data_table = GoogleVisualr::DataTable.new
counter = 0
data_table.new_column('string', 'Period ID')
data_table.new_column('string', 'Period')
data_table.new_column('string', 'Resource')
data_table.new_column('date'  , 'Start Date')
data_table.new_column('date'  , 'End Date')
data_table.new_column('number', 'Duration')
data_table.new_column('number', 'Percent Complete')
data_table.new_column('string', 'Dependencies')

@party.periods.each do |line|
  start_date = line.effective_start_date
  end_date = line.effective_end_date
  if start_date != nil and end_date != nil then
    if end_date <= Date.today then
      completed = 100
    else
      if start_date >= Date.today then
        completed = 0
      else
        completed = (100 * TimeDifference.between(Date.today, start_date).in_days/TimeDifference.between(start_date, end_date).in_days).to_i
      end
    end
    duration = [30, TimeDifference.between(end_date, start_date).in_days*(1.0)].max.to_i
    data_table.add_rows([[line.id.to_s,line.period_name, look_up_value(line.period_type), start_date, nil, days_to_milli(duration), completed , nil]])
    counter += 1
  end
end

opts   = { version: '1.1', height: 25 + counter * 50}
@periods_chart = GoogleVisualr::Interactive::GanttChart.new(data_table, opts)

end

There's an open PR for it. #102

Sorry have been slightly busy. Will take a look in the next few days.

any news???