I recently discovered highcharts, and I really like the dynamic aspect of the pie charts. However, I am having trouble finding a good way to group my charts together. The code below is investigating gaming console distribution per gender, and I would like all 3 pie charts to be aligned, with a larger pie chart above them that breaks down total console distribution, but I am unable to find anything that works.
# For larger platform pie chart
platform <- gaming_survey %>%
count(Platform, sort = TRUE) %>%
rename(Count = n)
# For gender based pie charts
platform_gender <- gaming_survey %>%
count(Platform, Gender, sort = TRUE) %>%
rename(Count = n)
# The 4 pie charts I am trying to group into one display
platform %>%
hchart('pie', hcaes(x = Platform, y = Count)) %>%
hc_title(text = 'Gaming Platform Distribution',
style = list(fontSize = '30px'),
align = 'center') %>%
hc_tooltip(pointFormat = '<b>Total:</b> {point.y} <br>
<b>Percentage</b> {point.percentage:,.1f}%') %>%
hc_credits(
enabled = TRUE,
text = 'Source: <em>Online Gaming Anxiety Data </em> || Kaggle.com',
style = list(fontSize = '15px', color = 'black',type = 'spline')
)
platform_gender %>%
subset(Gender == 'Female', select = c(Platform, Count)) %>%
hchart('pie', hcaes(x = Platform, y = Count)) %>%
hc_title(text = 'Female Platform Distribution',
style = list(fontSize = '30px'),
align = 'center') %>%
hc_tooltip(pointFormat = '<b>Total:</b> {point.y} <br>
<b>Percentage</b> {point.percentage:,.1f}%') %>%
hc_credits(
enabled = TRUE,
text = 'Source: <em>Online Gaming Anxiety Data </em> || Kaggle.com',
style = list(fontSize = '15px', color = 'black',type = 'spline')
)
platform_gender %>%
subset(Gender == 'Male', select = c(Platform, Count)) %>%
hchart('pie', hcaes(x = Platform, y = Count)) %>%
hc_title(text = 'Male Platform Distribution',
style = list(fontSize = '30px'),
align = 'center') %>%
hc_tooltip(pointFormat = '<b>Total:</b> {point.y} <br>
<b>Percentage</b> {point.percentage:,.1f}%') %>%
hc_credits(
enabled = TRUE,
text = 'Source: <em>Online Gaming Anxiety Data </em> || Kaggle.com',
style = list(fontSize = '15px', color = 'black',type = 'spline')
)
platform_gender %>%
subset(Gender == 'Other', select = c(Platform, Count)) %>%
hchart('pie', hcaes(x = Platform, y = Count)) %>%
hc_title(text = 'Other Platform Distribution',
style = list(fontSize = '30px'),
align = 'center') %>%
hc_tooltip(pointFormat = '<b>Total:</b> {point.y} <br>
<b>Percentage</b> {point.percentage:,.1f}%') %>%
hc_credits(
enabled = TRUE,
text = 'Source: <em>Online Gaming Anxiety Data </em> || Kaggle.com',
style = list(fontSize = '15px', color = 'black',type = 'spline')
)
I am very new R, so forgive me if I am using any confusing wording. Thanks.