score:7
a good approach to add multiples series in my opinion is use hc_add_series_list
(oc you can use a for loop) which need a list of series (a series is for example list(name="a",data=mydata$a)
.
as you said, you need to melt/gather the data, you can use tidyr
package:
mynewdata <- gather(mydata)
then you'll need to group the data by key
argument to create the data for each key
/series. here you can use dplyr
package:
mynewdata2 <- mynewdata %>%
# we change the key to name to have the label in the legend
group_by(name = key) %>%
# the data in this case is simple, is just .$value column
do(data = .$value)
this data frame will contain two columns and the 2nd colum will contain the ten values for each row.
now you need this information in a list. so we need to parse using list.parse3
instad of list.parse2
beacuse preserve names like name
or data
.
series <- list.parse3(mynewdata2)
so finally change:
hc_series(list(name="a",data=mydata$a),
list(name="b",data=mydata$b),
list(name="c",data=mydata$c))
by:
hc_add_series_list(series)
hope this is clear.
Source: stackoverflow.com
Related Query
- multiple series in Highcharter R stacked barchart
- Need stacked column chart with multiple series
- How could you supply multiple series to a line chart in R shiny using highcharter package and without hardcoding the series?
- Multiple time series in stacked column chart
- Drilldown to multiple series from different groups - Highcharter (in R)
- Stacked barchart in highcharter with molten data
- How to have multiple highcharts with different series data in vuejs without repeating code
- Highcharts: Stacked area drilldown to multiple series
- R Highcharter - highlight same group in multiple stacked columns chart + order groups in columns
- R Package Highcharter: How do I drilldown to multiple series stacked column graph?
- How to prevent my stacked series from being in reverse order?
- How to get multiple series data in tooltip highcharts?
- Highcharts - drill down to multiple series
- Displaying multiple series in the navigator of an HighStock chart
- Dynamic update of multiple series in highcharts
- highcharts - chart names for multiple pie chart series in one chart
- Highcharts Custom tooltips for multiple series
- How to get multiple data series into Highcharts
- Highcharts with JSON data and multiple series
- Highcharts - specifying order of stacked time series
- Highcharts: Conditional tooltip based on multiple series names (OR logic operator)
- Using HighCharts and DotNet.HighCharts to "Play" Multiple Series
- Creating multiple series in Highcharts within a loop
- Highcharter plotBands, plotLines with time series data
- Multiple series in HighStock charts
- Display multiple time series with rCharts hPlot
- Highcharts: update series on multiple charts with same data
- Single series drilldown to multiple series Highcharts
- Highcharts 3.0, area chart with stacked and unstacked series - how to fix?
- Highcharts/Highstock dynamically add/remove multiple series
More Query from same tag
- Referencing array values within nested objects/arrays
- Draw rectangle in the selection, Highcharts
- angular onChanges highcharts
- Time series horizontal bar chart for running queries visualization
- Just how flexible is highcharts? (Mockup attached.)
- Highcharts - Large Tree Map: Show values below points name
- How to horizontally align Highcharter objects in Distill article in R Markdown?
- Wait until an action ends before continuing execution of code
- Population pyramid for different regions in Highcharts
- Highcharts - Changing color of text if not enough room on bar graph
- Highcharts threshold background color from 100 y-axis
- Highcharts wind direction
- Updating fontsize with highcharts using zoomtype
- Highstock columnrange data grouping values not consistent
- Highchart Gantt chart Navigator color
- Highcharts modulo alternateGridColor
- How to hide "showInLegend" of Highcharts in angular 8.1?
- Why doesn't highcharts refresh this chart correctly?
- Highcharts: Moving yaxis label to the top left of chart
- highcharts no point markers but show single point or discontinous points
- Highcharts: how to highlight yAxis value?
- Highcharts.js cannot see graph line
- How to specify specific tick positions for highcharts when loading dynamic data?
- Highcharts add a Mean line to BoxPlot chart
- Remove Highcharts dataLabel border
- Highstock don't draw any
- Highcharts date-format changes with data
- Performance issue adding series through loop in Highcharts
- trouble embeding highcharts in a html php page
- highcharts column stack label