-
Notifications
You must be signed in to change notification settings - Fork 26
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
Overriding default Highcharts options #6
Comments
Ok, you make valid points as usual @sorin-davidoi. Would you mind making a pull request for this? If not I'll resolve it by the next release a week or 2 from now. |
Unfortunately, I do not have the time to undertake this right now. The underlying issue here seems to be whether we want to provide API compatibility with Highcharts. If this is the case, there are some other things to consider. Firstly, there is no way to set Let's consider the current workflow for porting from using Highcharts natively to using this element:
I think that an ideal workflow would be:
This enables full access to the Highharts API and is straightforward to use. Regarding implementation, we could use deep observers to update the chart. It could look something like this: properties: {
config: { type: Object }
},
observers: [
'_configChanged(config.*)'
],
_configChanged: function(config) {
// Use config.path to figure out what changed and
// call the corresponding function in handleChange
const handleChange = {
'config.title': function(title) { this.chart.setTitle(title); }
}
} What do you think? |
@avdaredevil you can recall when I suggested that you expose the series object to allow us ability to directly add a multi-series data to the chart? This is also because I'm coming from the Highchart full persepective. I also ran into a use-case where I need to hook into an event of the chart, but your api doesn't seem to allow that. All these make it "no so easy" for people who are familiar with the normal highcharts who want to retain their chart config. I noticed that you've updated the plugin: I can easily add a multiple series data via the data attribute. Kudos! |
I completely agree with both of you @sorin-davidoi @peterchibunna. I like the idea of leveraging deep observers for this (in fact it's pobably the best way). What I do have a problem with, is that this is not an ideal way to use an element with Polymer. I do realize that even after focusing extensively on user experience, advanced users of Highcharts like yourselves will want more from the element than it can do declaratively (as custom programming can go a very long way). In lieu of that, I will draft up a fourth element Is this reasonable? |
I will release this element with the public release of Highcharts 5.0.0 as a |
Update: In terms of |
…to match and work with v5, plotOptions and chartOptions now work with the appropriate, bindings added to zoom, legend options, tooltip options, highchart options, exporting, credits, colorByPoint, removed extraneous properties like legendPos, legendValign, etc. setData updated to also accept a singular object that defines series 1, added getSeries/zoomOut as a function... Ping #6, #14, #13
Overriding default options seems counterintuitive.
Consider people moving from using Highcharts directly to using this element. They will copy-paste their configuration and expect the chart to look the same, since it is the same configuration. However, they will now have to hunt down the options that have been overwritten, both in the documentation of this element (to find out what has been overwritten) and in Highcharts' documentation, to figure out what was the original default value.
This also make it difficult for people which are already familiar with the Highcharts API, since they are familiar with the default values, and will have to go through the same process.
A really unintuitive example is the legend: it is vertical by default, in contrast to horizontal in Highcharts. Setting
legend-position
to{ align: 'center', verticalAlign: 'bottom', layout: 'horizontal' }
is not enough, since we also have to setlegend-pos
to{ x: 0, y: 0 }
.The text was updated successfully, but these errors were encountered: