212 lines
6.3 KiB
JavaScript
212 lines
6.3 KiB
JavaScript
/* *
|
|
*
|
|
* X-range series module
|
|
*
|
|
* (c) 2010-2021 Torstein Honsi, Lars A. V. Cabrera
|
|
*
|
|
* License: www.highcharts.com/license
|
|
*
|
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
*
|
|
* */
|
|
'use strict';
|
|
import U from '../../Core/Utilities.js';
|
|
var correctFloat = U.correctFloat, isNumber = U.isNumber, isObject = U.isObject;
|
|
/* *
|
|
*
|
|
* Constants
|
|
*
|
|
* */
|
|
/**
|
|
* The X-range series displays ranges on the X axis, typically time
|
|
* intervals with a start and end date.
|
|
*
|
|
* @sample {highcharts} highcharts/demo/x-range/
|
|
* X-range
|
|
* @sample {highcharts} highcharts/css/x-range/
|
|
* Styled mode X-range
|
|
* @sample {highcharts} highcharts/chart/inverted-xrange/
|
|
* Inverted X-range
|
|
*
|
|
* @extends plotOptions.column
|
|
* @since 6.0.0
|
|
* @product highcharts highstock gantt
|
|
* @excluding boostThreshold, crisp, cropThreshold, depth, edgeColor,
|
|
* edgeWidth, findNearestPointBy, getExtremesFromAll,
|
|
* negativeColor, pointInterval, pointIntervalUnit,
|
|
* pointPlacement, pointRange, pointStart, softThreshold,
|
|
* stacking, threshold, data, dataSorting, boostBlending
|
|
* @requires modules/xrange
|
|
* @optionparent plotOptions.xrange
|
|
*/
|
|
var XRangeSeriesDefaults = {
|
|
/**
|
|
* A partial fill for each point, typically used to visualize how much
|
|
* of a task is performed. The partial fill object can be set either on
|
|
* series or point level.
|
|
*
|
|
* @sample {highcharts} highcharts/demo/x-range
|
|
* X-range with partial fill
|
|
*
|
|
* @product highcharts highstock gantt
|
|
* @apioption plotOptions.xrange.partialFill
|
|
*/
|
|
/**
|
|
* The fill color to be used for partial fills. Defaults to a darker
|
|
* shade of the point color.
|
|
*
|
|
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
|
* @product highcharts highstock gantt
|
|
* @apioption plotOptions.xrange.partialFill.fill
|
|
*/
|
|
/**
|
|
* A partial fill for each point, typically used to visualize how much
|
|
* of a task is performed. See [completed](series.gantt.data.completed).
|
|
*
|
|
* @sample gantt/demo/progress-indicator
|
|
* Gantt with progress indicator
|
|
*
|
|
* @product gantt
|
|
* @apioption plotOptions.gantt.partialFill
|
|
*/
|
|
/**
|
|
* In an X-range series, this option makes all points of the same Y-axis
|
|
* category the same color.
|
|
*/
|
|
colorByPoint: true,
|
|
dataLabels: {
|
|
formatter: function () {
|
|
var point = this.point, amount = point.partialFill;
|
|
if (isObject(amount)) {
|
|
amount = amount.amount;
|
|
}
|
|
if (isNumber(amount) && amount > 0) {
|
|
return correctFloat(amount * 100) + '%';
|
|
}
|
|
},
|
|
inside: true,
|
|
verticalAlign: 'middle'
|
|
},
|
|
tooltip: {
|
|
headerFormat: '<span style="font-size: 10px">{point.x} - {point.x2}</span><br/>',
|
|
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.yCategory}</b><br/>'
|
|
},
|
|
borderRadius: 3,
|
|
pointRange: 0
|
|
};
|
|
/* *
|
|
*
|
|
* Export Default
|
|
*
|
|
* */
|
|
export default XRangeSeriesDefaults;
|
|
/* *
|
|
*
|
|
* API Options
|
|
*
|
|
* */
|
|
/**
|
|
* An `xrange` series. If the [type](#series.xrange.type) option is not
|
|
* specified, it is inherited from [chart.type](#chart.type).
|
|
*
|
|
* @extends series,plotOptions.xrange
|
|
* @excluding boostThreshold, crisp, cropThreshold, depth, edgeColor, edgeWidth,
|
|
* findNearestPointBy, getExtremesFromAll, negativeColor,
|
|
* pointInterval, pointIntervalUnit, pointPlacement, pointRange,
|
|
* pointStart, softThreshold, stacking, threshold, dataSorting,
|
|
* boostBlending
|
|
* @product highcharts highstock gantt
|
|
* @requires modules/xrange
|
|
* @apioption series.xrange
|
|
*/
|
|
/**
|
|
* An array of data points for the series. For the `xrange` series type,
|
|
* points can be given in the following ways:
|
|
*
|
|
* 1. An array of objects with named values. The objects are point configuration
|
|
* objects as seen below.
|
|
* ```js
|
|
* data: [{
|
|
* x: Date.UTC(2017, 0, 1),
|
|
* x2: Date.UTC(2017, 0, 3),
|
|
* name: "Test",
|
|
* y: 0,
|
|
* color: "#00FF00"
|
|
* }, {
|
|
* x: Date.UTC(2017, 0, 4),
|
|
* x2: Date.UTC(2017, 0, 5),
|
|
* name: "Deploy",
|
|
* y: 1,
|
|
* color: "#FF0000"
|
|
* }]
|
|
* ```
|
|
*
|
|
* @sample {highcharts} highcharts/series/data-array-of-objects/
|
|
* Config objects
|
|
*
|
|
* @declare Highcharts.XrangePointOptionsObject
|
|
* @type {Array<*>}
|
|
* @extends series.line.data
|
|
* @product highcharts highstock gantt
|
|
* @apioption series.xrange.data
|
|
*/
|
|
/**
|
|
* The starting X value of the range point.
|
|
*
|
|
* @sample {highcharts} highcharts/demo/x-range
|
|
* X-range
|
|
*
|
|
* @type {number}
|
|
* @product highcharts highstock gantt
|
|
* @apioption series.xrange.data.x
|
|
*/
|
|
/**
|
|
* The ending X value of the range point.
|
|
*
|
|
* @sample {highcharts} highcharts/demo/x-range
|
|
* X-range
|
|
*
|
|
* @type {number}
|
|
* @product highcharts highstock gantt
|
|
* @apioption series.xrange.data.x2
|
|
*/
|
|
/**
|
|
* The Y value of the range point.
|
|
*
|
|
* @sample {highcharts} highcharts/demo/x-range
|
|
* X-range
|
|
*
|
|
* @type {number}
|
|
* @product highcharts highstock gantt
|
|
* @apioption series.xrange.data.y
|
|
*/
|
|
/**
|
|
* A partial fill for each point, typically used to visualize how much of
|
|
* a task is performed. The partial fill object can be set either on series
|
|
* or point level.
|
|
*
|
|
* @sample {highcharts} highcharts/demo/x-range
|
|
* X-range with partial fill
|
|
*
|
|
* @declare Highcharts.XrangePointPartialFillOptionsObject
|
|
* @product highcharts highstock gantt
|
|
* @apioption series.xrange.data.partialFill
|
|
*/
|
|
/**
|
|
* The amount of the X-range point to be filled. Values can be 0-1 and are
|
|
* converted to percentages in the default data label formatter.
|
|
*
|
|
* @type {number}
|
|
* @product highcharts highstock gantt
|
|
* @apioption series.xrange.data.partialFill.amount
|
|
*/
|
|
/**
|
|
* The fill color to be used for partial fills. Defaults to a darker shade
|
|
* of the point color.
|
|
*
|
|
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
|
|
* @product highcharts highstock gantt
|
|
* @apioption series.xrange.data.partialFill.fill
|
|
*/
|
|
(''); // adds doclets above to transpiled file
|