heatmap.src.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799
  1. /**
  2. * @license Highcharts JS v5.0.6 (2016-12-07)
  3. *
  4. * (c) 2009-2016 Torstein Honsi
  5. *
  6. * License: www.highcharts.com/license
  7. */
  8. (function(factory) {
  9. if (typeof module === 'object' && module.exports) {
  10. module.exports = factory;
  11. } else {
  12. factory(Highcharts);
  13. }
  14. }(function(Highcharts) {
  15. (function(H) {
  16. /**
  17. * (c) 2010-2016 Torstein Honsi
  18. *
  19. * License: www.highcharts.com/license
  20. */
  21. 'use strict';
  22. var Axis = H.Axis,
  23. Chart = H.Chart,
  24. color = H.color,
  25. ColorAxis,
  26. each = H.each,
  27. extend = H.extend,
  28. isNumber = H.isNumber,
  29. Legend = H.Legend,
  30. LegendSymbolMixin = H.LegendSymbolMixin,
  31. noop = H.noop,
  32. merge = H.merge,
  33. pick = H.pick,
  34. wrap = H.wrap;
  35. /**
  36. * The ColorAxis object for inclusion in gradient legends
  37. */
  38. ColorAxis = H.ColorAxis = function() {
  39. this.init.apply(this, arguments);
  40. };
  41. extend(ColorAxis.prototype, Axis.prototype);
  42. extend(ColorAxis.prototype, {
  43. defaultColorAxisOptions: {
  44. lineWidth: 0,
  45. minPadding: 0,
  46. maxPadding: 0,
  47. gridLineWidth: 1,
  48. tickPixelInterval: 72,
  49. startOnTick: true,
  50. endOnTick: true,
  51. offset: 0,
  52. marker: {
  53. animation: {
  54. duration: 50
  55. },
  56. width: 0.01
  57. },
  58. labels: {
  59. overflow: 'justify'
  60. },
  61. minColor: '#e6ebf5',
  62. maxColor: '#003399',
  63. tickLength: 5,
  64. showInLegend: true
  65. },
  66. // Properties to preserve after destroy, for Axis.update (#5881)
  67. keepProps: ['legendGroup', 'legendItem', 'legendSymbol']
  68. .concat(Axis.prototype.keepProps),
  69. /**
  70. * Initialize the color axis
  71. */
  72. init: function(chart, userOptions) {
  73. var horiz = chart.options.legend.layout !== 'vertical',
  74. options;
  75. this.coll = 'colorAxis';
  76. // Build the options
  77. options = merge(this.defaultColorAxisOptions, {
  78. side: horiz ? 2 : 1,
  79. reversed: !horiz
  80. }, userOptions, {
  81. opposite: !horiz,
  82. showEmpty: false,
  83. title: null
  84. });
  85. Axis.prototype.init.call(this, chart, options);
  86. // Base init() pushes it to the xAxis array, now pop it again
  87. //chart[this.isXAxis ? 'xAxis' : 'yAxis'].pop();
  88. // Prepare data classes
  89. if (userOptions.dataClasses) {
  90. this.initDataClasses(userOptions);
  91. }
  92. this.initStops(userOptions);
  93. // Override original axis properties
  94. this.horiz = horiz;
  95. this.zoomEnabled = false;
  96. // Add default values
  97. this.defaultLegendLength = 200;
  98. },
  99. /*
  100. * Return an intermediate color between two colors, according to pos where 0
  101. * is the from color and 1 is the to color.
  102. * NOTE: Changes here should be copied
  103. * to the same function in drilldown.src.js and solid-gauge-src.js.
  104. */
  105. tweenColors: function(from, to, pos) {
  106. // Check for has alpha, because rgba colors perform worse due to lack of
  107. // support in WebKit.
  108. var hasAlpha,
  109. ret;
  110. // Unsupported color, return to-color (#3920)
  111. if (!to.rgba.length || !from.rgba.length) {
  112. ret = to.input || 'none';
  113. // Interpolate
  114. } else {
  115. from = from.rgba;
  116. to = to.rgba;
  117. hasAlpha = (to[3] !== 1 || from[3] !== 1);
  118. ret = (hasAlpha ? 'rgba(' : 'rgb(') +
  119. Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
  120. Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
  121. Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
  122. (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
  123. }
  124. return ret;
  125. },
  126. initDataClasses: function(userOptions) {
  127. var axis = this,
  128. chart = this.chart,
  129. dataClasses,
  130. colorCounter = 0,
  131. colorCount = chart.options.chart.colorCount,
  132. options = this.options,
  133. len = userOptions.dataClasses.length;
  134. this.dataClasses = dataClasses = [];
  135. this.legendItems = [];
  136. each(userOptions.dataClasses, function(dataClass, i) {
  137. var colors;
  138. dataClass = merge(dataClass);
  139. dataClasses.push(dataClass);
  140. if (!dataClass.color) {
  141. if (options.dataClassColor === 'category') {
  142. dataClass.colorIndex = colorCounter;
  143. // increase and loop back to zero
  144. colorCounter++;
  145. if (colorCounter === colorCount) {
  146. colorCounter = 0;
  147. }
  148. } else {
  149. dataClass.color = axis.tweenColors(
  150. color(options.minColor),
  151. color(options.maxColor),
  152. len < 2 ? 0.5 : i / (len - 1) // #3219
  153. );
  154. }
  155. }
  156. });
  157. },
  158. initStops: function(userOptions) {
  159. this.stops = userOptions.stops || [
  160. [0, this.options.minColor],
  161. [1, this.options.maxColor]
  162. ];
  163. each(this.stops, function(stop) {
  164. stop.color = color(stop[1]);
  165. });
  166. },
  167. /**
  168. * Extend the setOptions method to process extreme colors and color
  169. * stops.
  170. */
  171. setOptions: function(userOptions) {
  172. Axis.prototype.setOptions.call(this, userOptions);
  173. this.options.crosshair = this.options.marker;
  174. },
  175. setAxisSize: function() {
  176. var symbol = this.legendSymbol,
  177. chart = this.chart,
  178. legendOptions = chart.options.legend || {},
  179. x,
  180. y,
  181. width,
  182. height;
  183. if (symbol) {
  184. this.left = x = symbol.attr('x');
  185. this.top = y = symbol.attr('y');
  186. this.width = width = symbol.attr('width');
  187. this.height = height = symbol.attr('height');
  188. this.right = chart.chartWidth - x - width;
  189. this.bottom = chart.chartHeight - y - height;
  190. this.len = this.horiz ? width : height;
  191. this.pos = this.horiz ? x : y;
  192. } else {
  193. // Fake length for disabled legend to avoid tick issues and such (#5205)
  194. this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength;
  195. }
  196. },
  197. /**
  198. * Translate from a value to a color
  199. */
  200. toColor: function(value, point) {
  201. var pos,
  202. stops = this.stops,
  203. from,
  204. to,
  205. color,
  206. dataClasses = this.dataClasses,
  207. dataClass,
  208. i;
  209. if (dataClasses) {
  210. i = dataClasses.length;
  211. while (i--) {
  212. dataClass = dataClasses[i];
  213. from = dataClass.from;
  214. to = dataClass.to;
  215. if ((from === undefined || value >= from) && (to === undefined || value <= to)) {
  216. color = dataClass.color;
  217. if (point) {
  218. point.dataClass = i;
  219. point.colorIndex = dataClass.colorIndex;
  220. }
  221. break;
  222. }
  223. }
  224. } else {
  225. if (this.isLog) {
  226. value = this.val2lin(value);
  227. }
  228. pos = 1 - ((this.max - value) / ((this.max - this.min) || 1));
  229. i = stops.length;
  230. while (i--) {
  231. if (pos > stops[i][0]) {
  232. break;
  233. }
  234. }
  235. from = stops[i] || stops[i + 1];
  236. to = stops[i + 1] || from;
  237. // The position within the gradient
  238. pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
  239. color = this.tweenColors(
  240. from.color,
  241. to.color,
  242. pos
  243. );
  244. }
  245. return color;
  246. },
  247. /**
  248. * Override the getOffset method to add the whole axis groups inside the legend.
  249. */
  250. getOffset: function() {
  251. var group = this.legendGroup,
  252. sideOffset = this.chart.axisOffset[this.side];
  253. if (group) {
  254. // Hook for the getOffset method to add groups to this parent group
  255. this.axisParent = group;
  256. // Call the base
  257. Axis.prototype.getOffset.call(this);
  258. // First time only
  259. if (!this.added) {
  260. this.added = true;
  261. this.labelLeft = 0;
  262. this.labelRight = this.width;
  263. }
  264. // Reset it to avoid color axis reserving space
  265. this.chart.axisOffset[this.side] = sideOffset;
  266. }
  267. },
  268. /**
  269. * Create the color gradient
  270. */
  271. setLegendColor: function() {
  272. var grad,
  273. horiz = this.horiz,
  274. options = this.options,
  275. reversed = this.reversed,
  276. one = reversed ? 1 : 0,
  277. zero = reversed ? 0 : 1;
  278. grad = horiz ? [one, 0, zero, 0] : [0, zero, 0, one]; // #3190
  279. this.legendColor = {
  280. linearGradient: {
  281. x1: grad[0],
  282. y1: grad[1],
  283. x2: grad[2],
  284. y2: grad[3]
  285. },
  286. stops: options.stops || [
  287. [0, options.minColor],
  288. [1, options.maxColor]
  289. ]
  290. };
  291. },
  292. /**
  293. * The color axis appears inside the legend and has its own legend symbol
  294. */
  295. drawLegendSymbol: function(legend, item) {
  296. var padding = legend.padding,
  297. legendOptions = legend.options,
  298. horiz = this.horiz,
  299. width = pick(legendOptions.symbolWidth, horiz ? this.defaultLegendLength : 12),
  300. height = pick(legendOptions.symbolHeight, horiz ? 12 : this.defaultLegendLength),
  301. labelPadding = pick(legendOptions.labelPadding, horiz ? 16 : 30),
  302. itemDistance = pick(legendOptions.itemDistance, 10);
  303. this.setLegendColor();
  304. // Create the gradient
  305. item.legendSymbol = this.chart.renderer.rect(
  306. 0,
  307. legend.baseline - 11,
  308. width,
  309. height
  310. ).attr({
  311. zIndex: 1
  312. }).add(item.legendGroup);
  313. // Set how much space this legend item takes up
  314. this.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding);
  315. this.legendItemHeight = height + padding + (horiz ? labelPadding : 0);
  316. },
  317. /**
  318. * Fool the legend
  319. */
  320. setState: noop,
  321. visible: true,
  322. setVisible: noop,
  323. getSeriesExtremes: function() {
  324. var series;
  325. if (this.series.length) {
  326. series = this.series[0];
  327. this.dataMin = series.valueMin;
  328. this.dataMax = series.valueMax;
  329. }
  330. },
  331. drawCrosshair: function(e, point) {
  332. var plotX = point && point.plotX,
  333. plotY = point && point.plotY,
  334. crossPos,
  335. axisPos = this.pos,
  336. axisLen = this.len;
  337. if (point) {
  338. crossPos = this.toPixels(point[point.series.colorKey]);
  339. if (crossPos < axisPos) {
  340. crossPos = axisPos - 2;
  341. } else if (crossPos > axisPos + axisLen) {
  342. crossPos = axisPos + axisLen + 2;
  343. }
  344. point.plotX = crossPos;
  345. point.plotY = this.len - crossPos;
  346. Axis.prototype.drawCrosshair.call(this, e, point);
  347. point.plotX = plotX;
  348. point.plotY = plotY;
  349. if (this.cross) {
  350. this.cross
  351. .addClass('highcharts-coloraxis-marker')
  352. .add(this.legendGroup);
  353. }
  354. }
  355. },
  356. getPlotLinePath: function(a, b, c, d, pos) {
  357. return isNumber(pos) ? // crosshairs only // #3969 pos can be 0 !!
  358. (this.horiz ? ['M', pos - 4, this.top - 6, 'L', pos + 4, this.top - 6, pos, this.top, 'Z'] : ['M', this.left, pos, 'L', this.left - 6, pos + 6, this.left - 6, pos - 6, 'Z']) :
  359. Axis.prototype.getPlotLinePath.call(this, a, b, c, d);
  360. },
  361. update: function(newOptions, redraw) {
  362. var chart = this.chart,
  363. legend = chart.legend;
  364. each(this.series, function(series) {
  365. series.isDirtyData = true; // Needed for Axis.update when choropleth colors change
  366. });
  367. // When updating data classes, destroy old items and make sure new ones are created (#3207)
  368. if (newOptions.dataClasses && legend.allItems) {
  369. each(legend.allItems, function(item) {
  370. if (item.isDataClass) {
  371. item.legendGroup.destroy();
  372. }
  373. });
  374. chart.isDirtyLegend = true;
  375. }
  376. // Keep the options structure updated for export. Unlike xAxis and yAxis, the colorAxis is
  377. // not an array. (#3207)
  378. chart.options[this.coll] = merge(this.userOptions, newOptions);
  379. Axis.prototype.update.call(this, newOptions, redraw);
  380. if (this.legendItem) {
  381. this.setLegendColor();
  382. legend.colorizeItem(this, true);
  383. }
  384. },
  385. /**
  386. * Get the legend item symbols for data classes
  387. */
  388. getDataClassLegendSymbols: function() {
  389. var axis = this,
  390. chart = this.chart,
  391. legendItems = this.legendItems,
  392. legendOptions = chart.options.legend,
  393. valueDecimals = legendOptions.valueDecimals,
  394. valueSuffix = legendOptions.valueSuffix || '',
  395. name;
  396. if (!legendItems.length) {
  397. each(this.dataClasses, function(dataClass, i) {
  398. var vis = true,
  399. from = dataClass.from,
  400. to = dataClass.to;
  401. // Assemble the default name. This can be overridden by legend.options.labelFormatter
  402. name = '';
  403. if (from === undefined) {
  404. name = '< ';
  405. } else if (to === undefined) {
  406. name = '> ';
  407. }
  408. if (from !== undefined) {
  409. name += H.numberFormat(from, valueDecimals) + valueSuffix;
  410. }
  411. if (from !== undefined && to !== undefined) {
  412. name += ' - ';
  413. }
  414. if (to !== undefined) {
  415. name += H.numberFormat(to, valueDecimals) + valueSuffix;
  416. }
  417. // Add a mock object to the legend items
  418. legendItems.push(extend({
  419. chart: chart,
  420. name: name,
  421. options: {},
  422. drawLegendSymbol: LegendSymbolMixin.drawRectangle,
  423. visible: true,
  424. setState: noop,
  425. isDataClass: true,
  426. setVisible: function() {
  427. vis = this.visible = !vis;
  428. each(axis.series, function(series) {
  429. each(series.points, function(point) {
  430. if (point.dataClass === i) {
  431. point.setVisible(vis);
  432. }
  433. });
  434. });
  435. chart.legend.colorizeItem(this, vis);
  436. }
  437. }, dataClass));
  438. });
  439. }
  440. return legendItems;
  441. },
  442. name: '' // Prevents 'undefined' in legend in IE8
  443. });
  444. /**
  445. * Handle animation of the color attributes directly
  446. */
  447. each(['fill', 'stroke'], function(prop) {
  448. H.Fx.prototype[prop + 'Setter'] = function() {
  449. this.elem.attr(
  450. prop,
  451. ColorAxis.prototype.tweenColors(
  452. color(this.start),
  453. color(this.end),
  454. this.pos
  455. ),
  456. null,
  457. true
  458. );
  459. };
  460. });
  461. /**
  462. * Extend the chart getAxes method to also get the color axis
  463. */
  464. wrap(Chart.prototype, 'getAxes', function(proceed) {
  465. var options = this.options,
  466. colorAxisOptions = options.colorAxis;
  467. proceed.call(this);
  468. this.colorAxis = [];
  469. if (colorAxisOptions) {
  470. new ColorAxis(this, colorAxisOptions); // eslint-disable-line no-new
  471. }
  472. });
  473. /**
  474. * Wrap the legend getAllItems method to add the color axis. This also removes the
  475. * axis' own series to prevent them from showing up individually.
  476. */
  477. wrap(Legend.prototype, 'getAllItems', function(proceed) {
  478. var allItems = [],
  479. colorAxis = this.chart.colorAxis[0];
  480. if (colorAxis && colorAxis.options) {
  481. if (colorAxis.options.showInLegend) {
  482. // Data classes
  483. if (colorAxis.options.dataClasses) {
  484. allItems = allItems.concat(colorAxis.getDataClassLegendSymbols());
  485. // Gradient legend
  486. } else {
  487. // Add this axis on top
  488. allItems.push(colorAxis);
  489. }
  490. }
  491. // Don't add the color axis' series
  492. each(colorAxis.series, function(series) {
  493. series.options.showInLegend = false;
  494. });
  495. }
  496. return allItems.concat(proceed.call(this));
  497. });
  498. wrap(Legend.prototype, 'colorizeItem', function(proceed, item, visible) {
  499. proceed.call(this, item, visible);
  500. if (visible && item.legendColor) {
  501. item.legendSymbol.attr({
  502. fill: item.legendColor
  503. });
  504. }
  505. });
  506. }(Highcharts));
  507. (function(H) {
  508. /**
  509. * (c) 2010-2016 Torstein Honsi
  510. *
  511. * License: www.highcharts.com/license
  512. */
  513. 'use strict';
  514. var defined = H.defined,
  515. each = H.each,
  516. noop = H.noop,
  517. seriesTypes = H.seriesTypes;
  518. /**
  519. * Mixin for maps and heatmaps
  520. */
  521. H.colorPointMixin = {
  522. /**
  523. * Color points have a value option that determines whether or not it is a null point
  524. */
  525. isValid: function() {
  526. return this.value !== null;
  527. },
  528. /**
  529. * Set the visibility of a single point
  530. */
  531. setVisible: function(vis) {
  532. var point = this,
  533. method = vis ? 'show' : 'hide';
  534. // Show and hide associated elements
  535. each(['graphic', 'dataLabel'], function(key) {
  536. if (point[key]) {
  537. point[key][method]();
  538. }
  539. });
  540. },
  541. setState: function(state) {
  542. H.Point.prototype.setState.call(this, state);
  543. if (this.graphic) {
  544. this.graphic.attr({
  545. zIndex: state === 'hover' ? 1 : 0
  546. });
  547. }
  548. }
  549. };
  550. H.colorSeriesMixin = {
  551. pointArrayMap: ['value'],
  552. axisTypes: ['xAxis', 'yAxis', 'colorAxis'],
  553. optionalAxis: 'colorAxis',
  554. trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
  555. getSymbol: noop,
  556. parallelArrays: ['x', 'y', 'value'],
  557. colorKey: 'value',
  558. /**
  559. * In choropleth maps, the color is a result of the value, so this needs translation too
  560. */
  561. translateColors: function() {
  562. var series = this,
  563. nullColor = this.options.nullColor,
  564. colorAxis = this.colorAxis,
  565. colorKey = this.colorKey;
  566. each(this.data, function(point) {
  567. var value = point[colorKey],
  568. color;
  569. color = point.options.color ||
  570. (point.isNull ? nullColor : (colorAxis && value !== undefined) ? colorAxis.toColor(value, point) : point.color || series.color);
  571. if (color) {
  572. point.color = color;
  573. }
  574. });
  575. },
  576. /**
  577. * Get the color attibutes to apply on the graphic
  578. */
  579. colorAttribs: function(point) {
  580. var ret = {};
  581. if (defined(point.color)) {
  582. ret[this.colorProp || 'fill'] = point.color;
  583. }
  584. return ret;
  585. }
  586. };
  587. }(Highcharts));
  588. (function(H) {
  589. /**
  590. * (c) 2010-2016 Torstein Honsi
  591. *
  592. * License: www.highcharts.com/license
  593. */
  594. 'use strict';
  595. var colorPointMixin = H.colorPointMixin,
  596. colorSeriesMixin = H.colorSeriesMixin,
  597. each = H.each,
  598. LegendSymbolMixin = H.LegendSymbolMixin,
  599. merge = H.merge,
  600. noop = H.noop,
  601. pick = H.pick,
  602. Series = H.Series,
  603. seriesType = H.seriesType,
  604. seriesTypes = H.seriesTypes;
  605. // The Heatmap series type
  606. seriesType('heatmap', 'scatter', {
  607. animation: false,
  608. borderWidth: 0,
  609. dataLabels: {
  610. formatter: function() { // #2945
  611. return this.point.value;
  612. },
  613. inside: true,
  614. verticalAlign: 'middle',
  615. crop: false,
  616. overflow: false,
  617. padding: 0 // #3837
  618. },
  619. marker: null,
  620. pointRange: null, // dynamically set to colsize by default
  621. tooltip: {
  622. pointFormat: '{point.x}, {point.y}: {point.value}<br/>'
  623. },
  624. states: {
  625. normal: {
  626. animation: true
  627. },
  628. hover: {
  629. halo: false, // #3406, halo is not required on heatmaps
  630. brightness: 0.2
  631. }
  632. }
  633. }, merge(colorSeriesMixin, {
  634. pointArrayMap: ['y', 'value'],
  635. hasPointSpecificOptions: true,
  636. supportsDrilldown: true,
  637. getExtremesFromAll: true,
  638. directTouch: true,
  639. /**
  640. * Override the init method to add point ranges on both axes.
  641. */
  642. init: function() {
  643. var options;
  644. seriesTypes.scatter.prototype.init.apply(this, arguments);
  645. options = this.options;
  646. options.pointRange = pick(options.pointRange, options.colsize || 1); // #3758, prevent resetting in setData
  647. this.yAxis.axisPointRange = options.rowsize || 1; // general point range
  648. },
  649. translate: function() {
  650. var series = this,
  651. options = series.options,
  652. xAxis = series.xAxis,
  653. yAxis = series.yAxis,
  654. between = function(x, a, b) {
  655. return Math.min(Math.max(a, x), b);
  656. };
  657. series.generatePoints();
  658. each(series.points, function(point) {
  659. var xPad = (options.colsize || 1) / 2,
  660. yPad = (options.rowsize || 1) / 2,
  661. x1 = between(Math.round(xAxis.len - xAxis.translate(point.x - xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
  662. x2 = between(Math.round(xAxis.len - xAxis.translate(point.x + xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
  663. y1 = between(Math.round(yAxis.translate(point.y - yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len),
  664. y2 = between(Math.round(yAxis.translate(point.y + yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len);
  665. // Set plotX and plotY for use in K-D-Tree and more
  666. point.plotX = point.clientX = (x1 + x2) / 2;
  667. point.plotY = (y1 + y2) / 2;
  668. point.shapeType = 'rect';
  669. point.shapeArgs = {
  670. x: Math.min(x1, x2),
  671. y: Math.min(y1, y2),
  672. width: Math.abs(x2 - x1),
  673. height: Math.abs(y2 - y1)
  674. };
  675. });
  676. series.translateColors();
  677. },
  678. drawPoints: function() {
  679. seriesTypes.column.prototype.drawPoints.call(this);
  680. each(this.points, function(point) {
  681. // In styled mode, use CSS, otherwise the fill used in the style
  682. // sheet will take precesence over the fill attribute.
  683. point.graphic.css(this.colorAttribs(point));
  684. }, this);
  685. },
  686. animate: noop,
  687. getBox: noop,
  688. drawLegendSymbol: LegendSymbolMixin.drawRectangle,
  689. alignDataLabel: seriesTypes.column.prototype.alignDataLabel,
  690. getExtremes: function() {
  691. // Get the extremes from the value data
  692. Series.prototype.getExtremes.call(this, this.valueData);
  693. this.valueMin = this.dataMin;
  694. this.valueMax = this.dataMax;
  695. // Get the extremes from the y data
  696. Series.prototype.getExtremes.call(this);
  697. }
  698. }), colorPointMixin);
  699. }(Highcharts));
  700. }));