So I have an array to be rendered and displayed in some charts, but say my dataset is going to be far too large, how can I take an array that is say 20,000 items in length and like either drop every other item until the array is 1,000 items or interpolate the array until it's that size?
Example, say I have the following array (of hashes):
[
{"timestamp"=>2011-09-05 14:30:00 UTC, "count"=>4488.0},
{"timestamp"=>2011-09-05 14:45:00 UTC, "count"=>4622.0},
{"timestamp"=>2011-09-05 15:00:00 UTC, "count"=>4655.0},
{"timestamp"=>2011-09-05 15:15:00 UTC, "count"=>4533.0},
{"timestamp"=>2011-09-05 15:30:00 UTC, "count"=>4439.0},
{"timestamp"=>2011-09-05 15:45:00 UTC, "count"=>4468.0},
{"timestamp"=>2011-09-05 16:00:00 UTC, "count"=>4419.0},
{"timestamp"=>2011-09-05 16:15:00 UTC, "count"=>4430.0},
{"timestamp"=>2011-09-05 16:30:00 UTC, "count"=>4429.0},
{"timestamp"=>2011-09-05 16:45:00 UTC, "count"=>4502.0},
{"timestamp"=>2011-09-05 17:00:00 UTC, "count"=>4497.0},
{"timestamp"=>2011-09-05 17:15:00 UTC, "count"=>4468.0},
{"timestamp"=>2011-09-05 17:30:00 UTC, "count"=>4510.0},
{"timestamp"=>2011-09-05 17:45:00 UTC, "count"=>4547.0},
{"timestamp"=>2011-09-05 18:00:00 UTC, "count"=>4471.0},
{"timestamp"=>2011-09-05 18:15:00 UTC, "count"=>4501.0},
{"timestamp"=>2011-09-05 18:30:00 UTC, "count"=>4451.0},
{"timestamp"=>2011-09-05 18:45:00 UTC, "count"=>4453.0},
{"timestamp"=>2011-09-05 19:00:00 UTC, "count"=>4593.0},
{"timestamp"=>2011-09-05 19:15:00 UTC, "count"=>4540.0},
{"timestamp"=>2011-09-05 19:30:00 UTC, "count"=>4516.0},
{"timestamp"=>2011-09-05 19:45:00 UTC, "count"=>4494.0}
]
And I want an array of the intermediary values, either just dropped out of the array or somehow interpolated, like such:
[
{"timestamp"=>2011-09-05 14:45:00 UTC, "count"=>4622.0},
{"timestamp"=>2011-09-05 15:00:00 UTC, "count"=>4655.0},
{"timestamp"=>2011-09-05 15:30:00 UTC, "count"=>4439.0},
{"timestamp"=>2011-09-05 16:00:00 UTC, "count"=>4419.0},
{"timestamp"=>2011-09-05 16:30:00 UTC, "count"=>4429.0},
{"timestamp"=>2011-09-05 17:00:00 UTC, "count"=>4497.0},
{"timestamp"=>2011-09-05 17:30:00 UTC, "count"=>4510.0},
{"timestamp"=>2011-09-05 18:00:00 UTC, "count"=>4471.0},
{"timestamp"=>2011-09-05 18:30:00 UTC, "count"=>4451.0},
{"timestamp"=>2011-09-05 19:00:00 UTC, "count"=>4593.0},
{"timestamp"=>2011-09-05 19:15:00 UTC, "count"=>4540.0},
{"timestamp"=>2011-09-05 19:45:00 UTC, "count"=>4494.0}
]
Any thoughts or help on this would be greatly appreciated, I may just be missing the point here as well.
"timestamp"order?