2
0

Scatter.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 '../parts/Globals.js';
  14. import Point from '../parts/Point.js';
  15. import U from '../parts/Utilities.js';
  16. var seriesType = U.seriesType;
  17. var seriesTypes = H.seriesTypes;
  18. /**
  19. * @private
  20. * @class
  21. * @name Highcharts.seriesTypes.scatter3d
  22. *
  23. * @augments Highcharts.Series
  24. */
  25. 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
  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. H.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. * @product highcharts
  81. * @requires highcharts-3d
  82. * @apioption series.scatter3d
  83. */
  84. /**
  85. * An array of data points for the series. For the `scatter3d` series
  86. * type, points can be given in the following ways:
  87. *
  88. * 1. An array of arrays with 3 values. In this case, the values correspond
  89. * to `x,y,z`. If the first value is a string, it is applied as the name
  90. * of the point, and the `x` value is inferred.
  91. *
  92. * ```js
  93. * data: [
  94. * [0, 0, 1],
  95. * [1, 8, 7],
  96. * [2, 9, 2]
  97. * ]
  98. * ```
  99. *
  100. * 3. An array of objects with named values. The following snippet shows only a
  101. * few settings, see the complete options set below. If the total number of data
  102. * points exceeds the series'
  103. * [turboThreshold](#series.scatter3d.turboThreshold), this option is not
  104. * available.
  105. *
  106. * ```js
  107. * data: [{
  108. * x: 1,
  109. * y: 2,
  110. * z: 24,
  111. * name: "Point2",
  112. * color: "#00FF00"
  113. * }, {
  114. * x: 1,
  115. * y: 4,
  116. * z: 12,
  117. * name: "Point1",
  118. * color: "#FF00FF"
  119. * }]
  120. * ```
  121. *
  122. * @sample {highcharts} highcharts/chart/reflow-true/
  123. * Numerical values
  124. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  125. * Arrays of numeric x and y
  126. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  127. * Arrays of datetime x and y
  128. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  129. * Arrays of point.name and y
  130. * @sample {highcharts} highcharts/series/data-array-of-objects/
  131. * Config objects
  132. *
  133. * @type {Array<Array<number>|*>}
  134. * @extends series.scatter.data
  135. * @product highcharts
  136. * @apioption series.scatter3d.data
  137. */
  138. /**
  139. * The z value for each data point.
  140. *
  141. * @type {number}
  142. * @product highcharts
  143. * @apioption series.scatter3d.data.z
  144. */
  145. ''; // adds doclets above to transpiled file