-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hc_add_theme() works differently with hchart() and highchart() #302
Comments
Hi @dpprdan Indeed,
About the theme: I'm agree with this can look like a bug. The issue is that You can force the markers using hc_hchart <- citytemp %>%
select(-new_york,-london) %>%
gather(city, temp, tokyo, berlin) %>%
hchart("line",
hcaes(x = int, y = temp, group = city)
)
thm <- hc_theme(
chart = list(backgroundColor = "#eeeeee"),
plotOptions = list(
series = list(
marker = list(enabled = TRUE)
)
)
)
hc_hchart %>%
hc_add_theme(thm) %>%
hc_plotOptions(
series = list(
marker = list(enabled = TRUE)
)
) Finally I think a good approach would be use Regards, |
Thanks @jbkunst! I was aware of the differences between Your design choices are your prerogative of course. That being said, my perspective on this is the following: No markers as a default is not a bad choice, but for consistency it should be the same (or at least be transparent) across both plotting functions. The real problem is, however, that essentially How about making the default theme more transparent, i.e. separate content from visualisation more, and make it possible to override it? I am pretty new to highcharts and Another way to look at the problem (and a bit puzzling to me), is that |
hc_add_theme()
works differently with hchart()
and highchart()
hc_add_theme()
works differently with hchart()
and highchart()
Thanks to you @dpprdan I think you're right, It's better maintain the highcharts defautls. So I will delete the part wich set the markers to false in the line chart as you mention in the last part. |
Thanks @jbkunst! Maybe you can give my idea regarding a default theme another thought as well? Unfortunately I think I found a similar issue, though this time not directly theme-related:
to
Apparently it is not possible to disable markers with |
Hi @dpprdan, I removed the hc_plotOptions in the highchart() %>%
hc_xAxis(categories = citytemp$int) %>%
hc_add_series(name = "Berlin", data = citytemp$berlin) %>%
hc_add_series(name = "Tokyo", data = citytemp$tokyo)
highchart() %>%
hc_xAxis(categories = citytemp$int) %>%
hc_add_series(citytemp2, "line", hcaes(x = int, y = temp, group = city))
hchart(citytemp2, "line", hcaes(x = int, y = temp, group = city)) I don't have the |
I tried to install highcharter from github with
So I cannot test at the moment.
|
That's weird, Not sure what could it be. I run the ( |
Sorry, my fault. I had highcharter loaded in another R session, that's why the update failed. The df_area chart works fine with regard to the markers (note that my chart example as such does not make a lot of sense, because it is not stacked - so it really is a minimal working example). For the line charts the markers and themes work nicely. However, the two graphs differ with respect to the axis labels (which is as expected and fine) but also with respect to the x-axis tick marks (between the integer labels with |
See the updated version of http://rpubs.com/jbkunst/271521. Compare: highchart() %>%
hc_xAxis(categories = citytemp$int) %>%
hc_add_series(citytemp2, "line", hcaes(x = int, y = temp, group = city)) with highchart() %>%
hc_xAxis(categories = citytemp$int) %>%
hc_add_series(citytemp2, "line", hcaes(x = as.character(int), y = temp, group = city)) The effect is that
|
Thanks for your explanation (and sorry for the delay)!
The only different chart is this
See http://rpubs.com/dpprdan/273485 for a bit more elaboration. |
Hi @dpprdan , Soory for the delay! I posted some rpubs to show why the result in every chart http://rpubs.com/jbkunst/301558 , tell me if this is clearer. I will close the issue but you/we can reopen if is needed ;)! Thanks. |
hchart()
andhighchart()
seem to have different default chart layouts. This is a problem if one wants to combine different graphs with both methods on one page and also introduces a bug in the handling of themes inhchart
(see below).To illustrate, let's start with a simple
highchart()
example:The resulting graph on my system:
Now this should give the same chart with hchart() (yes, the resulting objects differ, but the graph layout should still be the same, IMHO):
Notice the missing markers and the different tickmarks on the x-axis. Also the number of tick-labels on the x-axis are reduced (and this is not due to the sightly reduced space due to the y-axis label).
In addition, it is not possible to add the markers via a theme to the
hchart()
object.Notice the grey background, but missing markers.
Now let's see whether the code works with the
highchart()
object. (I disable the markers in the theme now, since they are enabled by default).The text was updated successfully, but these errors were encountered: