richie5um / TextBar-Recipes

TextBar Recipes
369 stars 35 forks source link

Simple graph? #46

Closed Henrietta1989 closed 7 years ago

Henrietta1989 commented 7 years ago

How i can create simple line graph showing Bitcoin price and this graph shows maybe 5 hours of history?

I can do everything else except the graph part.

It updates once every 10 minutes so script can be slow.

It seems TextBar now supports only Show Mem 'graph' and Show CPU 'graph' type of graphs.

It would be enough if dots are one pixel size and after 10 minutes, graph scrolls one pixel left and draws current price pixel.

Another thing is, is it possible to show dynamic image in menubar? Image which changes every 10 minutes.

richie5um commented 7 years ago

It might require a plug-in, but this should be very possible. Do you have an API for the Bitcoin price and I’ll see what I can create for you?

Henrietta1989 commented 7 years ago

This page has Python wrapper, PHP wrapper and Node.js example of how to connect to the push API too.

There is WebSockets too or can use this:

https://poloniex.com/public?command=returnTicker

https://poloniex.com/support/api/

Thanks

richie5um commented 7 years ago

Hi,

I've taken a look and this looks like it'll be a lot of work for me to build in graphing functionality into TextBar. It is definitely something I'd like to do for TextBar v4 though.

Thanks, Rich

Henrietta1989 commented 7 years ago

OK Thanks.

I just tried this:

curl https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD&e=Poloniex

and it returns error:

{"Response":"Error","Message":"tsyms param seems to be missing.","Type":1,"Aggregated":false,"Data":[]}

If i simply open that url in browser, it returns:

{"USD":5923.22}

https://www.cryptocompare.com/api/#public-api-invocation

Don't know what is the problem and also i have no idea how to parse that code to get just:

5923

richie5um commented 7 years ago

I've now got a way of showing charts in TextBar. It needs polish, but it should be available in the next release.

https://twitter.com/textbarapp/status/923672245213507584

Just need to work on a script to get the Bitcoin price now :)

Henrietta1989 commented 7 years ago

Coooooooool Thanks. That screenshot looks really nice.

Could that chart show number behind that chart? And even if dataset have numbers with 8 decimals, user could choose to show 0 or any other number or decimals.

This would save even more menubar space.

richie5um commented 7 years ago

Hi. I have a rough version of TextBar that will show the last 30 days of bitcoin prices in a graph. It needs some polish, but is a good start. Let me know if you would like to try it - email rs@richsomerfield.com. Thanks.

richie5um commented 7 years ago

Now possible in the latest TB version. Thanks for the suggestion and help.