PieSeries.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281
  1. /* *
  2. *
  3. * (c) 2010-2020 Torstein Honsi
  4. *
  5. * License: www.highcharts.com/license
  6. *
  7. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  8. *
  9. * */
  10. import A from '../Core/Animation/AnimationUtilities.js';
  11. var setAnimation = A.setAnimation;
  12. import BaseSeries from '../Core/Series/Series.js';
  13. import CenteredSeriesMixin from '../Mixins/CenteredSeries.js';
  14. var getStartAndEndRadians = CenteredSeriesMixin.getStartAndEndRadians;
  15. import H from '../Core/Globals.js';
  16. var noop = H.noop;
  17. import LegendSymbolMixin from '../Mixins/LegendSymbol.js';
  18. import LineSeries from '../Series/LineSeries.js';
  19. import Point from '../Core/Series/Point.js';
  20. import SVGRenderer from '../Core/Renderer/SVG/SVGRenderer.js';
  21. import U from '../Core/Utilities.js';
  22. var addEvent = U.addEvent, clamp = U.clamp, defined = U.defined, fireEvent = U.fireEvent, isNumber = U.isNumber, merge = U.merge, pick = U.pick, relativeLength = U.relativeLength;
  23. import '../Core/Options.js';
  24. /**
  25. * Pie series type.
  26. *
  27. * @private
  28. * @class
  29. * @name Highcharts.seriesTypes.pie
  30. *
  31. * @augments Highcharts.Series
  32. */
  33. BaseSeries.seriesType('pie', 'line',
  34. /**
  35. * A pie chart is a circular graphic which is divided into slices to
  36. * illustrate numerical proportion.
  37. *
  38. * @sample highcharts/demo/pie-basic/
  39. * Pie chart
  40. *
  41. * @extends plotOptions.line
  42. * @excluding animationLimit, boostThreshold, connectEnds, connectNulls,
  43. * cropThreshold, dashStyle, dataSorting, dragDrop,
  44. * findNearestPointBy, getExtremesFromAll, label, lineWidth,
  45. * marker, negativeColor, pointInterval, pointIntervalUnit,
  46. * pointPlacement, pointStart, softThreshold, stacking, step,
  47. * threshold, turboThreshold, zoneAxis, zones, dataSorting,
  48. * boostBlending
  49. * @product highcharts
  50. * @optionparent plotOptions.pie
  51. */
  52. {
  53. /**
  54. * @excluding legendItemClick
  55. * @apioption plotOptions.pie.events
  56. */
  57. /**
  58. * Fires when the checkbox next to the point name in the legend is
  59. * clicked. One parameter, event, is passed to the function. The state
  60. * of the checkbox is found by event.checked. The checked item is found
  61. * by event.item. Return false to prevent the default action which is to
  62. * toggle the select state of the series.
  63. *
  64. * @sample {highcharts} highcharts/plotoptions/series-events-checkboxclick/
  65. * Alert checkbox status
  66. *
  67. * @type {Function}
  68. * @since 1.2.0
  69. * @product highcharts
  70. * @context Highcharts.Point
  71. * @apioption plotOptions.pie.events.checkboxClick
  72. */
  73. /**
  74. * Fires when the legend item belonging to the pie point (slice) is
  75. * clicked. The `this` keyword refers to the point itself. One
  76. * parameter, `event`, is passed to the function, containing common
  77. * event information. The default action is to toggle the visibility of
  78. * the point. This can be prevented by calling `event.preventDefault()`.
  79. *
  80. * @sample {highcharts} highcharts/plotoptions/pie-point-events-legenditemclick/
  81. * Confirm toggle visibility
  82. *
  83. * @type {Highcharts.PointLegendItemClickCallbackFunction}
  84. * @since 1.2.0
  85. * @product highcharts
  86. * @apioption plotOptions.pie.point.events.legendItemClick
  87. */
  88. /**
  89. * The center of the pie chart relative to the plot area. Can be
  90. * percentages or pixel values. The default behaviour (as of 3.0) is to
  91. * center the pie so that all slices and data labels are within the plot
  92. * area. As a consequence, the pie may actually jump around in a chart
  93. * with dynamic values, as the data labels move. In that case, the
  94. * center should be explicitly set, for example to `["50%", "50%"]`.
  95. *
  96. * @sample {highcharts} highcharts/plotoptions/pie-center/
  97. * Centered at 100, 100
  98. *
  99. * @type {Array<(number|string|null),(number|string|null)>}
  100. * @default [null, null]
  101. * @product highcharts
  102. *
  103. * @private
  104. */
  105. center: [null, null],
  106. /**
  107. * The color of the pie series. A pie series is represented as an empty
  108. * circle if the total sum of its values is 0. Use this property to
  109. * define the color of its border.
  110. *
  111. * In styled mode, the color can be defined by the
  112. * [colorIndex](#plotOptions.series.colorIndex) option. Also, the series
  113. * color can be set with the `.highcharts-series`,
  114. * `.highcharts-color-{n}`, `.highcharts-{type}-series` or
  115. * `.highcharts-series-{n}` class, or individual classes given by the
  116. * `className` option.
  117. *
  118. * @sample {highcharts} highcharts/plotoptions/pie-emptyseries/
  119. * Empty pie series
  120. *
  121. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  122. * @default #cccccc
  123. * @apioption plotOptions.pie.color
  124. */
  125. /**
  126. * @product highcharts
  127. *
  128. * @private
  129. */
  130. clip: false,
  131. /**
  132. * @ignore-option
  133. *
  134. * @private
  135. */
  136. colorByPoint: true,
  137. /**
  138. * A series specific or series type specific color set to use instead
  139. * of the global [colors](#colors).
  140. *
  141. * @sample {highcharts} highcharts/demo/pie-monochrome/
  142. * Set default colors for all pies
  143. *
  144. * @type {Array<Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject>}
  145. * @since 3.0
  146. * @product highcharts
  147. * @apioption plotOptions.pie.colors
  148. */
  149. /**
  150. * @declare Highcharts.SeriesPieDataLabelsOptionsObject
  151. * @extends plotOptions.series.dataLabels
  152. * @excluding align, allowOverlap, inside, staggerLines, step
  153. * @private
  154. */
  155. dataLabels: {
  156. /**
  157. * Alignment method for data labels. Possible values are:
  158. *
  159. * - `toPlotEdges`: Each label touches the nearest vertical edge of
  160. * the plot area.
  161. *
  162. * - `connectors`: Connectors have the same x position and the
  163. * widest label of each half (left & right) touches the nearest
  164. * vertical edge of the plot area.
  165. *
  166. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-alignto-connectors/
  167. * alignTo: connectors
  168. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-alignto-plotedges/
  169. * alignTo: plotEdges
  170. *
  171. * @type {string}
  172. * @since 7.0.0
  173. * @product highcharts
  174. * @apioption plotOptions.pie.dataLabels.alignTo
  175. */
  176. allowOverlap: true,
  177. /**
  178. * The color of the line connecting the data label to the pie slice.
  179. * The default color is the same as the point's color.
  180. *
  181. * In styled mode, the connector stroke is given in the
  182. * `.highcharts-data-label-connector` class.
  183. *
  184. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorcolor/
  185. * Blue connectors
  186. * @sample {highcharts} highcharts/css/pie-point/
  187. * Styled connectors
  188. *
  189. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  190. * @since 2.1
  191. * @product highcharts
  192. * @apioption plotOptions.pie.dataLabels.connectorColor
  193. */
  194. /**
  195. * The distance from the data label to the connector. Note that
  196. * data labels also have a default `padding`, so in order for the
  197. * connector to touch the text, the `padding` must also be 0.
  198. *
  199. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorpadding/
  200. * No padding
  201. *
  202. * @since 2.1
  203. * @product highcharts
  204. */
  205. connectorPadding: 5,
  206. /**
  207. * Specifies the method that is used to generate the connector path.
  208. * Highcharts provides 3 built-in connector shapes: `'fixedOffset'`
  209. * (default), `'straight'` and `'crookedLine'`. Using
  210. * `'crookedLine'` has the most sense (in most of the cases) when
  211. * `'alignTo'` is set.
  212. *
  213. * Users can provide their own method by passing a function instead
  214. * of a String. 3 arguments are passed to the callback:
  215. *
  216. * - Object that holds the information about the coordinates of the
  217. * label (`x` & `y` properties) and how the label is located in
  218. * relation to the pie (`alignment` property). `alignment` can by
  219. * one of the following:
  220. * `'left'` (pie on the left side of the data label),
  221. * `'right'` (pie on the right side of the data label) or
  222. * `'center'` (data label overlaps the pie).
  223. *
  224. * - Object that holds the information about the position of the
  225. * connector. Its `touchingSliceAt` porperty tells the position
  226. * of the place where the connector touches the slice.
  227. *
  228. * - Data label options
  229. *
  230. * The function has to return an SVG path definition in array form
  231. * (see the example).
  232. *
  233. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorshape-string/
  234. * connectorShape is a String
  235. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorshape-function/
  236. * connectorShape is a function
  237. *
  238. * @type {string|Function}
  239. * @since 7.0.0
  240. * @product highcharts
  241. */
  242. connectorShape: 'fixedOffset',
  243. /**
  244. * The width of the line connecting the data label to the pie slice.
  245. *
  246. * In styled mode, the connector stroke width is given in the
  247. * `.highcharts-data-label-connector` class.
  248. *
  249. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-connectorwidth-disabled/
  250. * Disable the connector
  251. * @sample {highcharts} highcharts/css/pie-point/
  252. * Styled connectors
  253. *
  254. * @type {number}
  255. * @default 1
  256. * @since 2.1
  257. * @product highcharts
  258. * @apioption plotOptions.pie.dataLabels.connectorWidth
  259. */
  260. /**
  261. * Works only if `connectorShape` is `'crookedLine'`. It defines how
  262. * far from the vertical plot edge the coonnector path should be
  263. * crooked.
  264. *
  265. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-crookdistance/
  266. * crookDistance set to 90%
  267. *
  268. * @since 7.0.0
  269. * @product highcharts
  270. */
  271. crookDistance: '70%',
  272. /**
  273. * The distance of the data label from the pie's edge. Negative
  274. * numbers put the data label on top of the pie slices. Can also be
  275. * defined as a percentage of pie's radius. Connectors are only
  276. * shown for data labels outside the pie.
  277. *
  278. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-distance/
  279. * Data labels on top of the pie
  280. *
  281. * @type {number|string}
  282. * @since 2.1
  283. * @product highcharts
  284. */
  285. distance: 30,
  286. enabled: true,
  287. /**
  288. * A
  289. * [format string](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting)
  290. * for the data label. Available variables are the same as for
  291. * `formatter`.
  292. *
  293. * @sample {highcharts} highcharts/plotoptions/series-datalabels-format/
  294. * Add a unit
  295. *
  296. * @type {string}
  297. * @default undefined
  298. * @since 3.0
  299. * @apioption plotOptions.pie.dataLabels.format
  300. */
  301. // eslint-disable-next-line valid-jsdoc
  302. /**
  303. * Callback JavaScript function to format the data label. Note that
  304. * if a `format` is defined, the format takes precedence and the
  305. * formatter is ignored.
  306. *
  307. * @type {Highcharts.DataLabelsFormatterCallbackFunction}
  308. * @default function () { return this.point.isNull ? void 0 : this.point.name; }
  309. */
  310. formatter: function () {
  311. return this.point.isNull ? void 0 : this.point.name;
  312. },
  313. /**
  314. * Whether to render the connector as a soft arc or a line with
  315. * sharp break. Works only if `connectorShape` equals to
  316. * `fixedOffset`.
  317. *
  318. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-softconnector-true/
  319. * Soft
  320. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-softconnector-false/
  321. * Non soft
  322. *
  323. * @since 2.1.7
  324. * @product highcharts
  325. */
  326. softConnector: true,
  327. /**
  328. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-overflow
  329. * Long labels truncated with an ellipsis
  330. * @sample {highcharts} highcharts/plotoptions/pie-datalabels-overflow-wrap
  331. * Long labels are wrapped
  332. *
  333. * @type {Highcharts.CSSObject}
  334. * @apioption plotOptions.pie.dataLabels.style
  335. */
  336. x: 0
  337. },
  338. /**
  339. * If the total sum of the pie's values is 0, the series is represented
  340. * as an empty circle . The `fillColor` option defines the color of that
  341. * circle. Use [pie.borderWidth](#plotOptions.pie.borderWidth) to set
  342. * the border thickness.
  343. *
  344. * @sample {highcharts} highcharts/plotoptions/pie-emptyseries/
  345. * Empty pie series
  346. *
  347. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  348. * @private
  349. */
  350. fillColor: void 0,
  351. /**
  352. * The end angle of the pie in degrees where 0 is top and 90 is right.
  353. * Defaults to `startAngle` plus 360.
  354. *
  355. * @sample {highcharts} highcharts/demo/pie-semi-circle/
  356. * Semi-circle donut
  357. *
  358. * @type {number}
  359. * @since 1.3.6
  360. * @product highcharts
  361. * @apioption plotOptions.pie.endAngle
  362. */
  363. /**
  364. * Equivalent to [chart.ignoreHiddenSeries](#chart.ignoreHiddenSeries),
  365. * this option tells whether the series shall be redrawn as if the
  366. * hidden point were `null`.
  367. *
  368. * The default value changed from `false` to `true` with Highcharts
  369. * 3.0.
  370. *
  371. * @sample {highcharts} highcharts/plotoptions/pie-ignorehiddenpoint/
  372. * True, the hiddden point is ignored
  373. *
  374. * @since 2.3.0
  375. * @product highcharts
  376. *
  377. * @private
  378. */
  379. ignoreHiddenPoint: true,
  380. /**
  381. * @ignore-option
  382. *
  383. * @private
  384. */
  385. inactiveOtherPoints: true,
  386. /**
  387. * The size of the inner diameter for the pie. A size greater than 0
  388. * renders a donut chart. Can be a percentage or pixel value.
  389. * Percentages are relative to the pie size. Pixel values are given as
  390. * integers.
  391. *
  392. *
  393. * Note: in Highcharts < 4.1.2, the percentage was relative to the plot
  394. * area, not the pie size.
  395. *
  396. * @sample {highcharts} highcharts/plotoptions/pie-innersize-80px/
  397. * 80px inner size
  398. * @sample {highcharts} highcharts/plotoptions/pie-innersize-50percent/
  399. * 50% of the plot area
  400. * @sample {highcharts} highcharts/demo/3d-pie-donut/
  401. * 3D donut
  402. *
  403. * @type {number|string}
  404. * @default 0
  405. * @since 2.0
  406. * @product highcharts
  407. * @apioption plotOptions.pie.innerSize
  408. */
  409. /**
  410. * @ignore-option
  411. *
  412. * @private
  413. */
  414. legendType: 'point',
  415. /**
  416. * @ignore-option
  417. *
  418. * @private
  419. */
  420. marker: null,
  421. /**
  422. * The minimum size for a pie in response to auto margins. The pie will
  423. * try to shrink to make room for data labels in side the plot area,
  424. * but only to this size.
  425. *
  426. * @type {number|string}
  427. * @default 80
  428. * @since 3.0
  429. * @product highcharts
  430. * @apioption plotOptions.pie.minSize
  431. */
  432. /**
  433. * The diameter of the pie relative to the plot area. Can be a
  434. * percentage or pixel value. Pixel values are given as integers. The
  435. * default behaviour (as of 3.0) is to scale to the plot area and give
  436. * room for data labels within the plot area.
  437. * [slicedOffset](#plotOptions.pie.slicedOffset) is also included in the
  438. * default size calculation. As a consequence, the size of the pie may
  439. * vary when points are updated and data labels more around. In that
  440. * case it is best to set a fixed value, for example `"75%"`.
  441. *
  442. * @sample {highcharts} highcharts/plotoptions/pie-size/
  443. * Smaller pie
  444. *
  445. * @type {number|string|null}
  446. * @product highcharts
  447. *
  448. * @private
  449. */
  450. size: null,
  451. /**
  452. * Whether to display this particular series or series type in the
  453. * legend. Since 2.1, pies are not shown in the legend by default.
  454. *
  455. * @sample {highcharts} highcharts/plotoptions/series-showinlegend/
  456. * One series in the legend, one hidden
  457. *
  458. * @product highcharts
  459. *
  460. * @private
  461. */
  462. showInLegend: false,
  463. /**
  464. * If a point is sliced, moved out from the center, how many pixels
  465. * should it be moved?.
  466. *
  467. * @sample {highcharts} highcharts/plotoptions/pie-slicedoffset-20/
  468. * 20px offset
  469. *
  470. * @product highcharts
  471. *
  472. * @private
  473. */
  474. slicedOffset: 10,
  475. /**
  476. * The start angle of the pie slices in degrees where 0 is top and 90
  477. * right.
  478. *
  479. * @sample {highcharts} highcharts/plotoptions/pie-startangle-90/
  480. * Start from right
  481. *
  482. * @type {number}
  483. * @default 0
  484. * @since 2.3.4
  485. * @product highcharts
  486. * @apioption plotOptions.pie.startAngle
  487. */
  488. /**
  489. * Sticky tracking of mouse events. When true, the `mouseOut` event
  490. * on a series isn't triggered until the mouse moves over another
  491. * series, or out of the plot area. When false, the `mouseOut` event on
  492. * a series is triggered when the mouse leaves the area around the
  493. * series' graph or markers. This also implies the tooltip. When
  494. * `stickyTracking` is false and `tooltip.shared` is false, the tooltip
  495. * will be hidden when moving the mouse between series.
  496. *
  497. * @product highcharts
  498. *
  499. * @private
  500. */
  501. stickyTracking: false,
  502. tooltip: {
  503. followPointer: true
  504. },
  505. /**
  506. * The color of the border surrounding each slice. When `null`, the
  507. * border takes the same color as the slice fill. This can be used
  508. * together with a `borderWidth` to fill drawing gaps created by
  509. * antialiazing artefacts in borderless pies.
  510. *
  511. * In styled mode, the border stroke is given in the `.highcharts-point`
  512. * class.
  513. *
  514. * @sample {highcharts} highcharts/plotoptions/pie-bordercolor-black/
  515. * Black border
  516. *
  517. * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
  518. * @default #ffffff
  519. * @product highcharts
  520. *
  521. * @private
  522. */
  523. borderColor: '#ffffff',
  524. /**
  525. * The width of the border surrounding each slice.
  526. *
  527. * When setting the border width to 0, there may be small gaps between
  528. * the slices due to SVG antialiasing artefacts. To work around this,
  529. * keep the border width at 0.5 or 1, but set the `borderColor` to
  530. * `null` instead.
  531. *
  532. * In styled mode, the border stroke width is given in the
  533. * `.highcharts-point` class.
  534. *
  535. * @sample {highcharts} highcharts/plotoptions/pie-borderwidth/
  536. * 3px border
  537. *
  538. * @product highcharts
  539. *
  540. * @private
  541. */
  542. borderWidth: 1,
  543. /**
  544. * @ignore-options
  545. * @private
  546. */
  547. lineWidth: void 0,
  548. states: {
  549. /**
  550. * @extends plotOptions.series.states.hover
  551. * @excluding marker, lineWidth, lineWidthPlus
  552. * @product highcharts
  553. */
  554. hover: {
  555. /**
  556. * How much to brighten the point on interaction. Requires the
  557. * main color to be defined in hex or rgb(a) format.
  558. *
  559. * In styled mode, the hover brightness is by default replaced
  560. * by a fill-opacity given in the `.highcharts-point-hover`
  561. * class.
  562. *
  563. * @sample {highcharts} highcharts/plotoptions/pie-states-hover-brightness/
  564. * Brightened by 0.5
  565. *
  566. * @product highcharts
  567. */
  568. brightness: 0.1
  569. }
  570. }
  571. },
  572. /* eslint-disable valid-jsdoc */
  573. /**
  574. * @lends seriesTypes.pie.prototype
  575. */
  576. {
  577. isCartesian: false,
  578. requireSorting: false,
  579. directTouch: true,
  580. noSharedTooltip: true,
  581. trackerGroups: ['group', 'dataLabelsGroup'],
  582. axisTypes: [],
  583. pointAttribs: BaseSeries.seriesTypes.column.prototype.pointAttribs,
  584. /**
  585. * Animate the pies in
  586. *
  587. * @private
  588. * @function Highcharts.seriesTypes.pie#animate
  589. *
  590. * @param {boolean} [init=false]
  591. */
  592. animate: function (init) {
  593. var series = this, points = series.points, startAngleRad = series.startAngleRad;
  594. if (!init) {
  595. points.forEach(function (point) {
  596. var graphic = point.graphic, args = point.shapeArgs;
  597. if (graphic && args) {
  598. // start values
  599. graphic.attr({
  600. // animate from inner radius (#779)
  601. r: pick(point.startR, (series.center && series.center[3] / 2)),
  602. start: startAngleRad,
  603. end: startAngleRad
  604. });
  605. // animate
  606. graphic.animate({
  607. r: args.r,
  608. start: args.start,
  609. end: args.end
  610. }, series.options.animation);
  611. }
  612. });
  613. }
  614. },
  615. // Define hasData function for non-cartesian series.
  616. // Returns true if the series has points at all.
  617. hasData: function () {
  618. return !!this.processedXData.length; // != 0
  619. },
  620. /**
  621. * Recompute total chart sum and update percentages of points.
  622. *
  623. * @private
  624. * @function Highcharts.seriesTypes.pie#updateTotals
  625. * @return {void}
  626. */
  627. updateTotals: function () {
  628. var i, total = 0, points = this.points, len = points.length, point, ignoreHiddenPoint = this.options.ignoreHiddenPoint;
  629. // Get the total sum
  630. for (i = 0; i < len; i++) {
  631. point = points[i];
  632. total += (ignoreHiddenPoint && !point.visible) ?
  633. 0 :
  634. point.isNull ?
  635. 0 :
  636. point.y;
  637. }
  638. this.total = total;
  639. // Set each point's properties
  640. for (i = 0; i < len; i++) {
  641. point = points[i];
  642. point.percentage =
  643. (total > 0 && (point.visible || !ignoreHiddenPoint)) ?
  644. point.y / total * 100 :
  645. 0;
  646. point.total = total;
  647. }
  648. },
  649. /**
  650. * Extend the generatePoints method by adding total and percentage
  651. * properties to each point
  652. *
  653. * @private
  654. * @function Highcharts.seriesTypes.pie#generatePoints
  655. * @return {void}
  656. */
  657. generatePoints: function () {
  658. LineSeries.prototype.generatePoints.call(this);
  659. this.updateTotals();
  660. },
  661. /**
  662. * Utility for getting the x value from a given y, used for
  663. * anticollision logic in data labels. Added point for using specific
  664. * points' label distance.
  665. * @private
  666. */
  667. getX: function (y, left, point) {
  668. var center = this.center,
  669. // Variable pie has individual radius
  670. radius = this.radii ?
  671. this.radii[point.index] :
  672. center[2] / 2, angle, x;
  673. angle = Math.asin(clamp((y - center[1]) / (radius + point.labelDistance), -1, 1));
  674. x = center[0] +
  675. (left ? -1 : 1) *
  676. (Math.cos(angle) * (radius + point.labelDistance)) +
  677. (point.labelDistance > 0 ?
  678. (left ? -1 : 1) * this.options.dataLabels.padding :
  679. 0);
  680. return x;
  681. },
  682. /**
  683. * Do translation for pie slices
  684. *
  685. * @private
  686. * @function Highcharts.seriesTypes.pie#translate
  687. * @param {Array<number>} [positions]
  688. * @return {void}
  689. */
  690. translate: function (positions) {
  691. this.generatePoints();
  692. var series = this, cumulative = 0, precision = 1000, // issue #172
  693. options = series.options, slicedOffset = options.slicedOffset, connectorOffset = slicedOffset + (options.borderWidth || 0), finalConnectorOffset, start, end, angle, radians = getStartAndEndRadians(options.startAngle, options.endAngle), startAngleRad = series.startAngleRad = radians.start, endAngleRad = series.endAngleRad = radians.end, circ = endAngleRad - startAngleRad, // 2 * Math.PI,
  694. points = series.points,
  695. // the x component of the radius vector for a given point
  696. radiusX, radiusY, labelDistance = options.dataLabels.distance, ignoreHiddenPoint = options.ignoreHiddenPoint, i, len = points.length, point;
  697. // Get positions - either an integer or a percentage string must be
  698. // given. If positions are passed as a parameter, we're in a
  699. // recursive loop for adjusting space for data labels.
  700. if (!positions) {
  701. series.center = positions = series.getCenter();
  702. }
  703. // Calculate the geometry for each point
  704. for (i = 0; i < len; i++) {
  705. point = points[i];
  706. // set start and end angle
  707. start = startAngleRad + (cumulative * circ);
  708. if (!ignoreHiddenPoint || point.visible) {
  709. cumulative += point.percentage / 100;
  710. }
  711. end = startAngleRad + (cumulative * circ);
  712. // set the shape
  713. point.shapeType = 'arc';
  714. point.shapeArgs = {
  715. x: positions[0],
  716. y: positions[1],
  717. r: positions[2] / 2,
  718. innerR: positions[3] / 2,
  719. start: Math.round(start * precision) / precision,
  720. end: Math.round(end * precision) / precision
  721. };
  722. // Used for distance calculation for specific point.
  723. point.labelDistance = pick((point.options.dataLabels &&
  724. point.options.dataLabels.distance), labelDistance);
  725. // Compute point.labelDistance if it's defined as percentage
  726. // of slice radius (#8854)
  727. point.labelDistance = relativeLength(point.labelDistance, point.shapeArgs.r);
  728. // Saved for later dataLabels distance calculation.
  729. series.maxLabelDistance = Math.max(series.maxLabelDistance || 0, point.labelDistance);
  730. // The angle must stay within -90 and 270 (#2645)
  731. angle = (end + start) / 2;
  732. if (angle > 1.5 * Math.PI) {
  733. angle -= 2 * Math.PI;
  734. }
  735. else if (angle < -Math.PI / 2) {
  736. angle += 2 * Math.PI;
  737. }
  738. // Center for the sliced out slice
  739. point.slicedTranslation = {
  740. translateX: Math.round(Math.cos(angle) * slicedOffset),
  741. translateY: Math.round(Math.sin(angle) * slicedOffset)
  742. };
  743. // set the anchor point for tooltips
  744. radiusX = Math.cos(angle) * positions[2] / 2;
  745. radiusY = Math.sin(angle) * positions[2] / 2;
  746. point.tooltipPos = [
  747. positions[0] + radiusX * 0.7,
  748. positions[1] + radiusY * 0.7
  749. ];
  750. point.half = angle < -Math.PI / 2 || angle > Math.PI / 2 ?
  751. 1 :
  752. 0;
  753. point.angle = angle;
  754. // Set the anchor point for data labels. Use point.labelDistance
  755. // instead of labelDistance // #1174
  756. // finalConnectorOffset - not override connectorOffset value.
  757. finalConnectorOffset = Math.min(connectorOffset, point.labelDistance / 5); // #1678
  758. point.labelPosition = {
  759. natural: {
  760. // initial position of the data label - it's utilized for
  761. // finding the final position for the label
  762. x: positions[0] + radiusX + Math.cos(angle) *
  763. point.labelDistance,
  764. y: positions[1] + radiusY + Math.sin(angle) *
  765. point.labelDistance
  766. },
  767. 'final': {
  768. // used for generating connector path -
  769. // initialized later in drawDataLabels function
  770. // x: undefined,
  771. // y: undefined
  772. },
  773. // left - pie on the left side of the data label
  774. // right - pie on the right side of the data label
  775. // center - data label overlaps the pie
  776. alignment: point.labelDistance < 0 ?
  777. 'center' : point.half ? 'right' : 'left',
  778. connectorPosition: {
  779. breakAt: {
  780. x: positions[0] + radiusX + Math.cos(angle) *
  781. finalConnectorOffset,
  782. y: positions[1] + radiusY + Math.sin(angle) *
  783. finalConnectorOffset
  784. },
  785. touchingSliceAt: {
  786. x: positions[0] + radiusX,
  787. y: positions[1] + radiusY
  788. }
  789. }
  790. };
  791. }
  792. fireEvent(series, 'afterTranslate');
  793. },
  794. /**
  795. * Called internally to draw auxiliary graph in pie-like series in
  796. * situtation when the default graph is not sufficient enough to present
  797. * the data well. Auxiliary graph is saved in the same object as
  798. * regular graph.
  799. *
  800. * @private
  801. * @function Highcharts.seriesTypes.pie#drawEmpty
  802. */
  803. drawEmpty: function () {
  804. var centerX, centerY, start = this.startAngleRad, end = this.endAngleRad, options = this.options;
  805. // Draw auxiliary graph if there're no visible points.
  806. if (this.total === 0 && this.center) {
  807. centerX = this.center[0];
  808. centerY = this.center[1];
  809. if (!this.graph) {
  810. this.graph = this.chart.renderer
  811. .arc(centerX, centerY, this.center[1] / 2, 0, start, end)
  812. .addClass('highcharts-empty-series')
  813. .add(this.group);
  814. }
  815. this.graph.attr({
  816. d: SVGRenderer.prototype.symbols.arc(centerX, centerY, this.center[2] / 2, 0, {
  817. start: start,
  818. end: end,
  819. innerR: this.center[3] / 2
  820. })
  821. });
  822. if (!this.chart.styledMode) {
  823. this.graph.attr({
  824. 'stroke-width': options.borderWidth,
  825. fill: options.fillColor || 'none',
  826. stroke: options.color ||
  827. '#cccccc'
  828. });
  829. }
  830. }
  831. else if (this.graph) { // Destroy the graph object.
  832. this.graph = this.graph.destroy();
  833. }
  834. },
  835. /**
  836. * Draw the data points
  837. *
  838. * @private
  839. * @function Highcharts.seriesTypes.pie#drawPoints
  840. * @return {void}
  841. */
  842. redrawPoints: function () {
  843. var series = this, chart = series.chart, renderer = chart.renderer, groupTranslation, graphic, pointAttr, shapeArgs, shadow = series.options.shadow;
  844. this.drawEmpty();
  845. if (shadow && !series.shadowGroup && !chart.styledMode) {
  846. series.shadowGroup = renderer.g('shadow')
  847. .attr({ zIndex: -1 })
  848. .add(series.group);
  849. }
  850. // draw the slices
  851. series.points.forEach(function (point) {
  852. var animateTo = {};
  853. graphic = point.graphic;
  854. if (!point.isNull && graphic) {
  855. shapeArgs = point.shapeArgs;
  856. // If the point is sliced, use special translation, else use
  857. // plot area translation
  858. groupTranslation = point.getTranslate();
  859. if (!chart.styledMode) {
  860. // Put the shadow behind all points
  861. var shadowGroup = point.shadowGroup;
  862. if (shadow && !shadowGroup) {
  863. shadowGroup = point.shadowGroup = renderer
  864. .g('shadow')
  865. .add(series.shadowGroup);
  866. }
  867. if (shadowGroup) {
  868. shadowGroup.attr(groupTranslation);
  869. }
  870. pointAttr = series.pointAttribs(point, (point.selected && 'select'));
  871. }
  872. // Draw the slice
  873. if (!point.delayedRendering) {
  874. graphic
  875. .setRadialReference(series.center);
  876. if (!chart.styledMode) {
  877. merge(true, animateTo, pointAttr);
  878. }
  879. merge(true, animateTo, shapeArgs, groupTranslation);
  880. graphic.animate(animateTo);
  881. }
  882. else {
  883. graphic
  884. .setRadialReference(series.center)
  885. .attr(shapeArgs)
  886. .attr(groupTranslation);
  887. if (!chart.styledMode) {
  888. graphic
  889. .attr(pointAttr)
  890. .attr({ 'stroke-linejoin': 'round' })
  891. .shadow(shadow, shadowGroup);
  892. }
  893. point.delayedRendering = false;
  894. }
  895. graphic.attr({
  896. visibility: point.visible ? 'inherit' : 'hidden'
  897. });
  898. graphic.addClass(point.getClassName());
  899. }
  900. else if (graphic) {
  901. point.graphic = graphic.destroy();
  902. }
  903. });
  904. },
  905. /**
  906. * Slices in pie chart are initialized in DOM, but it's shapes and
  907. * animations are normally run in `drawPoints()`.
  908. * @private
  909. */
  910. drawPoints: function () {
  911. var renderer = this.chart.renderer;
  912. this.points.forEach(function (point) {
  913. // When updating a series between 2d and 3d or cartesian and
  914. // polar, the shape type changes.
  915. if (point.graphic && point.hasNewShapeType()) {
  916. point.graphic = point.graphic.destroy();
  917. }
  918. if (!point.graphic) {
  919. point.graphic = renderer[point.shapeType](point.shapeArgs)
  920. .add(point.series.group);
  921. point.delayedRendering = true;
  922. }
  923. });
  924. },
  925. /**
  926. * @private
  927. * @deprecated
  928. * @function Highcharts.seriesTypes.pie#searchPoint
  929. */
  930. searchPoint: noop,
  931. /**
  932. * Utility for sorting data labels
  933. *
  934. * @private
  935. * @function Highcharts.seriesTypes.pie#sortByAngle
  936. * @param {Array<Highcharts.Point>} points
  937. * @param {number} sign
  938. * @return {void}
  939. */
  940. sortByAngle: function (points, sign) {
  941. points.sort(function (a, b) {
  942. return ((typeof a.angle !== 'undefined') &&
  943. (b.angle - a.angle) * sign);
  944. });
  945. },
  946. /**
  947. * Use a simple symbol from LegendSymbolMixin.
  948. *
  949. * @private
  950. * @borrows Highcharts.LegendSymbolMixin.drawRectangle as Highcharts.seriesTypes.pie#drawLegendSymbol
  951. */
  952. drawLegendSymbol: LegendSymbolMixin.drawRectangle,
  953. /**
  954. * Use the getCenter method from drawLegendSymbol.
  955. *
  956. * @private
  957. * @borrows Highcharts.CenteredSeriesMixin.getCenter as Highcharts.seriesTypes.pie#getCenter
  958. */
  959. getCenter: CenteredSeriesMixin.getCenter,
  960. /**
  961. * Pies don't have point marker symbols.
  962. *
  963. * @deprecated
  964. * @private
  965. * @function Highcharts.seriesTypes.pie#getSymbol
  966. */
  967. getSymbol: noop,
  968. /**
  969. * @private
  970. * @type {null}
  971. */
  972. drawGraph: null
  973. },
  974. /**
  975. * @lends seriesTypes.pie.prototype.pointClass.prototype
  976. */
  977. {
  978. /**
  979. * Initialize the pie slice
  980. *
  981. * @private
  982. * @function Highcharts.seriesTypes.pie#pointClass#init
  983. * @return {Highcharts.Point}
  984. */
  985. init: function () {
  986. Point.prototype.init.apply(this, arguments);
  987. var point = this, toggleSlice;
  988. point.name = pick(point.name, 'Slice');
  989. // add event listener for select
  990. toggleSlice = function (e) {
  991. point.slice(e.type === 'select');
  992. };
  993. addEvent(point, 'select', toggleSlice);
  994. addEvent(point, 'unselect', toggleSlice);
  995. return point;
  996. },
  997. /**
  998. * Negative points are not valid (#1530, #3623, #5322)
  999. *
  1000. * @private
  1001. * @function Highcharts.seriesTypes.pie#pointClass#isValid
  1002. * @return {boolean}
  1003. */
  1004. isValid: function () {
  1005. return isNumber(this.y) && this.y >= 0;
  1006. },
  1007. /**
  1008. * Toggle the visibility of the pie slice
  1009. *
  1010. * @private
  1011. * @function Highcharts.seriesTypes.pie#pointClass#setVisible
  1012. * @param {boolean} vis
  1013. * Whether to show the slice or not. If undefined, the visibility
  1014. * is toggled.
  1015. * @param {boolean} [redraw=false]
  1016. * @return {void}
  1017. */
  1018. setVisible: function (vis, redraw) {
  1019. var point = this, series = point.series, chart = series.chart, ignoreHiddenPoint = series.options.ignoreHiddenPoint;
  1020. redraw = pick(redraw, ignoreHiddenPoint);
  1021. if (vis !== point.visible) {
  1022. // If called without an argument, toggle visibility
  1023. point.visible = point.options.visible = vis =
  1024. typeof vis === 'undefined' ? !point.visible : vis;
  1025. // update userOptions.data
  1026. series.options.data[series.data.indexOf(point)] =
  1027. point.options;
  1028. // Show and hide associated elements. This is performed
  1029. // regardless of redraw or not, because chart.redraw only
  1030. // handles full series.
  1031. ['graphic', 'dataLabel', 'connector', 'shadowGroup'].forEach(function (key) {
  1032. if (point[key]) {
  1033. point[key][vis ? 'show' : 'hide'](true);
  1034. }
  1035. });
  1036. if (point.legendItem) {
  1037. chart.legend.colorizeItem(point, vis);
  1038. }
  1039. // #4170, hide halo after hiding point
  1040. if (!vis && point.state === 'hover') {
  1041. point.setState('');
  1042. }
  1043. // Handle ignore hidden slices
  1044. if (ignoreHiddenPoint) {
  1045. series.isDirty = true;
  1046. }
  1047. if (redraw) {
  1048. chart.redraw();
  1049. }
  1050. }
  1051. },
  1052. /**
  1053. * Set or toggle whether the slice is cut out from the pie
  1054. *
  1055. * @private
  1056. * @function Highcharts.seriesTypes.pie#pointClass#slice
  1057. * @param {boolean} sliced
  1058. * When undefined, the slice state is toggled.
  1059. * @param {boolean} redraw
  1060. * Whether to redraw the chart. True by default.
  1061. * @param {boolean|Partial<Highcharts.AnimationOptionsObject>}
  1062. * Animation options.
  1063. * @return {void}
  1064. */
  1065. slice: function (sliced, redraw, animation) {
  1066. var point = this, series = point.series, chart = series.chart;
  1067. setAnimation(animation, chart);
  1068. // redraw is true by default
  1069. redraw = pick(redraw, true);
  1070. /**
  1071. * Pie series only. Whether to display a slice offset from the
  1072. * center.
  1073. * @name Highcharts.Point#sliced
  1074. * @type {boolean|undefined}
  1075. */
  1076. // if called without an argument, toggle
  1077. point.sliced = point.options.sliced = sliced =
  1078. defined(sliced) ? sliced : !point.sliced;
  1079. // update userOptions.data
  1080. series.options.data[series.data.indexOf(point)] =
  1081. point.options;
  1082. if (point.graphic) {
  1083. point.graphic.animate(this.getTranslate());
  1084. }
  1085. if (point.shadowGroup) {
  1086. point.shadowGroup.animate(this.getTranslate());
  1087. }
  1088. },
  1089. /**
  1090. * @private
  1091. * @function Highcharts.seriesTypes.pie#pointClass#getTranslate
  1092. * @return {Highcharts.TranslationAttributes}
  1093. */
  1094. getTranslate: function () {
  1095. return this.sliced ? this.slicedTranslation : {
  1096. translateX: 0,
  1097. translateY: 0
  1098. };
  1099. },
  1100. /**
  1101. * @private
  1102. * @function Highcharts.seriesTypes.pie#pointClass#haloPath
  1103. * @param {number} size
  1104. * @return {Highcharts.SVGPathArray}
  1105. */
  1106. haloPath: function (size) {
  1107. var shapeArgs = this.shapeArgs;
  1108. return this.sliced || !this.visible ?
  1109. [] :
  1110. this.series.chart.renderer.symbols.arc(shapeArgs.x, shapeArgs.y, shapeArgs.r + size, shapeArgs.r + size, {
  1111. // Substract 1px to ensure the background is not bleeding
  1112. // through between the halo and the slice (#7495).
  1113. innerR: shapeArgs.r - 1,
  1114. start: shapeArgs.start,
  1115. end: shapeArgs.end
  1116. });
  1117. },
  1118. connectorShapes: {
  1119. // only one available before v7.0.0
  1120. fixedOffset: function (labelPosition, connectorPosition, options) {
  1121. var breakAt = connectorPosition.breakAt, touchingSliceAt = connectorPosition.touchingSliceAt, lineSegment = options.softConnector ? [
  1122. 'C',
  1123. // 1st control point (of the curve)
  1124. labelPosition.x +
  1125. // 5 gives the connector a little horizontal bend
  1126. (labelPosition.alignment === 'left' ? -5 : 5),
  1127. labelPosition.y,
  1128. 2 * breakAt.x - touchingSliceAt.x,
  1129. 2 * breakAt.y - touchingSliceAt.y,
  1130. breakAt.x,
  1131. breakAt.y //
  1132. ] : [
  1133. 'L',
  1134. breakAt.x,
  1135. breakAt.y
  1136. ];
  1137. // assemble the path
  1138. return ([
  1139. ['M', labelPosition.x, labelPosition.y],
  1140. lineSegment,
  1141. ['L', touchingSliceAt.x, touchingSliceAt.y]
  1142. ]);
  1143. },
  1144. straight: function (labelPosition, connectorPosition) {
  1145. var touchingSliceAt = connectorPosition.touchingSliceAt;
  1146. // direct line to the slice
  1147. return [
  1148. ['M', labelPosition.x, labelPosition.y],
  1149. ['L', touchingSliceAt.x, touchingSliceAt.y]
  1150. ];
  1151. },
  1152. crookedLine: function (labelPosition, connectorPosition, options) {
  1153. var touchingSliceAt = connectorPosition.touchingSliceAt, series = this.series, pieCenterX = series.center[0], plotWidth = series.chart.plotWidth, plotLeft = series.chart.plotLeft, alignment = labelPosition.alignment, radius = this.shapeArgs.r, crookDistance = relativeLength(// % to fraction
  1154. options.crookDistance, 1), crookX = alignment === 'left' ?
  1155. pieCenterX + radius + (plotWidth + plotLeft -
  1156. pieCenterX - radius) * (1 - crookDistance) :
  1157. plotLeft + (pieCenterX - radius) * crookDistance, segmentWithCrook = [
  1158. 'L',
  1159. crookX,
  1160. labelPosition.y
  1161. ], useCrook = true;
  1162. // crookedLine formula doesn't make sense if the path overlaps
  1163. // the label - use straight line instead in that case
  1164. if (alignment === 'left' ?
  1165. (crookX > labelPosition.x || crookX < touchingSliceAt.x) :
  1166. (crookX < labelPosition.x || crookX > touchingSliceAt.x)) {
  1167. useCrook = false;
  1168. }
  1169. // assemble the path
  1170. var path = [
  1171. ['M', labelPosition.x, labelPosition.y]
  1172. ];
  1173. if (useCrook) {
  1174. path.push(segmentWithCrook);
  1175. }
  1176. path.push(['L', touchingSliceAt.x, touchingSliceAt.y]);
  1177. return path;
  1178. }
  1179. },
  1180. /**
  1181. * Extendable method for getting the path of the connector between the
  1182. * data label and the pie slice.
  1183. */
  1184. getConnectorPath: function () {
  1185. var labelPosition = this.labelPosition, options = this.series.options.dataLabels, connectorShape = options.connectorShape, predefinedShapes = this.connectorShapes;
  1186. // find out whether to use the predefined shape
  1187. if (predefinedShapes[connectorShape]) {
  1188. connectorShape = predefinedShapes[connectorShape];
  1189. }
  1190. return connectorShape.call(this, {
  1191. // pass simplified label position object for user's convenience
  1192. x: labelPosition.final.x,
  1193. y: labelPosition.final.y,
  1194. alignment: labelPosition.alignment
  1195. }, labelPosition.connectorPosition, options);
  1196. }
  1197. }
  1198. /* eslint-enable valid-jsdoc */
  1199. );
  1200. /**
  1201. * A `pie` series. If the [type](#series.pie.type) option is not specified,
  1202. * it is inherited from [chart.type](#chart.type).
  1203. *
  1204. * @extends series,plotOptions.pie
  1205. * @excluding cropThreshold, dataParser, dataURL, stack, xAxis, yAxis,
  1206. * dataSorting, step, boostThreshold, boostBlending
  1207. * @product highcharts
  1208. * @apioption series.pie
  1209. */
  1210. /**
  1211. * An array of data points for the series. For the `pie` series type,
  1212. * points can be given in the following ways:
  1213. *
  1214. * 1. An array of numerical values. In this case, the numerical values will be
  1215. * interpreted as `y` options. Example:
  1216. * ```js
  1217. * data: [0, 5, 3, 5]
  1218. * ```
  1219. *
  1220. * 2. An array of objects with named values. The following snippet shows only a
  1221. * few settings, see the complete options set below. If the total number of
  1222. * data points exceeds the series'
  1223. * [turboThreshold](#series.pie.turboThreshold),
  1224. * this option is not available.
  1225. * ```js
  1226. * data: [{
  1227. * y: 1,
  1228. * name: "Point2",
  1229. * color: "#00FF00"
  1230. * }, {
  1231. * y: 7,
  1232. * name: "Point1",
  1233. * color: "#FF00FF"
  1234. * }]
  1235. * ```
  1236. *
  1237. * @sample {highcharts} highcharts/chart/reflow-true/
  1238. * Numerical values
  1239. * @sample {highcharts} highcharts/series/data-array-of-arrays/
  1240. * Arrays of numeric x and y
  1241. * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/
  1242. * Arrays of datetime x and y
  1243. * @sample {highcharts} highcharts/series/data-array-of-name-value/
  1244. * Arrays of point.name and y
  1245. * @sample {highcharts} highcharts/series/data-array-of-objects/
  1246. * Config objects
  1247. *
  1248. * @type {Array<number|Array<string,(number|null)>|null|*>}
  1249. * @extends series.line.data
  1250. * @excluding marker, x
  1251. * @product highcharts
  1252. * @apioption series.pie.data
  1253. */
  1254. /**
  1255. * @type {Highcharts.SeriesPieDataLabelsOptionsObject}
  1256. * @product highcharts
  1257. * @apioption series.pie.data.dataLabels
  1258. */
  1259. /**
  1260. * The sequential index of the data point in the legend.
  1261. *
  1262. * @type {number}
  1263. * @product highcharts
  1264. * @apioption series.pie.data.legendIndex
  1265. */
  1266. /**
  1267. * Whether to display a slice offset from the center.
  1268. *
  1269. * @sample {highcharts} highcharts/point/sliced/
  1270. * One sliced point
  1271. *
  1272. * @type {boolean}
  1273. * @product highcharts
  1274. * @apioption series.pie.data.sliced
  1275. */
  1276. /**
  1277. * @excluding legendItemClick
  1278. * @product highcharts
  1279. * @apioption series.pie.events
  1280. */
  1281. ''; // placeholder for transpiled doclets above