I have a SQL table that logs pageviews. It has columns [id] ,[page] ,[userguid] ,[ip] ,[datetimeaccessed].
Ultimately, I need the data to end up like this:
where 'about' and 'admin' come from the [page] column, like "SELECT [page] FROM [myStatsDB].[dbo].[pageviews] GROUP BY [page]".
The large numbers are a bit trickier to explain, but I'll try.
For example, for 'about' and -6, the large number would be calculated by the number of pageviews between 7 and 6 days ago.
for 'about' and 0, the large number would be calculated by the number of pageviews in the past 24 hours.
I know how to get all of this data from SQL, I just have no idea how to get it into the format stated above.
And in case anyone's wondering, that format is for a graphing library called Flot.
Ultimately, I need the data to end up like this:
Code:
theHTML += "\"about\": {";
theHTML += "label: \"About\",";
theHTML += "data: [[-6, 483994], [-5, 479060], [-4, 457648], [-3, 401949], [-2, 424705], [-1, 402375], [0, 377867]]";
theHTML += "}, ";
theHTML += "\"admin\": {";
theHTML += "label: \"Admin\",";
theHTML += "data: [[-6, 218000], [-5, 203000], [-4, 171000], [-3, 42500], [-2, 37600], [-1, 36600], [0, 21700]]";
theHTML += "},";The large numbers are a bit trickier to explain, but I'll try.
For example, for 'about' and -6, the large number would be calculated by the number of pageviews between 7 and 6 days ago.
for 'about' and 0, the large number would be calculated by the number of pageviews in the past 24 hours.
I know how to get all of this data from SQL, I just have no idea how to get it into the format stated above.
And in case anyone's wondering, that format is for a graphing library called Flot.