Scatter3DSeries.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* *
  2. *
  3. * (c) 2010-2020 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. import H from '../Core/Globals.js';
  14. import Math3D from '../Extensions/Math3D.js';
  15. var pointCameraDistance = Math3D.pointCameraDistance;
  16. import Point from '../Core/Series/Point.js';
  17. import U from '../Core/Utilities.js';
  18. var seriesType = U.seriesType;
  19. var seriesTypes = H.seriesTypes;
  20. /**
  21. * @private
  22. * @class
  23. * @name Highcharts.seriesTypes.scatter3d
  24. *
  25. * @augments Highcharts.Series
  26. */
  27. seriesType('scatter3d', 'scatter',
  28. /**
  29. * A 3D scatter plot uses x, y and z coordinates to display values for three
  30. * variables for a set of data.
  31. *
  32. * @sample {highcharts} highcharts/3d/scatter/
  33. * Simple 3D scatter
  34. * @sample {highcharts} highcharts/demo/3d-scatter-draggable
  35. * Draggable 3d scatter
  36. *
  37. * @extends plotOptions.scatter
  38. * @excluding dragDrop, cluster, boostThreshold, boostBlending
  39. * @product highcharts
  40. * @requires highcharts-3d
  41. * @optionparent plotOptions.scatter3d
  42. */
  43. {
  44. tooltip: {
  45. pointFormat: 'x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>z: <b>{point.z}</b><br/>'
  46. }
  47. // Series class
  48. }, {
  49. pointAttribs: function (point) {
  50. var attribs = seriesTypes.scatter.prototype.pointAttribs
  51. .apply(this, arguments);
  52. if (this.chart.is3d() && point) {
  53. attribs.zIndex =
  54. pointCameraDistance(point, this.chart);
  55. }
  56. return attribs;
  57. },
  58. axisTypes: ['xAxis', 'yAxis', 'zAxis'],
  59. pointArrayMap: ['x', 'y', 'z'],
  60. parallelArrays: ['x', 'y', 'z'],
  61. // Require direct touch rather than using the k-d-tree, because the
  62. // k-d-tree currently doesn't take the xyz coordinate system into
  63. // account (#4552)
  64. directTouch: true
  65. // Point class
  66. }, {
  67. applyOptions: function () {
  68. Point.prototype.applyOptions.apply(this, arguments);
  69. if (typeof this.z === 'undefined') {
  70. this.z = 0;
  71. }
  72. return this;
  73. }
  74. });
  75. /**
  76. * A `scatter3d` series. If the [type](#series.scatter3d.type) option is
  77. * not specified, it is inherited from [chart.type](#chart.type).
  78. *
  79. * scatter3d](#plotOptions.scatter3d).
  80. *
  81. * @extends series,plotOptions.scatter3d
  82. * @excluding boostThreshold, boostBlending
  83. * @product highcharts
  84. * @requires highcharts-3d
  85. * @apioption series.scatter3d
  86. */
  87. /**
  88. * An array of data points for the series. For the `scatter3d` series
  89. * type, points can be given in the following ways:
  90. *
  91. * 1. An array of arrays with 3 values. In this case, the values correspond
  92. * to `x,y,z`. If the first value is a string, it is applied as the name
  93. * of the point, and the `x` value is inferred.
  94. *
  95. * ```js
  96. * data: [
  97. * [0, 0, 1],
  98. * [1, 8, 7],
  99. * [2, 9, 2]
  100. * ]
  101. * ```
  102. *
  103. * 3. An array of objects with named values. The following snippet shows only a
  104. * few settings, see the complete options set below. If the total number of data
  105. * points exceeds the series'
  106. * [turboThreshold](#series.scatter3d.turboThreshold), this option is not
  107. * available.
  108. *
  109. * ```js
  110. * data: [{
  111. * x: 1,
  112. * y: 2,
  113. * z: 24,
  114. * name: "Point2",
  115. * color: "#00FF00"
  116. * }, {
  117. * x: 1,
  118. * y: 4,
  119. * z: 12,
  120. * name: "Point1",
  121. * color: "#FF00FF"
  122. * }]
  123. * ```
  124. *
  125. * @sample {highcharts} highcharts/chart/reflow-true/
  126. * Numerical values
  127. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  128. * Arrays of numeric x and y
  129. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  130. * Arrays of datetime x and y
  131. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  132. * Arrays of point.name and y
  133. * @sample {highcharts} highcharts/series/data-array-of-objects/
  134. * Config objects
  135. *
  136. * @type {Array<Array<number>|*>}
  137. * @extends series.scatter.data
  138. * @product highcharts
  139. * @apioption series.scatter3d.data
  140. */
  141. /**
  142. * The z value for each data point.
  143. *
  144. * @type {number}
  145. * @product highcharts
  146. * @apioption series.scatter3d.data.z
  147. */
  148. ''; // adds doclets above to transpiled file