0

We want to plot live data in this site https://www.highcharts.com/demo/live-data is it possible to plot it with Highcharter library in R language if not is there any another solution to do that with R language?

Here is JavaScript code:

var defaultData = 'https://demo-live-data.highcharts.com/time-data.csv';
var urlInput = document.getElementById('fetchURL');
var pollingCheckbox = document.getElementById('enablePolling');
var pollingInput = document.getElementById('pollingTime');

function createChart() {
    Highcharts.chart('container', {
        chart: {
            type: 'spline'
        },
        title: {
            text: 'Live Data'
        },
        accessibility: {
            announceNewData: {
                enabled: true,
                minAnnounceInterval: 15000,
                announcementFormatter: function (allSeries, newSeries, newPoint) {
                    if (newPoint) {
                        return 'New point added. Value: ' + newPoint.y;
                    }
                    return false;
                }
            }
        },
        data: {
            csvURL: urlInput.value,
            enablePolling: pollingCheckbox.checked === true,
            dataRefreshRate: parseInt(pollingInput.value, 10)
        }
    });

    if (pollingInput.value < 1 || !pollingInput.value) {
        pollingInput.value = 1;
    }
}

urlInput.value = defaultData;

// We recreate instead of using chart update to make sure the loaded CSV
// and such is completely gone.
pollingCheckbox.onchange = urlInput.onchange = pollingInput.onchange = createChart;

// Create the chart
createChart();
Nurlan Imanov
  • 53
  • 1
  • 5
  • You can poll for data using `shiny::reactiveTimer` or similar, and simple reactivity will update any graphs you have. Have you done anything with `shiny`? – r2evans Mar 16 '20 at 14:59
  • 1
    No actually I don't want to do with shiny app just simple R code maybe 'highcharter' libraray or some other visualization library – Nurlan Imanov Mar 16 '20 at 19:04
  • Maybe this thread will help you? https://stackoverflow.com/questions/40424407/real-time-chart-on-r-shiny – raf18seb Mar 17 '20 at 14:01
  • @raf18seb Do you know how to do it with simple R code without shiny app If yes can you please share the code ? – Nurlan Imanov Mar 19 '20 at 07:47
  • Unfortunately, I don't. I am not an R developer, I support only basic Highcharts features in R. – raf18seb Mar 19 '20 at 08:53
  • Okay thank you. Actually I want to do it with "highcharter" library of R. I know that you are interested in this library that is why I asked. If you know how to do it with 'highcharter' in R please let me know. Thanks in advance! – Nurlan Imanov Mar 19 '20 at 19:04
  • @raf18seb /////// – Nurlan Imanov Mar 20 '20 at 03:45
  • I know that you are using Highcharter ;) and I have already tried to help you, I was looking for a solution but didn't find it, sorry. Maybe try to contact Highcharter author here https://github.com/jbkunst/highcharter/issues – raf18seb Mar 20 '20 at 07:50

0 Answers0