I have 2 long[24]
arrays. Both of them contain values for each hour of a day. One of them has hit count and other queue times. Now queue times in ms are 5 digit numbers, counts are 2 digit numbers. I want to show them in one chart, because queue times are to some degree corresponding with hits, but the scale is totally different. So what I came up with is that I take the max value from one list and recalculate all the values from second array using that maximum.
var count = new long[24]; // values similar to [0, 9, 25, 65 ..]
var waitings = new long[24]; // values similar to [34111, 65321, 5003 ..]
count = NormalizeDataset(count, waitings.Max());
// ... skipped
@functions {
private long[] NormalizeDataset(long[] count, long max)
{
long countMax = count.Max();
var returnable = new long[24];
for (int i = 0; i < count.Length; i++)
{
var l = (count[i] * max) / countMax;
returnable[i] = l;
}
return returnable;
}
}
Does doing it like this make sense? How is this problem usually solved?