Skip to content

Commit

Permalink
v11.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
TorsteinHonsi committed Aug 29, 2024
1 parent 8c9d698 commit 99133f6
Show file tree
Hide file tree
Showing 329 changed files with 1,963 additions and 1,243 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "highcharts",
"version": "11.4.7",
"version": "11.4.8",
"main": "highcharts.js",
"license": "https://www.highcharts.com/license",
"types": "highcharts.d.ts"
Expand Down
18 changes: 15 additions & 3 deletions es-modules/Accessibility/Accessibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class Accessibility {
*/
function chartUpdateA11yEnabled() {
let a11y = this.accessibility;
const accessibilityOptions = this.options.accessibility;
const accessibilityOptions = this.options.accessibility, svg = this.renderer.boxWrapper.element, title = this.title;
if (accessibilityOptions && accessibilityOptions.enabled) {
if (a11y && !a11y.zombie) {
a11y.update();
Expand All @@ -297,6 +297,10 @@ class Accessibility {
if (a11y && !a11y.zombie) {
a11y.update();
}
// If a11y has been disabled, and is now enabled
if (svg.getAttribute('role') === 'img') {
svg.removeAttribute('role');
}
}
}
else if (a11y) {
Expand All @@ -307,8 +311,16 @@ class Accessibility {
delete this.accessibility;
}
else {
// Just hide container
this.renderTo.setAttribute('aria-hidden', true);
// If a11y has been disabled dynamically or is disabled
this.renderTo.setAttribute('role', 'img');
this.renderTo.setAttribute('aria-hidden', false);
this.renderTo.setAttribute('aria-label', ((title && title.element.textContent) || '').replace(/</g, '&lt;'));
svg.setAttribute('aria-hidden', true);
const description = document.getElementsByClassName('highcharts-description')[0];
if (description) {
description.setAttribute('aria-hidden', false);
description.classList.remove('highcharts-linked-description');
}
}
}
/**
Expand Down
68 changes: 38 additions & 30 deletions es-modules/Accessibility/AccessibilityComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import DOMElementProvider from './Utils/DOMElementProvider.js';
import EventProvider from './Utils/EventProvider.js';
import HU from './Utils/HTMLUtilities.js';
const { getFakeMouseEvent } = HU;
import U from '../Core/Utilities.js';
const { extend } = U;
/* *
*
* Class
Expand All @@ -29,8 +27,8 @@ const { extend } = U;
* create a custom accessibility component for a chart.
*
* Components should take care to destroy added elements and unregister event
* handlers on destroy. This is handled automatically if using this.addEvent and
* this.createElement.
* handlers on destroy. This is handled automatically if using `this.addEvent`
* and `this.createElement`.
*
* @sample highcharts/accessibility/custom-component
* Custom accessibility component
Expand All @@ -45,6 +43,41 @@ class AccessibilityComponent {
* Functions
*
* */
/**
* Called when accessibility is disabled or chart is destroyed.
*
* @function Highcharts.AccessibilityComponent#destroy
*/
destroy() { }
/**
* Get keyboard navigation handler for this component.
*
* @function Highcharts.AccessibilityComponent#getKeyboardNavigation
* @return {Highcharts.KeyboardNavigationHandler|Array<Highcharts.KeyboardNavigationHandler>}
* The keyboard navigation handler(s) for this component.
*/
getKeyboardNavigation() {
return [];
}
/**
* Called on component initialization.
*
* @function Highcharts.AccessibilityComponent#init
*/
init() { }
/**
* Called on every chart render.
*
* @function Highcharts.AccessibilityComponent#onChartRender
*/
onChartRender() { }
/**
* Called on updates to the chart, including options changes.
* Note that this is also called on first render of chart.
*
* @function Highcharts.AccessibilityComponent#onChartUpdate
*/
onChartUpdate() { }
/**
* Initialize the class
* @private
Expand Down Expand Up @@ -91,6 +124,7 @@ class AccessibilityComponent {
/**
* Fire a fake click event on an element. It is useful to have this on
* AccessibilityComponent for users of custom components.
* @private
*/
fakeClickEvent(el) {
const fakeEvent = getFakeMouseEvent('click');
Expand All @@ -105,32 +139,6 @@ class AccessibilityComponent {
this.eventProvider.removeAddedEvents();
}
}
extend(AccessibilityComponent.prototype,
/** @lends Highcharts.AccessibilityComponent */
{
/**
* Called on component initialization.
*/
init() { },
/**
* Get keyboard navigation handler for this component.
* @private
*/
getKeyboardNavigation: function () { },
/**
* Called on updates to the chart, including options changes.
* Note that this is also called on first render of chart.
*/
onChartUpdate() { },
/**
* Called on every chart render.
*/
onChartRender() { },
/**
* Called when accessibility is disabled or chart is destroyed.
*/
destroy() { }
});
/* *
*
* Default Export
Expand Down
27 changes: 15 additions & 12 deletions es-modules/Core/Axis/Axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ class Axis {
* @type {Highcharts.AxisOptions}
*/
axis.setOptions(userOptions);
const options = this.options, labelsOptions = options.labels, type = options.type;
const options = axis.options, labelsOptions = options.labels;
// Set the type and fire an event
axis.type ?? (axis.type = options.type || 'linear');
axis.uniqueNames ?? (axis.uniqueNames = options.uniqueNames ?? true);
fireEvent(axis, 'afterSetType');
/**
* User's options for this axis without defaults.
*
Expand All @@ -170,7 +174,7 @@ class Axis {
axis.visible = options.visible;
axis.zoomEnabled = options.zoomEnabled;
// Initial categories
axis.hasNames = type === 'category' || options.categories === true;
axis.hasNames = this.type === 'category' || options.categories === true;
/**
* If categories are present for the axis, names are used instead of
* numbers for that axis.
Expand Down Expand Up @@ -543,7 +547,7 @@ class Axis {
* @param {number} value
* A value in terms of axis units.
*
* @param {boolean} paneCoordinates
* @param {boolean} [paneCoordinates=false]
* Whether to return the pixel coordinate relative to the chart or just the
* axis/pane itself.
*
Expand Down Expand Up @@ -618,7 +622,7 @@ class Axis {
translatedValue = pick(translatedValue, axis.translate(value, void 0, void 0, old));
// Keep the translated value within sane bounds, and avoid Infinity
// to fail the isNumber test (#7709).
translatedValue = clamp(translatedValue, -1e5, 1e5);
translatedValue = clamp(translatedValue, -1e9, 1e9);
x1 = x2 = translatedValue + transB;
y1 = y2 = cHeight - translatedValue - transB;
if (!isNumber(translatedValue)) { // No min or max
Expand Down Expand Up @@ -893,7 +897,7 @@ class Axis {
let nameX = point.options.x, x;
point.series.requireSorting = false;
if (!defined(nameX)) {
nameX = this.options.uniqueNames && names ?
nameX = this.uniqueNames && names ?
(explicitCategories ?
names.indexOf(point.name) :
pick(names.keys[point.name], -1)) :
Expand Down Expand Up @@ -1079,7 +1083,7 @@ class Axis {
linkedParentExtremes = linkedParent.getExtremes();
axis.min = pick(linkedParentExtremes.min, linkedParentExtremes.dataMin);
axis.max = pick(linkedParentExtremes.max, linkedParentExtremes.dataMax);
if (options.type !== linkedParent.options.type) {
if (this.type !== linkedParent.type) {
// Can't link axes of different type
error(11, true, chart);
}
Expand Down Expand Up @@ -1286,12 +1290,6 @@ class Axis {
this.tickmarkOffset = (this.categories &&
options.tickmarkPlacement === 'between' &&
this.tickInterval === 1) ? 0.5 : 0; // #3202
// Get minorTickInterval
this.minorTickInterval =
minorTickIntervalOption === 'auto' &&
this.tickInterval ?
this.tickInterval / options.minorTicksPerMajor :
minorTickIntervalOption;
// When there is only one point, or all points have the same value on
// this axis, then min and max are equal and tickPositions.length is 0
// or 1. In this case, add some padding in order to center the point,
Expand Down Expand Up @@ -1379,6 +1377,11 @@ class Axis {
}
}
this.tickPositions = tickPositions;
// Get minorTickInterval
this.minorTickInterval =
minorTickIntervalOption === 'auto' && this.tickInterval ?
this.tickInterval / options.minorTicksPerMajor :
minorTickIntervalOption;
// Reset min/max or remove extremes based on start/end on tick
this.paddedTicks = tickPositions.slice(0); // Used for logarithmic minor
this.trimTicks(tickPositions, startOnTick, endOnTick);
Expand Down
6 changes: 4 additions & 2 deletions es-modules/Core/Axis/AxisDefaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -1958,9 +1958,10 @@ var AxisDefaults;
* Logarithmic with extension to emulate negative values
*
* @type {Highcharts.AxisTypeValue}
* @default linear
* @product highcharts gantt
* @apioption xAxis.type
*/
type: 'linear',
/**
* If there are multiple axes on the same side of the chart, the pixel
* margin between the axes. Defaults to 0 on vertical axes, 15 on
Expand All @@ -1986,8 +1987,9 @@ var AxisDefaults;
*
* @since 4.2.7
* @product highcharts gantt
* @type {boolean}
* @default true
*/
uniqueNames: true,
/**
* Datetime axis only. An array determining what time intervals the
* ticks are allowed to fall on. Each array item is an array where the
Expand Down
6 changes: 3 additions & 3 deletions es-modules/Core/Axis/DateTimeAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var DateTimeAxis;
AxisClass.keepProps.push('dateTime');
const axisProto = AxisClass.prototype;
axisProto.getTimeTicks = getTimeTicks;
addEvent(AxisClass, 'afterSetOptions', onAfterSetOptions);
addEvent(AxisClass, 'afterSetType', onAfterSetType);
}
return AxisClass;
}
Expand All @@ -63,8 +63,8 @@ var DateTimeAxis;
/**
* @private
*/
function onAfterSetOptions() {
if (this.options.type !== 'datetime') {
function onAfterSetType() {
if (this.type !== 'datetime') {
this.dateTime = void 0;
return;
}
Expand Down
4 changes: 2 additions & 2 deletions es-modules/Core/Axis/GridAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function getMaxLabelDimensions(ticks, tickPositions) {
}
});
// For tree grid, add indentation
if (this.options.type === 'treegrid' &&
if (this.type === 'treegrid' &&
this.treeGrid &&
this.treeGrid.mapOfPosToGridNode) {
const treeDepth = this.treeGrid.mapOfPosToGridNode[-1].height || 0;
Expand Down Expand Up @@ -465,7 +465,7 @@ function onAfterSetAxisTranslation() {
else {
// Don't trim ticks which not in min/max range but
// they are still in the min/max plus tickInterval.
if (this.options.type !== 'treegrid' &&
if (this.type !== 'treegrid' &&
axis.grid &&
axis.grid.columns) {
this.minPointOffset = this.tickInterval;
Expand Down
15 changes: 5 additions & 10 deletions es-modules/Core/Axis/LogarithmicAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var LogarithmicAxis;
function compose(AxisClass) {
if (!AxisClass.keepProps.includes('logarithmic')) {
AxisClass.keepProps.push('logarithmic');
addEvent(AxisClass, 'init', onInit);
addEvent(AxisClass, 'afterSetType', onAfterSetType);
addEvent(AxisClass, 'afterInit', onAfterInit);
}
return AxisClass;
Expand All @@ -46,17 +46,12 @@ var LogarithmicAxis;
/**
* @private
*/
function onInit(e) {
const axis = this;
const options = e.userOptions;
let logarithmic = axis.logarithmic;
if (options.type !== 'logarithmic') {
axis.logarithmic = void 0;
function onAfterSetType() {
if (this.type !== 'logarithmic') {
this.logarithmic = void 0;
}
else {
if (!logarithmic) {
logarithmic = axis.logarithmic = new Additions(axis);
}
this.logarithmic ?? (this.logarithmic = new Additions(this));
}
}
/**
Expand Down
Loading

0 comments on commit 99133f6

Please sign in to comment.