Module:Television ratings graph: Difference between revisions

Content deleted Content added
Add changing increment
Reverted to revision 761864818 by AlexTheWhovian (talk): Failed. Has to be an integer. (TW)
Line 95:
end
end
maxviewers = math.ceil(maxviewers)
 
-- Determine increment based on maximum viewers
local increment = 1;
if maxviewers <= 5 then increment = 0.5 end
if maxviewers <= 1 then increment = 0.25 end
 
-- Further parameters, with rounded-up viewer figures as maximum period
timeline = timeline .. "DateFormat = x.y\n"
timeline = timeline .. "Period = from:0 till:" .. math.ceil(maxviewers) .. "\n"
timeline = timeline .. "TimeAxis = orientation:vertical\n"
timeline = timeline .. "ScaleMajor = gridcolor:a increment:" .. increment .. "1 start:0\n"
timeline = timeline .. "Legend = orientation:horizontal\n"