I have data being stored into a postgresql database that I want to retrieve and create graphs from as needed.
In this case there are 2 items I am getting from the db,
times in ms, and a date that I want to graph together.
This is the query I use to get the data I want, and store it to "data"
cur.execute("SELECT ms, date FROM querytimes WHERE server = (%s) AND date > CURRENT_DATE - (%s)", (server,days,))
# retrieve the whole result set
data = cur.fetchall()
# close connection
Then I use zip and do the following, I think this is what needs fixed. Tried using date2num to convert but had no luck getting the graph to look as expected.
ms, date = zip(*data)
then graph it
# graph code
However whenever I include "date" the xaxis gets messed up, and so does the resulting graph.
If I graph just ms it looks fine
The zip makes two tuples
"ms" data looks like this,
(0.012395, 0.011431999999999999, 0.010031)
"date" data looks like this
(datetime.date(2013, 1, 10), datetime.date(2013, 1, 10),datetime.date(2013, 1, 10))
Basically looking to get a graph that can be from 1+ days of data, and have the xaxis be based on the info from the db, and for it to not be duplicated over and over.
So if there is 1 day of data that includes 500 ms times, I don't want today's date on the zaxis 500 times