-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Enhancement: Chart.getOptions function #15904
Conversation
Preparation for #15880
File size comparisonSizes for compiled+gzipped (bold) and compiled files.
|
Visual test results - All diffing samples already approvedSamples changed
|
Do you expect any issues with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work! Just a two minor questions.
PS: Since there's a change in indexing in Stock (navigator is the last one), do we need an "Upgrade notes" part?
Ready for merge, pending CI |
Added new function, Chart.getOptions(), to get the current active configuration options for the chart.
Upgrade notes
For Highcharts Stock, the ordering of series and axes in the
chart.series
,chart.xAxis
,chart.yAxis
andchart.axes
arrays were changed. Previously the navigator series and axes were last of the initial items, and when adding items they were appended. From now on, the internal navigator series and axes are always last, so the index of items now corresponds to that of the current options.Some refactoring was made
chart
user options are now kept in sync with series and axis user options, so thatchart.xAxis[0].userOptions === chart.userOptions.xAxis[0]
. If that is not the case, for example it is broken after an update, it should be considered a bug.chart.xAxis
andchart.yAxis
so that the indexing of the axes corresponds to that of the options.To do (critical, better to land fast)
chart.options
.cleanRecursive
with the Responsive module'sgetCurrent
function.getOptions
function (POC in studies)diffObjects
onchart.options
(orchart.userOptions
?) compared todefaultOptions
.chart.options.yAxis
andxAxis
. Reconsider that. Tests need to be changed, but are there other consequences of removing them?getOptions
To do (non critical, can wait)
getOptions
shoulddeepEqual
the initial options, possibly except some internal, unharmful modifications to the options. And except items that can be objects or arrays, likeseries
,xAxis
andyAxis
. These should be in array form ingetOptions
.colorAxis
on top level. Currently settingcolorAxis: {}
enables the color axis. Test how themes withcolorAxis
defined affects charts. It may be that this needs to be changed altogether, for example by requiringcolorAxis: { enabled: true }
.Highcharts.setOptions
currently modifyingdefaultOptions
, making it unusable for identifying the actual user options. We need a new property storing the default default options (factoryDefaults
?).getOptions
in the exporting module? Low gain, high risk. Probably now worth it.userOptions
. The original intention of this property was to distinguish between actual user options and default options. But there has been an inflation in its usage. In most cases it could simply be replaced byoptions
, that should always be up to date. In other cases, we can usecleanRecursive
to find out whether an option is set by the user or not. For complex objects, like axes and series, theoptions
are built in multi-level merges. In those cases, we probably need to split the merge so that it is possible to built a composite default options object to be able to diff out the user options.userOptions
inside thetooltip.options
. Should be refactored.