Difference Between Aggregation Stream and Dashboard Total Calculation in Thingsboard - javascript

I'm using an Aggregate Stream Node to calculate total production of the day and also using a Timeseries Barchart dashboard to represent that total.
The key that is produced by the Aggregate Stream Node is being used in this custom dashboard inside the red circle.
Custom Card
With this configuration
Aggregate Stream Node configuration
And in the Timeseries Barchart dashboard I'm using the original key call "PPM2" (with the timestamp information) to represent the data with legend "Total" enabled.
Barchart dashboard
The problem is I'm reporting different calculations between the Barchart dashboard and the Aggregate Stream Node.
I been trying changing the node configurations but always have different results.
I will appreciate help or suggestions.

Related

what should be the initial dataset from millions of data points for stock line highcharts

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.

Rollup from daily to weekly metric on the fly in clientside

I have data in json format with date and values. Is it possible to switch from daily chart to weekly chart (rollup) through only any JavaScript based charting application , where i can mention the rollup function to be either sum or something else.
I want to avoid any server-side calculations.
Any suggestions or example will be of great help.

How to extract dygraph plot parameters to R in a shiny app?

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.

Implementing highcharts for Coin currency market

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.

MongoDB schema for this specific csv dataset? (for data vis. purposes)

I have a single csv file with data about schools: their locations, their names and a number of indicator values for each:
County_id, County_name, Municipality_id, Municipality_name, School_id,
School_name, Year, Indicator_1, Indicator_2, Indicator_3 [...]
I am building an interactive JavaScript visualization around this data and would like to serve it using MongoDB.
Some typical queries would be: (pseudo)
Get a list of all Schools and their respective locations
Get all Indicator_1 values for all years for schools in a specific location
Count the number of schools in a specific location
1. Based on the data given, how should I set up my MongoDB documents/collections to be able to answer queries such as the above?
(Hints on what intermediate steps I should take to import and build the schema are also welcome.)
For aggregate queries, check out MongoDB's MapReduce. This by default will create new collections based on your map/reduce functions (but can also run in-memory).
You can use mongoimport to import CSV data into the database, then leverage map/reduce to get the data you want.

Categories