0

and good night I'm making a forecast chart with Highcharter but it looks like this: enter image description here

And I would like to remove all those symbols of points, triangles and squares, but im not sure how I can do this I am a bit confused, since when doing the forecast with auto.arima the graph if it looks the way I want, that is:

enter image description here

The code im using is:

library(highcharter)
library(forecast)
df <- data.frame(data = rnorm(54, mean = 2000)) 
ts_data <- ts(data, start = 2017, frequency = 12)
modelo <- nnetar(ts_data, p=1,P=1,
                 size=1)
nnetforecast <- forecast(modelo, h = 12, PI = T)

hchart(nnetforecast)

And for the arima example:

hchart(forecast(auto.arima(ts_data)))

Thanks for the help

1 Answers1

0

Your code is not reproducible because the variable names (df,data).

And the second image you post is not the result of hchart(forecast(auto.arima(ts_data))) instead is your original time series.

After trying a few things i came to realise that the default hchart() function works diferently depending on length of the series.

set.seed(123)
# Doted time series, doted prediction
ts_dat50 <- ts(rnorm(50,2000), start = 2017, frequency = 12)
ts_dat50 <- forecast(auto.arima(ts_dat50))
hchart(ts_dat50)

# Normal time series, normal prediction
ts_dat85 <- ts(rnorm(85,2000), start = 2017, frequency = 12)
ts_dat85 <- forecast(auto.arima(ts_dat85))
hchart(ts_dat85)

# Normal time series, doted prediction
ts_dat85 <- ts(rnorm(85,2000), start = 2017, frequency = 12)
ts_dat85 <- forecast(auto.arima(ts_dat85),h=10)
hchart(ts_dat85)

If you change the h= argument on the forecast() function it will plot the time series as you wish. Just look at the X(time)axis on both of the graphs you uploaded.

In order to get the graph you are looking for you will have to modify the default options of the chart:

ts_dat50 <- ts(rnorm(50,2000), start = 2017, frequency = 12)
ts_dat50 <- forecast(auto.arima(ts_dat50))
hchart(ts_dat50) %>% hc_plotOptions(series = list(marker = list(enabled = FALSE)))
Dharman
  • 30,962
  • 25
  • 85
  • 135
JavRoNu
  • 349
  • 2
  • 12