Freeboard / freeboard

A damn-sexy, open source real-time dashboard builder for IOT and other web mashups. A free open-source alternative to Geckoboard.
http://freeboard.io
MIT License
6.45k stars 1.2k forks source link

Using sparkline with static array #110

Open frey1esm opened 9 years ago

frey1esm commented 9 years ago

The Sparkline widget only seems to function as a realtime dynamic chart. Can it be used as a static "historical" chart also? If so, how does the data need to be formatted? I tried [0,1,2,3] and ["0","1","2","3"] and ['0','1','2','3'] and others ...nothing will display except dynamically changing singular values.

bugvish commented 9 years ago

Hi @frey1esm - you are correct, the sparkline (and most of the widgets, for that matter) are currently designed for realtime data. We are working on some new widgets that render historical data, but in the mean time, you can load a file of json-formatted data using the Playback Widget and see the data points rendered at the interval you choose, as if it were happening live.

nochte commented 9 years ago

Finger slipped. Sorry about that.

frey1esm commented 9 years ago

No problem. I incorporated AmCharts into my setup for now.

thegunshow commented 8 years ago

Hi Frey1esm.

Do you have an example how hoe you incorporated this? It would really help me out.

Thanks

aliomattux commented 8 years ago

Hello Appreciate the open source product, but this design can cause issues. The companies I have worked with are always interested in activity within the current day. How are sales doing today, or how many issues do we have today. This means that when I pull up the dashboard its going to use only the value right now and future values (sparkline). There appears to be no ability to populate data for a day, etc, which is how other dashboard applications work. I don't see the practical use for daily reporting with this implementation.

aliomattux commented 8 years ago

I think also, that the data is stored in the browser. If you refresh the page or pretty much close and go back, you will loose the entire board history and the graphs reset to 0. I don't understand how this is useful.

gdilla commented 8 years ago

Freeboard is optimized for realtime datastreaming, being an IOT focused dashboard product. There are historical widgets we've made using our own dweet.io datasource that you may use. Else, if you're need historical charts, there's probably other tools out there you can leverage (maybe keen.io?).

oregonjoe commented 7 years ago

We have been able to get freeboard widgets to behave with historical data by passing in a array and rewriting the onCalculatedValueChanged to parse the array -

Now sparklines and graphs can show weeks without having to wait a week.

if(Array.isArray(newValue[0]) && newValue[0].length) {

                    // get number of points to plot for the series
                // assume all series have the saem number of points ??
                length=newValue[0].length;          
                    for(i=0; i< length; i++)
                    {
                        // empty the series points
                        arrayvalues = [];

                        // add a point from each series
                        for(j=0; j< newValue.length; j++)
                            arrayvalues.push(newValue[j][i].value);

                            // now pass the serries of points into the plot routine 
                            if (currentSettings.legend)
                            {

                                addValueToSparkline(sparklineElement,  arrayvalues, currentSettings.legend.split(","));
                            } else 
                            {

                                    addValueToSparkline(sparklineElement, arrayvalues);

                            }
                    }
                }
                else
                {
                    // now pass the serries of points into the plot routine 
                            if (currentSettings.legend)
                            {

                                addValueToSparkline(sparklineElement,  newValue, currentSettings.legend.split(","));
                            } else 
                            {

                                    addValueToSparkline(sparklineElement, newValue);

                            }

                }
V5NXT commented 7 years ago

Hei Guys, I have been trying to add an array of realtime data from a datasource to sparkline but it only displays the last data in the array. The datasource data is : "series": [ { "color": "#409c30", "data": [ 157885.51109504004, 160684.38745331066, 161428.26465123214, 163440.48706319294, 164638.7024257558, 166283.651785073, 165642.324769808, 165739.04453184048, 166262.1671557934, 167573.92870100026 ], how can i add such a data to sparkline, that is inside the data array there are 4 data's i want to plot them on sparkline, i have tried datasources["Price Index"]["series"][0]["data"]['0','1','2'] but it only displays 2nd index data: How should the data be formatted inside the data array: datasources["Price Index"]["series"][0]["data"]

Sorry for such a dumb question, but i am new to this, Thanks in advance!