I am writting a mini-app in Shiny to explore time-series using Dygraphs library.
I would like to set an actionButton to 'freeze' the actual view of the graph and recover it whenever I want.
My first goal is to get the actual graphical parameters and save them into an R object. For example, to get the actual x-axis range I have to extract dateWindow() parameter. Unfortunately, I do not even know how to start, although I have read several documentation about it.
Any help will be appreciated.
Related
I want to prepare a line stock highchart like this example : https://www.highcharts.com/demo/stock/lazy-loading
In the given example, when you load the chart for the first time, it calls https://demo-live-data.highcharts.com/aapl-historical.json and fetches some points, to be precise 0-165 records (if you check the network tab and ajax call). At a same time All option is selected in the time range tool.
If you drill down further or go for any specific time range, it will bring more data always from the server.
Question: If you have millions of data points, consider from 2000 to 2022 years, then for All option, what are you going to display. what should be the initial data set or result or filter ?
NOTE: I will have millions of data points from 2000 to 2022 years going forward. When I load the chart for the first time, out of these millions points, what should come back from the server ?
Just for your reference, you can check example of time series data that I'm going to have in mock-data=>i.js folder/file which is NOT being used anywhere in below example as of now.
Highcharts 1.7 million points example : https://stackblitz.com/edit/js-wng4y6?file=index.js
P.S. : I'm new to stockhighcharts and I don't seem to find any proper explanation anywhere. Trying to reach out to the community for further help.
Server-side data grouping should be done based on the range for with you are trying to group the data, so All means nothing - however, in your case this will be 2 years.
For the data grouping you might also consider the chart size (this is done by default for a dataGrouping feature running client-side in Highcharts Stock). When relevant information is passed to the server it should return a set of grouped data points.
About grouping logic you can find more in the api options where is present method of approximation inside a group.
https://api.highcharts.com/highstock/series.area.dataGrouping.approximation
Sending this much data to highcharts to be processed is asking for issues. I highly recommend making a local highcharts server (something they support) and have this done within your system. See it here
This is very important when it comes to security as well (if your data is sensitive), having it race across the internets to highcharts and then sent back to you leaves it open to the world.
From here, you can also specify the start and end time of each render, and have that change based on user input. Personally I would generally display the last 5 days or something, and then if someone wanted to, they could pull the slider all the way back for the last significant amount of time.
But, to answer your question, when you send a data object to highcharts, either local server or the highcharts server, you will get a base64 image back that you can directly imbed in your UI.
I have coin currency market application and I would like to integrate a graph in it, however I don't know from where data should be taken. Is there some API that I can integrate into my highcharts in order to get graphical representation of values of the coin in the past 7,14,30 days? I have scrapped all data from http://coinmarketcap.com/ but I can't scrap graph because it's canvas. Can you help me with that? Where to search for coin data in the past?
The coinmarketcap site uses json data for the charts. If you look at the network activity in the console, you can see requests for items like:
http://coinmarketcap.com/static/generated_pages/currencies/datapoints/bitcoin-main.json
This contains the json data for the bitcoin chart. However, there does not seem to be any way to specify different time periods.
A quick look around produced this site for bitcoin info (https://bitcoinaverage.com/api). There are lots of links which may help here: able to get prices from here: http://bitcoincharts.com/charts
You can also check yahoo fincancem which allows to get data via API.
I'm new to javascript jQuery and JSON and I'm starting a project where I'd like to do some graphs in a browser. Digging through tutorials and examples I'd like to create a graph with some data gathered with JSON and then work with the graph as shown in the examples (adding axes... ).
So I'm pretty sure the problem is that creating the graph with var ajaxGraph = new Rickshaw.Graph.Ajax doesn't return the same object as var graph = new Rickshaw.Graph. The Rickshaw.Class.create function used for var ajaxGraph = new Rickshaw.Graph.Ajax is too complicated for me to comprehend with my current skills. Can I somehow get the proper graph object from Rickshaw.Graph.Ajax? Or should I try to use JSON separately and then call var graph = new Rickshaw.Graph somehow?
Thanks for any hints.
I would definitely consider rather doing the JSON stuff separately, getting the data into the correct format and then binding Rickshaw to it.
Doing that might not be as hard as you think and will be useful later on for different work. Using Rickshaw's ajax abstraction doesn't really save you from complexity in my opinion.
Here's a screencast that I created that goes through exactly what you need: http://tagtree.tv/d3-with-rickshaw-and-angular. It might be a bit more complex because it plonks a Rickshaw graph into an Angularjs app, which has it's own challenges. But what it does show you, is how to massage the data you get from the server into the correct format to give to Rickshaw.
Getting the data from the server with jQuery is quite easy. You can use the shorthand ajax methods:
http://api.jquery.com/category/ajax/shorthand-methods/
Or even get to know the ajax call (I think it's better to start here):
http://api.jquery.com/jQuery.ajax/
Then massaging the data so that Rickshaw can bind to it, I would recommend using underscore:
http://underscorejs.org/
I have a store which always contains a single record. Lets say the record looks like this:
{'good': 5, 'bad': 2, 'neutral': 3}
How would I render that as a Pie chart? Ext.js normally uses each record in a store as one point of the series. In my case, I have only one record and want it to be used as three points in the series.
You have a couple options available to you. You can create a custom Ext.data.reader.Reader subclass that will convert your raw data into your formatted records, you can override the store's loadRawData method to convert JSON data into an Ext.data.ResultSet, or you can set a callback on the store's load method to get your record and manually convert it into your necessary record format. If you're going for reusability, I suggest making a Reader.
The Reader#readRecords method takes raw data and returns a ResultSet, which sounds exactly like what you're after. Take a look at the source from the Sencha docs website and you should be able to figure out where to go from there. Once you have your custom reader, pass it to your store's proxy during configuration and it should handle the work for you. If it doesn't automatically, you may need to call the store loadRawData, passing your JSON response.
Split it into three records. You can create your own instances of Record and fill them with data using your original record as source.
I am trying to display different images based on data returned. I am running into the following issues
DataSet is not available on the image control for me to make decisions based on the column information. I am using a grid layout (no tables)... Think of a letter
I tried to create report level variables and assign it the value from dataset during the onFetch event. However, that assignment does not happen.
I have tried both
rptvar = dataSetRow["colname"]
rptvar = Row["colname"]
I have confirmed that onFetch event does get called using Javascript debugging (see http://www.lebirtexpert.com/wordpress/2010/08/)
Please let me know how to access dataset columns to dynamically create the image URI
There's a post on the BIRT world blog that should be very useful to you:
http://birtworld.blogspot.com/2010/09/birt-image-report-item.html
Kudos to Mr. Weathersby!