michelson/lazy_high_charts — Issue #40: Populate Table w/ Multiple Charts - Tooltips don't work
Author: tonydm
Created: 2011-12-13 23:25:35+00:00
State: open

Hi,

I first recognize this is not a code bug. I'm new to github and looking for assistance here; usually at rails or ruby forum. So please, if this is the inappropriate place to post this, please direct me to the appropriate.

I've posted on Rails Forum and done a number of Google searches but have not found a solution to my problem. I am populating a table with multiple charts. Each chart has three data series and represents bandwidth consumption for a give IP. My main problem is that the Tooltips don't work.. while the Legend does work and you can show/hide a data set. I'm happy to post separately my two other issues, (orphan

tag from high_charts() call and can't get y-axis title to print. BTW, this gem ROCKs! No really!

View

<% i = -1 %>
<% @ips.each do |ip| %>
<% i += 1 %>

<%= ip[:ip_addr] %>

<%= high_chart('chart_'+i.to_s, @charts[i]) %>

<% end %>

Controller

start = Time.local(2011,12,1).to_i * 1000
interval = 1.day * 1000

chart_data = [{
name: 'Received',
pointInterval: interval,
pointStart: start,
data: data[:received],
zIndex: 3
},{
name: 'Transmitted',
pointInterval: interval,
pointStart: start,
data: data[:transmitted],
zIndex: 2
},{
name: 'Total',
pointInterval: interval,
pointStart: start,
data: data[:total],
zIndex: 1
}]
chart = LazyHighCharts::HighChart.new('graph') do |f|
f.options[:chart][:type] = 'areaspline'
f.options[:chart][:width] = '570'
f.options[:chart][:height] = '275'
f.options[:chart][:renderTo] = 'null'
f.options[:chart][:backgroundcolor] = '#FFFFFF'
f.options[:chart][:shadow] = true
f.options[:credits][:enabled] = true
f.options[:credits][:position] = { :align => 'right', :x => -10, :verticalAlign => 'bottom', :y => -10 }
f.options[:title][:text] = 'Bandwidth Usage'
f.options[:subtitle][:text] = 'In megabits'
f.options[:xAxis] = { :type => "datetime", :lineWidth => 1 }
f.options[:xAxis][:linewidth] = 1
f.options[:xYxis] = { :title => { :text => 'Bandwidth Consumed' } }
f.options[:plotOptions][:series] = { :lineWidth => 1, :marker => { :radius => 4 }	}
f.data = chart_data
f.options[:navigation] = { :buttonOptions => { :align => 'right' }}
end
return chart