Same color element of the legend and the graph bubble
Posted: Thu Jun 08, 2023 7:15 pm
(Apologies for my English)
I use this R code to build a highcharts chart that I include in a report created with rmardown from RStudio.
But the color of the element of the legend does not correspond to the bubble of the chart.
I have detected that the order of the elements of the legend is affected by the stressed words, for example, "Málaga" is before "Murcia", however, it appears after. The same happens with "Córdoba" and "Coruña (A)". I think that HighCharts when sorting the legend elements does not take into account the latin characters but their unicode values.
Thanks for your help.
Greetings.
I use this R code to build a highcharts chart that I include in a report created with rmardown from RStudio.
Code: Select all
dfaus <- dfaus[order(dfaus$Municipio),]
hc <- dfaus %>%
hchart(
type = "scatter",
hcaes(
x = dfaus$`Esfuerzo Social por Habitante`,
y = dfaus$`Umbral Pobreza`,
size = dfaus$`Relevancia Esfuerzo Social` * 100,
group = dfaus$`Municipio`,
color = ifelse(dfaus$Municipio == "Murcia", "#C31A00", "#8673A1")
),
color = ifelse(dfaus$Municipio == "Murcia", "#C31A00", "#8673A1"),
tooltip = list(
valueDecimals = 2,
valueSuffix = " %"
)
)
But the color of the element of the legend does not correspond to the bubble of the chart.
I have detected that the order of the elements of the legend is affected by the stressed words, for example, "Málaga" is before "Murcia", however, it appears after. The same happens with "Córdoba" and "Coruña (A)". I think that HighCharts when sorting the legend elements does not take into account the latin characters but their unicode values.
Thanks for your help.
Greetings.