Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Timeseries plot #2

Open
jduckles opened this issue Oct 5, 2015 · 7 comments
Open

Timeseries plot #2

jduckles opened this issue Oct 5, 2015 · 7 comments
Assignees

Comments

@jduckles
Copy link
Contributor

jduckles commented Oct 5, 2015

This is an issue to talk about how we want to lay out the timeseries plots.

@nbgraham nbgraham self-assigned this Oct 6, 2015
@nbgraham
Copy link
Contributor

nbgraham commented Oct 9, 2015

@sarah-jung I would suggest adding a label to each rectangle on the left with the tag ID. You can look in etag/D3_examples in the bar chart to see how I labeled the bars. I would also add an axis on the top of the chart for the time. You can look at the axis on the bar chart for examples. Ask if you need any help.

@nbgraham nbgraham assigned sarah-jung and unassigned nbgraham Oct 9, 2015
@sarah-jung
Copy link
Contributor

@nbgraham Just a quick question but I can't seem to make the timeseries show up on the localhost and I'm wondering how you did that. Also if I were to make changes to the code, do I have to commit it every time for me to see it on the localhost?

@jduckles
Copy link
Contributor Author

You shouldn't have to commit on localhost. In order to make it work you're going to have to run a local web server. One way to do this if you have Python on the system is to run.

python2.x

python -m SimpleHTTPServer

python 3.x

python -m http.server

Let me know if you want some help figuring that out.

@sarah-jung
Copy link
Contributor

@nbgraham I got mostly everything to work but on the x axis, I can't seem to make the time exactly right. It shows the hour as 12 instead of 17 and I can't really fix it.

@nbgraham
Copy link
Contributor

@sarah-jung Looks great! That's how its supposed to be. The data gives the time in UTC format and the browser converts its to local time (central time for us).
image

@nbgraham
Copy link
Contributor

I've added the time series representation to the map. @sarah-jung take a look because I mostly implemented the timeseries files to what we were talking about in the meeting.

@jduckles @mbstacy
I'm struggling with the asynchronous function calls in my data parsing of drawTimeseries.js

I could implement this function by looping through each item and building the list one by one like I did for function type(data) in the original timeseries. However, this solution (below) seems more elegant and more useful of the API.

The results item is not getting updated fast enough. The next time I use results after calling groupByTags, I get an error because it is undefined. Is there any way to fix this?

function groupByTag(data, url)
{
  var uniqueTags = [];
  var results = [];
  var element, index, tag;

  for (var i = 0; i<data.length; i++)
  {
    element = data[i];
    element.timestamp = new Date(element.timestamp);
    index = contains(uniqueTags, element.tag);

    if (index < 0)
    {
      uniqueTags.push(element.tag);
      d3.json(url + "&tag=" + element.tag, function (data)
      {
        results.push(data.results);
      });
    }

  }
  return results;
}

@jduckles
Copy link
Contributor Author

Looks to me like line 93 var results = groupByTag(data.results); is not working in an async fashion. See this guide on async http://www.html5rocks.com/en/tutorials/async/deferred/ particularly the second section called "Making Applications Asynchronous-Ready"

It is a bit of a different paradigm when programming with asyc, event driven JavaScript.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants