Scatter3DSeries.js 4.2 KB

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