Scatter3DSeries.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /* *
  2. *
  3. * (c) 2010-2021 Torstein Honsi
  4. *
  5. * Scatter 3D series.
  6. *
  7. * License: www.highcharts.com/license
  8. *
  9. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  10. *
  11. * */
  12. 'use strict';
  13. var __extends = (this && this.__extends) || (function () {
  14. var extendStatics = function (d, b) {
  15. extendStatics = Object.setPrototypeOf ||
  16. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  17. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  18. return extendStatics(d, b);
  19. };
  20. return function (d, b) {
  21. extendStatics(d, b);
  22. function __() { this.constructor = d; }
  23. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  24. };
  25. })();
  26. import Math3D from '../../Extensions/Math3D.js';
  27. var pointCameraDistance = Math3D.pointCameraDistance;
  28. import Scatter3DPoint from './Scatter3DPoint.js';
  29. import ScatterSeries from '../Scatter/ScatterSeries.js';
  30. import SeriesRegistry from '../../Core/Series/SeriesRegistry.js';
  31. import U from '../../Core/Utilities.js';
  32. var extend = U.extend, merge = U.merge;
  33. /* *
  34. *
  35. * Class
  36. *
  37. * */
  38. /**
  39. * @private
  40. * @class
  41. * @name Highcharts.seriesTypes.scatter3d
  42. *
  43. * @augments Highcharts.Series
  44. */
  45. var Scatter3DSeries = /** @class */ (function (_super) {
  46. __extends(Scatter3DSeries, _super);
  47. function Scatter3DSeries() {
  48. /* *
  49. *
  50. * Static Properties
  51. *
  52. * */
  53. var _this = _super !== null && _super.apply(this, arguments) || this;
  54. /* *
  55. *
  56. * Properties
  57. *
  58. * */
  59. _this.data = void 0;
  60. _this.options = void 0;
  61. _this.points = void 0;
  62. return _this;
  63. }
  64. /* *
  65. *
  66. * Functions
  67. *
  68. * */
  69. Scatter3DSeries.prototype.pointAttribs = function (point) {
  70. var attribs = _super.prototype.pointAttribs.apply(this, arguments);
  71. if (this.chart.is3d() && point) {
  72. attribs.zIndex =
  73. pointCameraDistance(point, this.chart);
  74. }
  75. return attribs;
  76. };
  77. /**
  78. * A 3D scatter plot uses x, y and z coordinates to display values for three
  79. * variables for a set of data.
  80. *
  81. * @sample {highcharts} highcharts/3d/scatter/
  82. * Simple 3D scatter
  83. * @sample {highcharts} highcharts/demo/3d-scatter-draggable
  84. * Draggable 3d scatter
  85. *
  86. * @extends plotOptions.scatter
  87. * @excluding dragDrop, cluster, boostThreshold, boostBlending
  88. * @product highcharts
  89. * @requires highcharts-3d
  90. * @optionparent plotOptions.scatter3d
  91. */
  92. Scatter3DSeries.defaultOptions = merge(ScatterSeries.defaultOptions, {
  93. tooltip: {
  94. pointFormat: 'x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>z: <b>{point.z}</b><br/>'
  95. }
  96. });
  97. return Scatter3DSeries;
  98. }(ScatterSeries));
  99. extend(Scatter3DSeries.prototype, {
  100. axisTypes: ['xAxis', 'yAxis', 'zAxis'],
  101. // Require direct touch rather than using the k-d-tree, because the
  102. // k-d-tree currently doesn't take the xyz coordinate system into
  103. // account (#4552)
  104. directTouch: true,
  105. parallelArrays: ['x', 'y', 'z'],
  106. pointArrayMap: ['x', 'y', 'z'],
  107. pointClass: Scatter3DPoint
  108. });
  109. SeriesRegistry.registerSeriesType('scatter3d', Scatter3DSeries);
  110. /* *
  111. *
  112. * Default Export
  113. *
  114. * */
  115. export default Scatter3DSeries;
  116. /* *
  117. *
  118. * API Options
  119. *
  120. * */
  121. /**
  122. * A `scatter3d` series. If the [type](#series.scatter3d.type) option is
  123. * not specified, it is inherited from [chart.type](#chart.type).
  124. *
  125. * scatter3d](#plotOptions.scatter3d).
  126. *
  127. * @extends series,plotOptions.scatter3d
  128. * @excluding boostThreshold, boostBlending
  129. * @product highcharts
  130. * @requires highcharts-3d
  131. * @apioption series.scatter3d
  132. */
  133. /**
  134. * An array of data points for the series. For the `scatter3d` series
  135. * type, points can be given in the following ways:
  136. *
  137. * 1. An array of arrays with 3 values. In this case, the values correspond
  138. * to `x,y,z`. If the first value is a string, it is applied as the name
  139. * of the point, and the `x` value is inferred.
  140. *
  141. * ```js
  142. * data: [
  143. * [0, 0, 1],
  144. * [1, 8, 7],
  145. * [2, 9, 2]
  146. * ]
  147. * ```
  148. *
  149. * 3. An array of objects with named values. The following snippet shows only a
  150. * few settings, see the complete options set below. If the total number of data
  151. * points exceeds the series'
  152. * [turboThreshold](#series.scatter3d.turboThreshold), this option is not
  153. * available.
  154. *
  155. * ```js
  156. * data: [{
  157. * x: 1,
  158. * y: 2,
  159. * z: 24,
  160. * name: "Point2",
  161. * color: "#00FF00"
  162. * }, {
  163. * x: 1,
  164. * y: 4,
  165. * z: 12,
  166. * name: "Point1",
  167. * color: "#FF00FF"
  168. * }]
  169. * ```
  170. *
  171. * @sample {highcharts} highcharts/chart/reflow-true/
  172. * Numerical values
  173. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  174. * Arrays of numeric x and y
  175. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  176. * Arrays of datetime x and y
  177. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  178. * Arrays of point.name and y
  179. * @sample {highcharts} highcharts/series/data-array-of-objects/
  180. * Config objects
  181. *
  182. * @type {Array<Array<number>|*>}
  183. * @extends series.scatter.data
  184. * @product highcharts
  185. * @apioption series.scatter3d.data
  186. */
  187. /**
  188. * The z value for each data point.
  189. *
  190. * @type {number}
  191. * @product highcharts
  192. * @apioption series.scatter3d.data.z
  193. */
  194. ''; // adds doclets above to transpiled file