Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* @license Highcharts JS v11.4.8 (2024-08-29)
*
* (c) 2009-2024 Torstein Honsi
*
* License: www.highcharts.com/license
*/
(function (factory) {
if (typeof module === 'object' && module.exports) {
factory['default'] = factory;
module.exports = factory;
} else if (typeof define === 'function' && define.amd) {
define('highcharts/modules/draggable-points', ['highcharts'], function (Highcharts) {
factory(Highcharts);
factory.Highcharts = Highcharts;
return factory;
});
} else {
factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
}
}(function (Highcharts) {
'use strict';
var _modules = Highcharts ? Highcharts._modules : {};
function _registerModule(obj, path, args, fn) {
if (!obj.hasOwnProperty(path)) {
obj[path] = fn.apply(null, args);
if (typeof CustomEvent === 'function') {
Highcharts.win.dispatchEvent(new CustomEvent(
'HighchartsModuleLoaded',
{ detail: { path: path, module: obj[path] } }
));
}
}
}
_registerModule(_modules, 'Extensions/DraggablePoints/DragDropUtilities.js', [_modules['Core/Utilities.js']], function (U) {
/* *
*
* (c) 2009-2024 Highsoft AS
*
* Authors: Øystein Moseng, Torstein Hønsi, Jon A. Nygård
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
const { addEvent } = U;
/* *
*
* Functions
*
* */
/**
* Add multiple event listeners with the same handler to the same element.
*
* @private
* @function addEvents
* @param {T} el
* The element or object to add listeners to.
* @param {Array} types
* Array with the event types this handler should apply to.
* @param {Function|Highcharts.EventCallbackFunction} fn
* The function callback to execute when the events are fired.
* @param {Highcharts.EventOptionsObject} [options]
* Event options:
* - `order`: The order the event handler should be called. This opens
* for having one handler be called before another, independent of in
* which order they were added.
* @return {Function}
* A callback function to remove the added events.
* @template T
*/
function addEvents(el, types, fn, options) {
const removeFuncs = types.map((type) => addEvent(el, type, fn, options));
return function () {
for (const fn of removeFuncs) {
fn();
}
};
}
/**
* Utility function to count the number of props in an object.
*
* @private
* @function countProps
*
* @param {Object} obj
* The object to count.
*
* @return {number}
* Number of own properties on the object.
*/
function countProps(obj) {
return Object.keys(obj).length;
}
/**
* Utility function to get the value of the first prop of an object. (Note that
* the order of keys in an object is usually not guaranteed.)
*
* @private
* @function getFirstProp
* @param {Highcharts.Dictionary} obj
* The object to count.
* @return {T}
* Value of the first prop in the object.
* @template T
*/
function getFirstProp(obj) {
for (const p in obj) {
if (Object.hasOwnProperty.call(obj, p)) {
return obj[p];
}
}
}
/**
* Take a mouse/touch event and return the event object with chartX/chartY.
*
* @private
* @function getNormalizedEvent
* @param {global.PointerEvent} e
* The event to normalize.
* @param {Highcharts.Chart} chart
* The related chart.
* @return {Highcharts.PointerEventLObject}
* The normalized event.
*/
function getNormalizedEvent(e, chart) {
return (typeof e.chartX === 'undefined' ||
typeof e.chartY === 'undefined' ?
chart.pointer?.normalize(e) || e :
e);
}
/* *
*
* Default Export
*
* */
const DragDropUtilities = {
addEvents,
countProps,
getFirstProp,
getNormalizedEvent
};
return DragDropUtilities;
});
_registerModule(_modules, 'Extensions/DraggablePoints/DragDropDefaults.js', [], function () {
/* *
*
* (c) 2009-2024 Highsoft AS
*
* Authors: Øystein Moseng, Torstein Hønsi, Jon A. Nygård
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
/* *
*
* API Options
*
* */
/**
* The draggable-points module allows points to be moved around or modified in
* the chart. In addition to the options mentioned under the `dragDrop` API
* structure, the module fires three events,
* [point.dragStart](plotOptions.series.point.events.dragStart),
* [point.drag](plotOptions.series.point.events.drag) and
* [point.drop](plotOptions.series.point.events.drop).
*
* @sample {highcharts|highstock}
* highcharts/dragdrop/resize-column
* Draggable column and line series
* @sample {highcharts|highstock}
* highcharts/dragdrop/bar-series
* Draggable bar
* @sample {highcharts|highstock}
* highcharts/dragdrop/drag-bubble
* Draggable bubbles
* @sample {highcharts|highstock}
* highcharts/dragdrop/drag-xrange
* Draggable X range series
* @sample {highcharts|highstock}
* highcharts/dragdrop/undraggable-points
* Dragging disabled for specific points
* @sample {highmaps}
* maps/series/draggable-mappoint
* Draggable Map Point series
*
* @declare Highcharts.SeriesDragDropOptionsObject
* @since 6.2.0
* @requires modules/draggable-points
* @optionparent plotOptions.series.dragDrop
*/
const DragDropDefaults = {
/**
* Set the minimum X value the points can be moved to.
*
* @sample {gantt} gantt/dragdrop/drag-gantt
* Limit dragging
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Limit dragging
*
* @type {number}
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.dragMinX
*/
/**
* Set the maximum X value the points can be moved to.
*
* @sample {gantt} gantt/dragdrop/drag-gantt
* Limit dragging
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Limit dragging
*
* @type {number}
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.dragMaxX
*/
/**
* Set the minimum Y value the points can be moved to.
*
* @sample {gantt} gantt/dragdrop/drag-gantt
* Limit dragging
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Limit dragging
*
* @type {number}
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.dragMinY
*/
/**
* Set the maximum Y value the points can be moved to.
*
* @sample {gantt} gantt/dragdrop/drag-gantt
* Limit dragging
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Limit dragging
*
* @type {number}
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.dragMaxY
*/
/**
* The X precision value to drag to for this series. Set to 0 to disable. By
* default this is disabled, except for category axes, where the default is
* `1`.
*
* @type {number}
* @default 0
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.dragPrecisionX
*/
/**
* The Y precision value to drag to for this series. Set to 0 to disable. By
* default this is disabled, except for category axes, where the default is
* `1`.
*
* @type {number}
* @default 0
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.dragPrecisionY
*/
/**
* Enable dragging in the X dimension.
*
* @type {boolean}
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.draggableX
*/
/**
* Enable dragging in the Y dimension. Note that this is not supported for
* TreeGrid axes (the default axis type in Gantt charts).
*
* @type {boolean}
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.draggableY
*/
/**
* Group the points by a property. Points with the same property value will
* be grouped together when moving.
*
* @sample {gantt} gantt/dragdrop/drag-gantt
* Drag grouped points
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Drag grouped points
*
* @type {string}
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.groupBy
*/
/**
* Update points as they are dragged. If false, a guide box is drawn to
* illustrate the new point size.
*
* @sample {gantt} gantt/dragdrop/drag-gantt
* liveRedraw disabled
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* liveRedraw disabled
*
* @type {boolean}
* @default true
* @since 6.2.0
* @apioption plotOptions.series.dragDrop.liveRedraw
*/
/**
* Set a key to hold when dragging to zoom the chart. This is useful to
* avoid zooming while moving points. Should be set different than
* [chart.panKey](#chart.panKey).
*
* @type {string}
* @since 6.2.0
* @validvalue ["alt", "ctrl", "meta", "shift"]
* @deprecated
* @requires modules/draggable-points
* @apioption chart.zoomKey
*/
/**
* Callback that fires when starting to drag a point. The mouse event object
* is passed in as an argument. If a drag handle is used, `e.updateProp` is
* set to the data property being dragged. The `this` context is the point.
* See [drag and drop options](plotOptions.series.dragDrop).
*
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Drag events
*
* @type {Highcharts.PointDragStartCallbackFunction}
* @since 6.2.0
* @requires modules/draggable-points
* @apioption plotOptions.series.point.events.dragStart
*/
/**
* Callback that fires while dragging a point. The mouse event is passed in
* as parameter. The original data can be accessed from `e.origin`, and the
* new point values can be accessed from `e.newPoints`. If there is only a
* single point being updated, it can be accessed from `e.newPoint` for
* simplicity, and its ID can be accessed from `e.newPointId`. The `this`
* context is the point being dragged. To stop the default drag action,
* return false. See [drag and drop options](plotOptions.series.dragDrop).
*
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Drag events
* @sample {highcharts|highstock} highcharts/dragdrop/undraggable-points
* Dragging disabled for specific points
*
* @type {Highcharts.PointDragCallbackFunction}
* @since 6.2.0
* @requires modules/draggable-points
* @apioption plotOptions.series.point.events.drag
*/
/**
* Callback that fires when the point is dropped. The parameters passed are
* the same as for [drag](#plotOptions.series.point.events.drag). To stop
* the default drop action, return false. See
* [drag and drop options](plotOptions.series.dragDrop).
*
* @sample {highcharts} highcharts/dragdrop/drag-xrange
* Drag events
* @sample {highcharts|highstock} highcharts/dragdrop/undraggable-points
* Dragging disabled for specific points
*
* @type {Highcharts.PointDropCallbackFunction}
* @since 6.2.0
* @requires modules/draggable-points
* @apioption plotOptions.series.point.events.drop
*/
/**
* Point specific options for the draggable-points module. Overrides options
* on `series.dragDrop`.
*
* @declare Highcharts.SeriesLineDataDragDropOptions
* @extends plotOptions.series.dragDrop
* @since 6.2.0
* @requires modules/draggable-points
* @apioption series.line.data.dragDrop
*/
/**
* The amount of pixels to drag the pointer before it counts as a drag
* operation. This prevents drag/drop to fire when just clicking or
* selecting points.
*
* @type {number}
* @default 2
* @since 6.2.0
*/
dragSensitivity: 2,
/**
* Options for the drag handles available in column series.
*
* @declare Highcharts.DragDropHandleOptionsObject
* @since 6.2.0
* @optionparent plotOptions.column.dragDrop.dragHandle
*/
dragHandle: {
/**
* Function to define the SVG path to use for the drag handles. Takes
* the point as argument. Should return an SVG path in array format. The
* SVG path is automatically positioned on the point.
*
* @type {Function}
* @since 6.2.0
* @apioption plotOptions.column.dragDrop.dragHandle.pathFormatter
*/
// pathFormatter: null,
/**
* The mouse cursor to use for the drag handles. By default this is
* intelligently switching between `ew-resize` and `ns-resize` depending on
* the direction the point is being dragged.
*
* @type {string}
* @since 6.2.0
* @apioption plotOptions.column.dragDrop.dragHandle.cursor
*/
// cursor: null,
/**
* The class name of the drag handles. Defaults to `highcharts-drag-handle`.
*
* @since 6.2.0
*/
className: 'highcharts-drag-handle',
/**
* The fill color of the drag handles.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
* @since 6.2.0
*/
color: '#fff',
/**
* The line color of the drag handles.
*
* @type {Highcharts.ColorString}
* @since 6.2.0
*/
lineColor: 'rgba(0, 0, 0, 0.6)',
/**
* The line width for the drag handles.
*
* @since 6.2.0
*/
lineWidth: 1,
/**
* The z index for the drag handles.
*
* @since 6.2.0
*/
zIndex: 901
},
/**
* Style options for the guide box. The guide box has one state by default,
* the `default` state.
*
* @declare Highcharts.PlotOptionsSeriesDragDropGuideBoxOptions
* @since 6.2.0
* @type {Highcharts.Dictionary}
*/
guideBox: {
/**
* Style options for the guide box default state.
*
* @declare Highcharts.DragDropGuideBoxOptionsObject
* @since 6.2.0
*/
'default': {
/**
* CSS class name of the guide box in this state. Defaults to
* `highcharts-drag-box-default`.
*
* @since 6.2.0
*/
className: 'highcharts-drag-box-default',
/**
* Width of the line around the guide box.
*
* @since 6.2.0
*/
lineWidth: 1,
/**
* Color of the border around the guide box.
*
* @type {Highcharts.ColorString}
* @since 6.2.0
*/
lineColor: '#888',
/**
* Guide box fill color.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
* @since 6.2.0
*/
color: 'rgba(0, 0, 0, 0.1)',
/**
* Guide box cursor.
*
* @since 6.2.0
*/
cursor: 'move',
/**
* Guide box zIndex.
*
* @since 6.2.0
*/
zIndex: 900
}
}
};
/* *
*
* Default Export
*
* */
return DragDropDefaults;
});
_registerModule(_modules, 'Extensions/DraggablePoints/DraggableChart.js', [_modules['Core/Animation/AnimationUtilities.js'], _modules['Extensions/DraggablePoints/DragDropUtilities.js'], _modules['Extensions/DraggablePoints/DragDropDefaults.js'], _modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (A, DDU, DragDropDefaults, H, U) {
/* *
*
* (c) 2009-2024 Highsoft AS
*
* Authors: Øystein Moseng, Torstein Hønsi, Jon A. Nygård
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
const { animObject } = A;
const { addEvents, countProps, getFirstProp, getNormalizedEvent } = DDU;
const { doc } = H;
const { addEvent, merge, pick } = U;
/* *
*
* Functions
*
* */
/**
* Add events to document and chart if the chart is draggable.
*
* @private
* @function addDragDropEvents
* @param {Highcharts.Chart} chart
* The chart to add events to.
*/
function addDragDropEvents(chart) {
const container = chart.container;
// Only enable if we have a draggable chart
if (isChartDraggable(chart)) {
addEvents(container, ['mousedown', 'touchstart'], (e) => {
mouseDown(getNormalizedEvent(e, chart), chart);
});
addEvents(container, ['mousemove', 'touchmove'], (e) => {
mouseMove(getNormalizedEvent(e, chart), chart);
}, {
passive: false
});
addEvent(container, 'mouseleave', (e) => {
mouseUp(getNormalizedEvent(e, chart), chart);
});
chart.unbindDragDropMouseUp = addEvents(doc, ['mouseup', 'touchend'], (e) => {
mouseUp(getNormalizedEvent(e, chart), chart);
}, {
passive: false
});
// Add flag to avoid doing this again
chart.hasAddedDragDropEvents = true;
// Add cleanup to make sure we don't pollute document
addEvent(chart, 'destroy', () => {
if (chart.unbindDragDropMouseUp) {
chart.unbindDragDropMouseUp();
}
});
}
}
/**
* Remove the chart's drag handles if they exist.
*
* @private
* @function Highcharts.Chart#hideDragHandles
*/
function chartHideDragHandles() {
const chart = this, dragHandles = (chart.dragHandles || {});
if (dragHandles) {
for (const key of Object.keys(dragHandles)) {
if (dragHandles[key].destroy) {
dragHandles[key].destroy();
}
}
delete chart.dragHandles;
}
}
/**
* Set the state of the guide box.
*
* @private
* @function Highcharts.Chart#setGuideBoxState
* @param {string} state
* The state to set the guide box to.
* @param {Highcharts.Dictionary} [options]
* Additional overall guideBox options to consider.
* @return {Highcharts.SVGElement}
* The modified guide box.
*/
function chartSetGuideBoxState(state, options) {
const guideBox = this.dragGuideBox, guideBoxOptions = merge(DragDropDefaults.guideBox, options), stateOptions = merge(guideBoxOptions['default'], // eslint-disable-line dot-notation
guideBoxOptions[state]);
return guideBox
.attr({
'class': stateOptions.className,
stroke: stateOptions.lineColor,
strokeWidth: stateOptions.lineWidth,
fill: stateOptions.color,
cursor: stateOptions.cursor,
zIndex: stateOptions.zIndex
})
// Use pointerEvents 'none' to avoid capturing the click event
.css({ pointerEvents: 'none' });
}
/**
* Check whether the zoomKey or panKey is pressed.
*
* @private
* @function zoomOrPanKeyPressed
* @param {global.Event} e
* A mouse event.
* @return {boolean}
* True if the zoom or pan keys are pressed. False otherwise.
*/
function chartZoomOrPanKeyPressed(e) {
// Check whether the panKey and zoomKey are set in chart.userOptions
const chart = this, chartOptions = chart.options.chart || {}, panKey = chartOptions.panKey && chartOptions.panKey + 'Key', zoomKey = chart.zooming.key && chart.zooming.key + 'Key';
return (e[zoomKey] || e[panKey]);
}
/**
* Composes the chart class with essential functions to support draggable
* points.
*
* @private
* @function compose
*
* @param {Highcharts.Chart} ChartClass
* Class constructor of chart.
*/
function compose(ChartClass) {
const chartProto = ChartClass.prototype;
if (!chartProto.hideDragHandles) {
chartProto.hideDragHandles = chartHideDragHandles;
chartProto.setGuideBoxState = chartSetGuideBoxState;
chartProto.zoomOrPanKeyPressed = chartZoomOrPanKeyPressed;
addEvent(ChartClass, 'render', onChartRender);
}
}
/**
* Default mouse move handler while dragging. Handles updating points or guide
* box.
*
* @private
* @function dragMove
* @param {Highcharts.PointerEventObject} e
* The mouse move event.
* @param {Highcharts.Point} point
* The point that is dragged.
*/
function dragMove(e, point) {
const series = point.series, chart = series.chart, data = chart.dragDropData, options = merge(series.options.dragDrop, point.options.dragDrop), draggableX = options.draggableX, draggableY = options.draggableY, origin = data.origin, updateProp = data.updateProp;
let dX = e.chartX - origin.chartX, dY = e.chartY - origin.chartY;
const oldDx = dX;
// Handle inverted
if (chart.inverted) {
dX = -dY;
dY = -oldDx;
}
// If we have liveRedraw enabled, update the points immediately. Otherwise
// update the guideBox.
if (pick(options.liveRedraw, true)) {
updatePoints(chart, false);
// Update drag handles
point.showDragHandles();
}
else {
// No live redraw, update guide box
if (updateProp) {
// We are resizing, so resize the guide box
resizeGuideBox(point, dX, dY);
}
else {
// We are moving, so move the guide box
chart.dragGuideBox.translate(draggableX ? dX : 0, draggableY ? dY : 0);
}
}
// Update stored previous dX/Y
origin.prevdX = dX;
origin.prevdY = dY;
}
/**
* Flip a side property, used with resizeRect. If input side is "left", return
* "right" etc.
*
* @private
* @function flipResizeSide
*
* @param {string} side
* Side prop to flip. Can be `left`, `right`, `top` or `bottom`.
*
* @return {"bottom"|"left"|"right"|"top"|undefined}
* The flipped side.
*/
function flipResizeSide(side) {
return {
left: 'right',
right: 'left',
top: 'bottom',
bottom: 'top'
}[side];
}
/**
* Get a list of points that are grouped with this point. If only one point is
* in the group, that point is returned by itself in an array.
*
* @private
* @function getGroupedPoints
* @param {Highcharts.Point} point
* Point to find group from.
* @return {Array}
* Array of points in this group.
*/
function getGroupedPoints(point) {
const series = point.series, data = series.options.data || [], groupKey = series.options.dragDrop.groupBy;
let points = [];
if (series.boosted) { // #11156
for (let i = 0, iEnd = data.length; i < iEnd; ++i) {
points.push(new series.pointClass(// eslint-disable-line new-cap
series, data[i]));
points[points.length - 1].index = i;
}
}
else {
points = series.points;
}
return point.options[groupKey] ?
// If we have a grouping option, filter the points by that
points.filter((comparePoint) => (comparePoint.options[groupKey] ===
point.options[groupKey])) :
// Otherwise return the point by itself only
[point];
}
/**
* Calculate new point options from points being dragged.
*
* @private
* @function getNewPoints
*
* @param {Object} dragDropData
* A chart's dragDropData with drag/drop origin information, and info on
* which points are being dragged.
*
* @param {Highcharts.PointerEventObject} newPos
* Event with the new position of the mouse (chartX/Y properties).
*
* @return {Highchats.Dictionary