Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timeseries graphs #305

Closed
corradio opened this issue Jan 20, 2017 · 21 comments
Closed

Add timeseries graphs #305

corradio opened this issue Jan 20, 2017 · 21 comments
Assignees

Comments

@corradio
Copy link
Member

No description provided.

@martindaniel4
Copy link
Contributor

@corradio - would love to help on that one.

Do you have a spec ? What's your idea here ?

@nikkozzblu
Copy link
Contributor

We should certainly be using c3.js here which come on top of d3
I did it for another project and can brind some code samples if needed.
As an interface, because we have so many variables, maybe a variable picking mecanism from current legend can be better. For instance if you click current FR wind, it open the last 3days historial, if you click it again, it disappears, if you click another variable, it add the curve to the current plot.
Wind and solar would probably be activated by picking a point on the map
It will also need datetime start/end pickers

@corradio
Copy link
Member Author

The idea here is that, everytime the feeder finishes to run (every 5min), it should updates the server cache (memcached) with timeseries data (power, co2 and prices) for all countries for the latest X hours (6 hours?).
We then have a fast way of serving that data to the frontend.

Frontend-wise, I'd suggest making the top-left panel fill the whole screen height, turning it into a left panel (height: 100%, width: fixed). Under the import/exports part, we can then add a graph showing the last X hours of production. Clicking on the "show emissions" button would show emissions instead.

The last open question in my mind is how/where to show the timeseries of co2.

c3.js indeed does sound interesting. However, we use d3 v4 so I don't know if they are compatible. We have to dig deeper.

Let me know your thoughts.

@nikkozzblu
Copy link
Contributor

C3 running in D3v3 is indeed quite unfortunate; we can still plot with d3 directly but we loose a lot of nice tooltip, data loading ability from C3....
On another hand is there any specific needs on other parts that require running v4 rather than v3 ?

@corradio
Copy link
Member Author

Mmh d3 is used a bit everywhere in the webapp, so it will be hard to downgrade. It won't be hard to do the graph by ourselves anyway.
I'm working on www.co2signal.com right now, but I'll attack this next week probably. @nikkozzblu @martindaniel4 if you guys want to start let me know.

@martindaniel4
Copy link
Contributor

@corradio - I am not sure to understand the front-end side. Are you guys thinking of something like this ?
@nikkozzblu - What did you have in mind for the solar and wind timelines ? One tooltip where you click on the map ?

graph_mock_up

@corradio
Copy link
Member Author

Yeah something like that. And when you hover on each of the lines it shows you the history of that line in the graph placeholder.

@corradio
Copy link
Member Author

Fiddle by @nikkozzblu : https://jsfiddle.net/sz6yrp7s/3/
I'll try and see if I can port c3 to d3v4

@corradio corradio mentioned this issue Jan 27, 2017
@AndyinHawick
Copy link

I would be interested in seeing a country-by-country comparison of price versus carbon content. Each country (which has both data) would be represented by a dot (perhaps sized according to total power). X-axis carbon intensity; Y-axis day-ahead price.

Clicking through the data suggests that there may be patterns here but it is difficult to visualise without actually plotting on a graph.

@corradio
Copy link
Member Author

Hi @AndyinHawick ,

This sounds like a notebook to be added in the datascience folder! Are you up for the task?

Olivier

@AndyinHawick
Copy link

AndyinHawick commented Jan 28, 2017 via email

@corradio
Copy link
Member Author

corradio commented Jan 31, 2017

On top of my mind there's several curves we could show over the last X hours:

  • CO2 intensity
  • Production + import/export (stacked per production unit and per import/export)

A simple toggle would do I think. Is there anyone up for trying this? I will be ready with the backend quite soon. @nikkozzblu and I looked at c3 but we either need to port it to d3v4 or code our own graph (which I think we should do instead).

We should probably write a small module that can plot a stacked (area) timeseries, with a small tooltip and vertical bar.

@nikkozzblu
Copy link
Contributor

nikkozzblu commented Jan 31, 2017 via email

@corradio
Copy link
Member Author

My proposal:

  • one graph with co2 intensity (g/kWh) with a gradient background representing the co2 scale
  • one graph with production+import/export stacked (kW)
    We should leave prices out for now as they are not that interesting compared to other metrics.

@martindaniel4
Copy link
Contributor

martindaniel4 commented Jan 31, 2017 via email

@AndyinHawick
Copy link

AndyinHawick commented Jan 31, 2017 via email

@corradio
Copy link
Member Author

corradio commented Feb 1, 2017

@AndyinHawick, I'm opening an issue specifically for this. We won't put it in the realtime electricity map, because the analysis you're looking for needs to be done on more than a couple of hours (probably weeks/months). We might however put a time series of price, but not a scatter plot. Issue: #336

@martindaniel4 here's some ideas:

Graph in tooltip:

  • Works well for isolated time series (so good for CO2 intensity for example)
  • Hard to compare with others, so not so good for each production mode
  • Impossible to hover in order to get more detailed quantifications of past values
  • Would be nice to click on a point in the past and show the map at that time

What about making the left panel scrollable? Yes we can add a toggle, but I have a hard time seing it work. I'll try to prepare a branch with some ideas. Feel free to do the same!

@corradio corradio self-assigned this Feb 5, 2017
@corradio
Copy link
Member Author

corradio commented Feb 5, 2017

I'm starting on this today.

@martindaniel4
Copy link
Contributor

@corradio do you have a way to pull data locally?

Looks like the feeder is only fetching data for current datetime

@martindaniel4
Copy link
Contributor

Ok obviously it looks like you thought about everything already and you have a toggle to fetch data from remote endpoint ;) - https://github.com/corradio/electricitymap/blob/master/web/app/main.js#L33

@corradio
Copy link
Member Author

corradio commented Feb 6, 2017 via email

@corradio corradio mentioned this issue Feb 6, 2017
6 tasks
Pantkowsky pushed a commit to Pantkowsky/electricitymap that referenced this issue Mar 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants