I would to print into my charts the hours and minutes, for example "development: 27 h 30 m".
Now I have this:
In my script "data" represents "hours"
{
name: value.blank? ? "other" : value,
data: all_weeks.merge(data_weeks.to_h).values.map do |data_value|
data_value.nil? ? 0 : ( data_value.to_f / 60 ).round(2)
end
}
....
f.tooltip(
pointFormat: "<span style='color:{series.color}'>{series.name}</span>: <b>{point.y} h</b><br/>",
split: true
)
I have tried to set point.y into pointFormat but no have effects. ( Edit: pointFormat would a generic string! )
How can I solve? Thanks in advance.
Edit:
I solved adding:
LazyHighCharts::HighChart.new("container") do |f|
f.tooltip(
formatter: "\
function() { \
var s = []; \
s.push(this.x); \
this.points.forEach(function(point) { \
s.push('<b>' + point.series.name + '</b>: ' + Math.floor(point.y) + ' h ' + Math.floor((point.y % 1) * 60) + ' m'); \
}); \
return s; \
}".js_code,
split: true
)
....
end


Maybe you could introduce two variables,
data_hoursanddata_minutes, and write a string interpolation with theses variables.Hope it will help !
Written in 0.12 hours ;)