Best JavaScript code snippet using best
PlotLineOrBand.js
Source:PlotLineOrBand.js
1/* *2 *3 * (c) 2010-2021 Torstein Honsi4 *5 * License: www.highcharts.com/license6 *7 * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!8 *9 * */10'use strict';11import Axis from './Axis.js';12import palette from '../../Core/Color/Palette.js';13/**14 * Options for plot bands on axes.15 *16 * @typedef {Highcharts.XAxisPlotBandsOptions|Highcharts.YAxisPlotBandsOptions|Highcharts.ZAxisPlotBandsOptions} Highcharts.AxisPlotBandsOptions17 */18/**19 * Options for plot band labels on axes.20 *21 * @typedef {Highcharts.XAxisPlotBandsLabelOptions|Highcharts.YAxisPlotBandsLabelOptions|Highcharts.ZAxisPlotBandsLabelOptions} Highcharts.AxisPlotBandsLabelOptions22 */23/**24 * Options for plot lines on axes.25 *26 * @typedef {Highcharts.XAxisPlotLinesOptions|Highcharts.YAxisPlotLinesOptions|Highcharts.ZAxisPlotLinesOptions} Highcharts.AxisPlotLinesOptions27 */28/**29 * Options for plot line labels on axes.30 *31 * @typedef {Highcharts.XAxisPlotLinesLabelOptions|Highcharts.YAxisPlotLinesLabelOptions|Highcharts.ZAxisPlotLinesLabelOptions} Highcharts.AxisPlotLinesLabelOptions32 */33import U from '../Utilities.js';34var arrayMax = U.arrayMax, arrayMin = U.arrayMin, defined = U.defined, destroyObjectProperties = U.destroyObjectProperties, erase = U.erase, extend = U.extend, fireEvent = U.fireEvent, isNumber = U.isNumber, merge = U.merge, objectEach = U.objectEach, pick = U.pick;35/* eslint-disable no-invalid-this, valid-jsdoc */36/**37 * The object wrapper for plot lines and plot bands38 *39 * @class40 * @name Highcharts.PlotLineOrBand41 *42 * @param {Highcharts.Axis} axis43 *44 * @param {Highcharts.AxisPlotLinesOptions|Highcharts.AxisPlotBandsOptions} [options]45 */46var PlotLineOrBand = /** @class */ (function () {47 function PlotLineOrBand(axis, options) {48 this.axis = axis;49 if (options) {50 this.options = options;51 this.id = options.id;52 }53 }54 /**55 * Render the plot line or plot band. If it is already existing,56 * move it.57 *58 * @private59 * @function Highcharts.PlotLineOrBand#render60 * @return {Highcharts.PlotLineOrBand|undefined}61 */62 PlotLineOrBand.prototype.render = function () {63 fireEvent(this, 'render');64 var plotLine = this, axis = plotLine.axis, horiz = axis.horiz, log = axis.logarithmic, options = plotLine.options, optionsLabel = options.label, label = plotLine.label, to = options.to, from = options.from, value = options.value, isBand = defined(from) && defined(to), isLine = defined(value), svgElem = plotLine.svgElem, isNew = !svgElem, path = [], color = options.color, zIndex = pick(options.zIndex, 0), events = options.events, attribs = {65 'class': 'highcharts-plot-' + (isBand ? 'band ' : 'line ') +66 (options.className || '')67 }, groupAttribs = {}, renderer = axis.chart.renderer, groupName = isBand ? 'bands' : 'lines', group;68 // logarithmic conversion69 if (log) {70 from = log.log2lin(from);71 to = log.log2lin(to);72 value = log.log2lin(value);73 }74 // Set the presentational attributes75 if (!axis.chart.styledMode) {76 if (isLine) {77 attribs.stroke = color || palette.neutralColor40;78 attribs['stroke-width'] = pick(options.width, 1);79 if (options.dashStyle) {80 attribs.dashstyle =81 options.dashStyle;82 }83 }84 else if (isBand) { // plot band85 attribs.fill = color || palette.highlightColor10;86 if (options.borderWidth) {87 attribs.stroke = options.borderColor;88 attribs['stroke-width'] = options.borderWidth;89 }90 }91 }92 // Grouping and zIndex93 groupAttribs.zIndex = zIndex;94 groupName += '-' + zIndex;95 group = axis.plotLinesAndBandsGroups[groupName];96 if (!group) {97 axis.plotLinesAndBandsGroups[groupName] = group =98 renderer.g('plot-' + groupName)99 .attr(groupAttribs).add();100 }101 // Create the path102 if (isNew) {103 /**104 * SVG element of the plot line or band.105 *106 * @name Highcharts.PlotLineOrBand#svgElement107 * @type {Highcharts.SVGElement}108 */109 plotLine.svgElem = svgElem = renderer110 .path()111 .attr(attribs)112 .add(group);113 }114 // Set the path or return115 if (isLine) {116 path = axis.getPlotLinePath({117 value: value,118 lineWidth: svgElem.strokeWidth(),119 acrossPanes: options.acrossPanes120 });121 }122 else if (isBand) { // plot band123 path = axis.getPlotBandPath(from, to, options);124 }125 else {126 return;127 }128 // common for lines and bands129 // Add events only if they were not added before.130 if (!plotLine.eventsAdded && events) {131 objectEach(events, function (event, eventType) {132 svgElem.on(eventType, function (e) {133 events[eventType].apply(plotLine, [e]);134 });135 });136 plotLine.eventsAdded = true;137 }138 if ((isNew || !svgElem.d) && path && path.length) {139 svgElem.attr({ d: path });140 }141 else if (svgElem) {142 if (path) {143 svgElem.show(true);144 svgElem.animate({ d: path });145 }146 else if (svgElem.d) {147 svgElem.hide();148 if (label) {149 plotLine.label = label = label.destroy();150 }151 }152 }153 // the plot band/line label154 if (optionsLabel &&155 (defined(optionsLabel.text) || defined(optionsLabel.formatter)) &&156 path &&157 path.length &&158 axis.width > 0 &&159 axis.height > 0 &&160 !path.isFlat) {161 // apply defaults162 optionsLabel = merge({163 align: horiz && isBand && 'center',164 x: horiz ? !isBand && 4 : 10,165 verticalAlign: !horiz && isBand && 'middle',166 y: horiz ? isBand ? 16 : 10 : isBand ? 6 : -4,167 rotation: horiz && !isBand && 90168 }, optionsLabel);169 this.renderLabel(optionsLabel, path, isBand, zIndex);170 }171 else if (label) { // move out of sight172 label.hide();173 }174 // chainable175 return plotLine;176 };177 /**178 * Render and align label for plot line or band.179 *180 * @private181 * @function Highcharts.PlotLineOrBand#renderLabel182 * @param {Highcharts.AxisPlotLinesLabelOptions|Highcharts.AxisPlotBandsLabelOptions} optionsLabel183 * @param {Highcharts.SVGPathArray} path184 * @param {boolean} [isBand]185 * @param {number} [zIndex]186 * @return {void}187 */188 PlotLineOrBand.prototype.renderLabel = function (optionsLabel, path, isBand, zIndex) {189 var plotLine = this, label = plotLine.label, renderer = plotLine.axis.chart.renderer, attribs, xBounds, yBounds, x, y, labelText;190 // add the SVG element191 if (!label) {192 attribs = {193 align: optionsLabel.textAlign || optionsLabel.align,194 rotation: optionsLabel.rotation,195 'class': 'highcharts-plot-' + (isBand ? 'band' : 'line') +196 '-label ' + (optionsLabel.className || '')197 };198 attribs.zIndex = zIndex;199 labelText = this.getLabelText(optionsLabel);200 /**201 * SVG element of the label.202 *203 * @name Highcharts.PlotLineOrBand#label204 * @type {Highcharts.SVGElement}205 */206 plotLine.label = label = renderer207 .text(labelText, 0, 0, optionsLabel.useHTML)208 .attr(attribs)209 .add();210 if (!this.axis.chart.styledMode) {211 label.css(optionsLabel.style);212 }213 }214 // get the bounding box and align the label215 // #3000 changed to better handle choice between plotband or plotline216 xBounds = path.xBounds ||217 [path[0][1], path[1][1], (isBand ? path[2][1] : path[0][1])];218 yBounds = path.yBounds ||219 [path[0][2], path[1][2], (isBand ? path[2][2] : path[0][2])];220 x = arrayMin(xBounds);221 y = arrayMin(yBounds);222 label.align(optionsLabel, false, {223 x: x,224 y: y,225 width: arrayMax(xBounds) - x,226 height: arrayMax(yBounds) - y227 });228 label.show(true);229 };230 /**231 * Get label's text content.232 *233 * @private234 * @function Highcharts.PlotLineOrBand#getLabelText235 * @param {Highcharts.AxisPlotLinesLabelOptions|Highcharts.AxisPlotBandsLabelOptions} optionsLabel236 * @return {string}237 */238 PlotLineOrBand.prototype.getLabelText = function (optionsLabel) {239 return defined(optionsLabel.formatter) ?240 optionsLabel.formatter241 .call(this) :242 optionsLabel.text;243 };244 /**245 * Remove the plot line or band.246 *247 * @function Highcharts.PlotLineOrBand#destroy248 * @return {void}249 */250 PlotLineOrBand.prototype.destroy = function () {251 // remove it from the lookup252 erase(this.axis.plotLinesAndBands, this);253 delete this.axis;254 destroyObjectProperties(this);255 };256 return PlotLineOrBand;257}());258/* eslint-enable no-invalid-this, valid-jsdoc */259// Object with members for extending the Axis prototype260extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {261 /**262 * An array of colored bands stretching across the plot area marking an263 * interval on the axis.264 *265 * In styled mode, the plot bands are styled by the `.highcharts-plot-band`266 * class in addition to the `className` option.267 *268 * @productdesc {highcharts}269 * In a gauge, a plot band on the Y axis (value axis) will stretch along the270 * perimeter of the gauge.271 *272 * @type {Array<*>}273 * @product highcharts highstock gantt274 * @apioption xAxis.plotBands275 */276 /**277 * Flag to decide if plotBand should be rendered across all panes.278 *279 * @since 7.1.2280 * @product highstock281 * @type {boolean}282 * @default true283 * @apioption xAxis.plotBands.acrossPanes284 */285 /**286 * Border color for the plot band. Also requires `borderWidth` to be set.287 *288 * @type {Highcharts.ColorString}289 * @apioption xAxis.plotBands.borderColor290 */291 /**292 * Border width for the plot band. Also requires `borderColor` to be set.293 *294 * @type {number}295 * @default 0296 * @apioption xAxis.plotBands.borderWidth297 */298 /**299 * A custom class name, in addition to the default `highcharts-plot-band`,300 * to apply to each individual band.301 *302 * @type {string}303 * @since 5.0.0304 * @apioption xAxis.plotBands.className305 */306 /**307 * The color of the plot band.308 *309 * @sample {highcharts} highcharts/xaxis/plotbands-color/310 * Color band311 * @sample {highstock} stock/xaxis/plotbands/312 * Plot band on Y axis313 *314 * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}315 * @default ${palette.highlightColor10}316 * @apioption xAxis.plotBands.color317 */318 /**319 * An object defining mouse events for the plot band. Supported properties320 * are `click`, `mouseover`, `mouseout`, `mousemove`.321 *322 * @sample {highcharts} highcharts/xaxis/plotbands-events/323 * Mouse events demonstrated324 *325 * @since 1.2326 * @apioption xAxis.plotBands.events327 */328 /**329 * Click event on a plot band.330 *331 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}332 * @apioption xAxis.plotBands.events.click333 */334 /**335 * Mouse move event on a plot band.336 *337 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}338 * @apioption xAxis.plotBands.events.mousemove339 */340 /**341 * Mouse out event on the corner of a plot band.342 *343 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}344 * @apioption xAxis.plotBands.events.mouseout345 */346 /**347 * Mouse over event on a plot band.348 *349 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}350 * @apioption xAxis.plotBands.events.mouseover351 */352 /**353 * The start position of the plot band in axis units.354 *355 * @sample {highcharts} highcharts/xaxis/plotbands-color/356 * Datetime axis357 * @sample {highcharts} highcharts/xaxis/plotbands-from/358 * Categorized axis359 * @sample {highstock} stock/xaxis/plotbands/360 * Plot band on Y axis361 *362 * @type {number}363 * @apioption xAxis.plotBands.from364 */365 /**366 * An id used for identifying the plot band in Axis.removePlotBand.367 *368 * @sample {highcharts} highcharts/xaxis/plotbands-id/369 * Remove plot band by id370 * @sample {highstock} highcharts/xaxis/plotbands-id/371 * Remove plot band by id372 *373 * @type {string}374 * @apioption xAxis.plotBands.id375 */376 /**377 * The end position of the plot band in axis units.378 *379 * @sample {highcharts} highcharts/xaxis/plotbands-color/380 * Datetime axis381 * @sample {highcharts} highcharts/xaxis/plotbands-from/382 * Categorized axis383 * @sample {highstock} stock/xaxis/plotbands/384 * Plot band on Y axis385 *386 * @type {number}387 * @apioption xAxis.plotBands.to388 */389 /**390 * The z index of the plot band within the chart, relative to other391 * elements. Using the same z index as another element may give392 * unpredictable results, as the last rendered element will be on top.393 * Values from 0 to 20 make sense.394 *395 * @sample {highcharts} highcharts/xaxis/plotbands-color/396 * Behind plot lines by default397 * @sample {highcharts} highcharts/xaxis/plotbands-zindex/398 * Above plot lines399 * @sample {highcharts} highcharts/xaxis/plotbands-zindex-above-series/400 * Above plot lines and series401 *402 * @type {number}403 * @since 1.2404 * @apioption xAxis.plotBands.zIndex405 */406 /**407 * Text labels for the plot bands408 *409 * @product highcharts highstock gantt410 * @apioption xAxis.plotBands.label411 */412 /**413 * Horizontal alignment of the label. Can be one of "left", "center" or414 * "right".415 *416 * @sample {highcharts} highcharts/xaxis/plotbands-label-align/417 * Aligned to the right418 * @sample {highstock} stock/xaxis/plotbands-label/419 * Plot band with labels420 *421 * @type {Highcharts.AlignValue}422 * @default center423 * @since 2.1424 * @apioption xAxis.plotBands.label.align425 */426 /**427 * Rotation of the text label in degrees .428 *429 * @sample {highcharts} highcharts/xaxis/plotbands-label-rotation/430 * Vertical text431 *432 * @type {number}433 * @default 0434 * @since 2.1435 * @apioption xAxis.plotBands.label.rotation436 */437 /**438 * CSS styles for the text label.439 *440 * In styled mode, the labels are styled by the441 * `.highcharts-plot-band-label` class.442 *443 * @sample {highcharts} highcharts/xaxis/plotbands-label-style/444 * Blue and bold label445 *446 * @type {Highcharts.CSSObject}447 * @since 2.1448 * @apioption xAxis.plotBands.label.style449 */450 /**451 * The string text itself. A subset of HTML is supported.452 *453 * @type {string}454 * @since 2.1455 * @apioption xAxis.plotBands.label.text456 */457 /**458 * The text alignment for the label. While `align` determines where the459 * texts anchor point is placed within the plot band, `textAlign` determines460 * how the text is aligned against its anchor point. Possible values are461 * "left", "center" and "right". Defaults to the same as the `align` option.462 *463 * @sample {highcharts} highcharts/xaxis/plotbands-label-rotation/464 * Vertical text in center position but text-aligned left465 *466 * @type {Highcharts.AlignValue}467 * @since 2.1468 * @apioption xAxis.plotBands.label.textAlign469 */470 /**471 * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)472 * to render the labels.473 *474 * @type {boolean}475 * @default false476 * @since 3.0.3477 * @apioption xAxis.plotBands.label.useHTML478 */479 /**480 * Vertical alignment of the label relative to the plot band. Can be one of481 * "top", "middle" or "bottom".482 *483 * @sample {highcharts} highcharts/xaxis/plotbands-label-verticalalign/484 * Vertically centered label485 * @sample {highstock} stock/xaxis/plotbands-label/486 * Plot band with labels487 *488 * @type {Highcharts.VerticalAlignValue}489 * @default top490 * @since 2.1491 * @apioption xAxis.plotBands.label.verticalAlign492 */493 /**494 * Horizontal position relative the alignment. Default varies by495 * orientation.496 *497 * @sample {highcharts} highcharts/xaxis/plotbands-label-align/498 * Aligned 10px from the right edge499 * @sample {highstock} stock/xaxis/plotbands-label/500 * Plot band with labels501 *502 * @type {number}503 * @since 2.1504 * @apioption xAxis.plotBands.label.x505 */506 /**507 * Vertical position of the text baseline relative to the alignment. Default508 * varies by orientation.509 *510 * @sample {highcharts} highcharts/xaxis/plotbands-label-y/511 * Label on x axis512 * @sample {highstock} stock/xaxis/plotbands-label/513 * Plot band with labels514 *515 * @type {number}516 * @since 2.1517 * @apioption xAxis.plotBands.label.y518 */519 /**520 * An array of lines stretching across the plot area, marking a specific521 * value on one of the axes.522 *523 * In styled mode, the plot lines are styled by the524 * `.highcharts-plot-line` class in addition to the `className` option.525 *526 * @type {Array<*>}527 * @product highcharts highstock gantt528 * @sample {highcharts} highcharts/xaxis/plotlines-color/529 * Basic plot line530 * @sample {highcharts} highcharts/series-solidgauge/labels-auto-aligned/531 * Solid gauge plot line532 * @apioption xAxis.plotLines533 */534 /**535 * Flag to decide if plotLine should be rendered across all panes.536 *537 * @sample {highstock} stock/xaxis/plotlines-acrosspanes/538 * Plot lines on different panes539 *540 * @since 7.1.2541 * @product highstock542 * @type {boolean}543 * @default true544 * @apioption xAxis.plotLines.acrossPanes545 */546 /**547 * A custom class name, in addition to the default `highcharts-plot-line`,548 * to apply to each individual line.549 *550 * @type {string}551 * @since 5.0.0552 * @apioption xAxis.plotLines.className553 */554 /**555 * The color of the line.556 *557 * @sample {highcharts} highcharts/xaxis/plotlines-color/558 * A red line from X axis559 * @sample {highstock} stock/xaxis/plotlines/560 * Plot line on Y axis561 *562 * @type {Highcharts.ColorString}563 * @default ${palette.neutralColor40}564 * @apioption xAxis.plotLines.color565 */566 /**567 * The dashing or dot style for the plot line. For possible values see568 * [this overview](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/).569 *570 * @sample {highcharts} highcharts/xaxis/plotlines-dashstyle/571 * Dash and dot pattern572 * @sample {highstock} stock/xaxis/plotlines/573 * Plot line on Y axis574 *575 * @type {Highcharts.DashStyleValue}576 * @default Solid577 * @since 1.2578 * @apioption xAxis.plotLines.dashStyle579 */580 /**581 * An object defining mouse events for the plot line. Supported582 * properties are `click`, `mouseover`, `mouseout`, `mousemove`.583 *584 * @sample {highcharts} highcharts/xaxis/plotlines-events/585 * Mouse events demonstrated586 *587 * @since 1.2588 * @apioption xAxis.plotLines.events589 */590 /**591 * Click event on a plot band.592 *593 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}594 * @apioption xAxis.plotLines.events.click595 */596 /**597 * Mouse move event on a plot band.598 *599 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}600 * @apioption xAxis.plotLines.events.mousemove601 */602 /**603 * Mouse out event on the corner of a plot band.604 *605 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}606 * @apioption xAxis.plotLines.events.mouseout607 */608 /**609 * Mouse over event on a plot band.610 *611 * @type {Highcharts.EventCallbackFunction<Highcharts.PlotLineOrBand>}612 * @apioption xAxis.plotLines.events.mouseover613 */614 /**615 * An id used for identifying the plot line in Axis.removePlotLine.616 *617 * @sample {highcharts} highcharts/xaxis/plotlines-id/618 * Remove plot line by id619 *620 * @type {string}621 * @apioption xAxis.plotLines.id622 */623 /**624 * The position of the line in axis units.625 *626 * @sample {highcharts} highcharts/xaxis/plotlines-color/627 * Between two categories on X axis628 * @sample {highstock} stock/xaxis/plotlines/629 * Plot line on Y axis630 *631 * @type {number}632 * @apioption xAxis.plotLines.value633 */634 /**635 * The width or thickness of the plot line.636 *637 * @sample {highcharts} highcharts/xaxis/plotlines-color/638 * 2px wide line from X axis639 * @sample {highstock} stock/xaxis/plotlines/640 * Plot line on Y axis641 *642 * @type {number}643 * @default 2644 * @apioption xAxis.plotLines.width645 */646 /**647 * The z index of the plot line within the chart.648 *649 * @sample {highcharts} highcharts/xaxis/plotlines-zindex-behind/650 * Behind plot lines by default651 * @sample {highcharts} highcharts/xaxis/plotlines-zindex-above/652 * Above plot lines653 * @sample {highcharts} highcharts/xaxis/plotlines-zindex-above-all/654 * Above plot lines and series655 *656 * @type {number}657 * @since 1.2658 * @apioption xAxis.plotLines.zIndex659 */660 /**661 * Text labels for the plot bands662 *663 * @apioption xAxis.plotLines.label664 */665 /**666 * Horizontal alignment of the label. Can be one of "left", "center" or667 * "right".668 *669 * @sample {highcharts} highcharts/xaxis/plotlines-label-align-right/670 * Aligned to the right671 * @sample {highstock} stock/xaxis/plotlines/672 * Plot line on Y axis673 *674 * @type {Highcharts.AlignValue}675 * @default left676 * @since 2.1677 * @apioption xAxis.plotLines.label.align678 */679 /**680 * Callback JavaScript function to format the label. Useful properties like681 * the value of plot line or the range of plot band (`from` & `to`682 * properties) can be found in `this.options` object.683 *684 * @sample {highcharts} highcharts/xaxis/plotlines-plotbands-label-formatter685 * Label formatters for plot line and plot band.686 * @type {Highcharts.FormatterCallbackFunction<Highcharts.PlotLineOrBand>}687 * @apioption xAxis.plotLines.label.formatter688 */689 /**690 * Rotation of the text label in degrees. Defaults to 0 for horizontal plot691 * lines and 90 for vertical lines.692 *693 * @sample {highcharts} highcharts/xaxis/plotlines-label-verticalalign-middle/694 * Slanted text695 *696 * @type {number}697 * @since 2.1698 * @apioption xAxis.plotLines.label.rotation699 */700 /**701 * CSS styles for the text label.702 *703 * In styled mode, the labels are styled by the704 * `.highcharts-plot-line-label` class.705 *706 * @sample {highcharts} highcharts/xaxis/plotlines-label-style/707 * Blue and bold label708 *709 * @type {Highcharts.CSSObject}710 * @since 2.1711 * @apioption xAxis.plotLines.label.style712 */713 /**714 * The text itself. A subset of HTML is supported.715 *716 * @type {string}717 * @since 2.1718 * @apioption xAxis.plotLines.label.text719 */720 /**721 * The text alignment for the label. While `align` determines where the722 * texts anchor point is placed within the plot band, `textAlign` determines723 * how the text is aligned against its anchor point. Possible values are724 * "left", "center" and "right". Defaults to the same as the `align` option.725 *726 * @sample {highcharts} highcharts/xaxis/plotlines-label-textalign/727 * Text label in bottom position728 *729 * @type {Highcharts.AlignValue}730 * @since 2.1731 * @apioption xAxis.plotLines.label.textAlign732 */733 /**734 * Whether to [use HTML](https://www.highcharts.com/docs/chart-concepts/labels-and-string-formatting#html)735 * to render the labels.736 *737 * @type {boolean}738 * @default false739 * @since 3.0.3740 * @apioption xAxis.plotLines.label.useHTML741 */742 /**743 * Vertical alignment of the label relative to the plot line. Can be744 * one of "top", "middle" or "bottom".745 *746 * @sample {highcharts} highcharts/xaxis/plotlines-label-verticalalign-middle/747 * Vertically centered label748 *749 * @type {Highcharts.VerticalAlignValue}750 * @default {highcharts} top751 * @default {highstock} top752 * @since 2.1753 * @apioption xAxis.plotLines.label.verticalAlign754 */755 /**756 * Horizontal position relative the alignment. Default varies by757 * orientation.758 *759 * @sample {highcharts} highcharts/xaxis/plotlines-label-align-right/760 * Aligned 10px from the right edge761 * @sample {highstock} stock/xaxis/plotlines/762 * Plot line on Y axis763 *764 * @type {number}765 * @since 2.1766 * @apioption xAxis.plotLines.label.x767 */768 /**769 * Vertical position of the text baseline relative to the alignment. Default770 * varies by orientation.771 *772 * @sample {highcharts} highcharts/xaxis/plotlines-label-y/773 * Label below the plot line774 * @sample {highstock} stock/xaxis/plotlines/775 * Plot line on Y axis776 *777 * @type {number}778 * @since 2.1779 * @apioption xAxis.plotLines.label.y780 */781 /**782 *783 * @type {Array<*>}784 * @extends xAxis.plotBands785 * @apioption yAxis.plotBands786 */787 /**788 * In a gauge chart, this option determines the inner radius of the789 * plot band that stretches along the perimeter. It can be given as790 * a percentage string, like `"100%"`, or as a pixel number, like `100`.791 * By default, the inner radius is controlled by the [thickness](792 * #yAxis.plotBands.thickness) option.793 *794 * @sample {highcharts} highcharts/xaxis/plotbands-gauge795 * Gauge plot band796 *797 * @type {number|string}798 * @since 2.3799 * @product highcharts800 * @apioption yAxis.plotBands.innerRadius801 */802 /**803 * In a gauge chart, this option determines the outer radius of the804 * plot band that stretches along the perimeter. It can be given as805 * a percentage string, like `"100%"`, or as a pixel number, like `100`.806 *807 * @sample {highcharts} highcharts/xaxis/plotbands-gauge808 * Gauge plot band809 *810 * @type {number|string}811 * @default 100%812 * @since 2.3813 * @product highcharts814 * @apioption yAxis.plotBands.outerRadius815 */816 /**817 * In a gauge chart, this option sets the width of the plot band818 * stretching along the perimeter. It can be given as a percentage819 * string, like `"10%"`, or as a pixel number, like `10`. The default820 * value 10 is the same as the default [tickLength](#yAxis.tickLength),821 * thus making the plot band act as a background for the tick markers.822 *823 * @sample {highcharts} highcharts/xaxis/plotbands-gauge824 * Gauge plot band825 *826 * @type {number|string}827 * @default 10828 * @since 2.3829 * @product highcharts830 * @apioption yAxis.plotBands.thickness831 */832 /**833 * @type {Array<*>}834 * @extends xAxis.plotLines835 * @apioption yAxis.plotLines836 */837 /* eslint-disable no-invalid-this, valid-jsdoc */838 /**839 * Internal function to create the SVG path definition for a plot band.840 *841 * @function Highcharts.Axis#getPlotBandPath842 *843 * @param {number} from844 * The axis value to start from.845 *846 * @param {number} to847 * The axis value to end on.848 *849 * @param {Highcharts.AxisPlotBandsOptions|Highcharts.AxisPlotLinesOptions} options850 * The plotBand or plotLine configuration object.851 *852 * @return {Highcharts.SVGPathArray}853 * The SVG path definition in array form.854 */855 getPlotBandPath: function (from, to, options) {856 if (options === void 0) { options = this.options; }857 var toPath = this.getPlotLinePath({858 value: to,859 force: true,860 acrossPanes: options.acrossPanes861 }), path = this.getPlotLinePath({862 value: from,863 force: true,864 acrossPanes: options.acrossPanes865 }), result = [], i, 866 // #4964 check if chart is inverted or plotband is on yAxis867 horiz = this.horiz, plus = 1, isFlat, outside = !isNumber(this.min) ||868 !isNumber(this.max) ||869 (from < this.min && to < this.min) ||870 (from > this.max && to > this.max);871 if (path && toPath) {872 // Flat paths don't need labels (#3836)873 if (outside) {874 isFlat = path.toString() === toPath.toString();875 plus = 0;876 }877 // Go over each subpath - for panes in Highcharts Stock878 for (i = 0; i < path.length; i += 2) {879 var pathStart = path[i], pathEnd = path[i + 1], toPathStart = toPath[i], toPathEnd = toPath[i + 1];880 // Type checking all affected path segments. Consider something881 // smarter.882 if ((pathStart[0] === 'M' || pathStart[0] === 'L') &&883 (pathEnd[0] === 'M' || pathEnd[0] === 'L') &&884 (toPathStart[0] === 'M' || toPathStart[0] === 'L') &&885 (toPathEnd[0] === 'M' || toPathEnd[0] === 'L')) {886 // Add 1 pixel when coordinates are the same887 if (horiz && toPathStart[1] === pathStart[1]) {888 toPathStart[1] += plus;889 toPathEnd[1] += plus;890 }891 else if (!horiz && toPathStart[2] === pathStart[2]) {892 toPathStart[2] += plus;893 toPathEnd[2] += plus;894 }895 result.push(['M', pathStart[1], pathStart[2]], ['L', pathEnd[1], pathEnd[2]], ['L', toPathEnd[1], toPathEnd[2]], ['L', toPathStart[1], toPathStart[2]], ['Z']);896 }897 result.isFlat = isFlat;898 }899 }900 else { // outside the axis area901 path = null;902 }903 return result;904 },905 /**906 * Add a plot band after render time.907 *908 * @sample highcharts/members/axis-addplotband/909 * Toggle the plot band from a button910 *911 * @function Highcharts.Axis#addPlotBand912 *913 * @param {Highcharts.AxisPlotBandsOptions} options914 * A configuration object for the plot band, as defined in915 * [xAxis.plotBands](https://api.highcharts.com/highcharts/xAxis.plotBands).916 *917 * @return {Highcharts.PlotLineOrBand|undefined}918 * The added plot band.919 */920 addPlotBand: function (options) {921 return this.addPlotBandOrLine(options, 'plotBands');922 },923 /**924 * Add a plot line after render time.925 *926 * @sample highcharts/members/axis-addplotline/927 * Toggle the plot line from a button928 *929 * @function Highcharts.Axis#addPlotLine930 *931 * @param {Highcharts.AxisPlotLinesOptions} options932 * A configuration object for the plot line, as defined in933 * [xAxis.plotLines](https://api.highcharts.com/highcharts/xAxis.plotLines).934 *935 * @return {Highcharts.PlotLineOrBand|undefined}936 * The added plot line.937 */938 addPlotLine: function (options) {939 return this.addPlotBandOrLine(options, 'plotLines');940 },941 /**942 * Add a plot band or plot line after render time. Called from addPlotBand943 * and addPlotLine internally.944 *945 * @private946 * @function Highcharts.Axis#addPlotBandOrLine947 *948 * @param {Highcharts.AxisPlotBandsOptions|Highcharts.AxisPlotLinesOptions} options949 * The plotBand or plotLine configuration object.950 *951 * @param {"plotBands"|"plotLines"} [coll]952 *953 * @return {Highcharts.PlotLineOrBand|undefined}954 */955 addPlotBandOrLine: function (options, coll) {956 var _this = this;957 var obj = new PlotLineOrBand(this, options), userOptions = this.userOptions;958 if (this.visible) {959 obj = obj.render();960 }961 if (obj) { // #2189962 if (!this._addedPlotLB) {963 this._addedPlotLB = true;964 (userOptions.plotLines || [])965 .concat(userOptions.plotBands || [])966 .forEach(function (plotLineOptions) {967 _this.addPlotBandOrLine(plotLineOptions);968 });969 }970 // Add it to the user options for exporting and Axis.update971 if (coll) {972 // Workaround Microsoft/TypeScript issue #32693973 var updatedOptions = (userOptions[coll] || []);974 updatedOptions.push(options);975 userOptions[coll] = updatedOptions;976 }977 this.plotLinesAndBands.push(obj);978 }979 return obj;980 },981 /**982 * Remove a plot band or plot line from the chart by id. Called internally983 * from `removePlotBand` and `removePlotLine`.984 *985 * @private986 * @function Highcharts.Axis#removePlotBandOrLine987 * @param {string} id988 * @return {void}989 */990 removePlotBandOrLine: function (id) {991 var plotLinesAndBands = this.plotLinesAndBands, options = this.options, userOptions = this.userOptions;992 if (plotLinesAndBands) { // #15639993 var i_1 = plotLinesAndBands.length;994 while (i_1--) {995 if (plotLinesAndBands[i_1].id === id) {996 plotLinesAndBands[i_1].destroy();997 }998 }999 ([1000 options.plotLines || [],1001 userOptions.plotLines || [],1002 options.plotBands || [],1003 userOptions.plotBands || []1004 ]).forEach(function (arr) {1005 i_1 = arr.length;1006 while (i_1--) {1007 if ((arr[i_1] || {}).id === id) {1008 erase(arr, arr[i_1]);1009 }1010 }1011 });1012 }1013 },1014 /**1015 * Remove a plot band by its id.1016 *1017 * @sample highcharts/members/axis-removeplotband/1018 * Remove plot band by id1019 * @sample highcharts/members/axis-addplotband/1020 * Toggle the plot band from a button1021 *1022 * @function Highcharts.Axis#removePlotBand1023 *1024 * @param {string} id1025 * The plot band's `id` as given in the original configuration1026 * object or in the `addPlotBand` option.1027 *1028 * @return {void}1029 */1030 removePlotBand: function (id) {1031 this.removePlotBandOrLine(id);1032 },1033 /**1034 * Remove a plot line by its id.1035 *1036 * @sample highcharts/xaxis/plotlines-id/1037 * Remove plot line by id1038 * @sample highcharts/members/axis-addplotline/1039 * Toggle the plot line from a button1040 *1041 * @function Highcharts.Axis#removePlotLine1042 *1043 * @param {string} id1044 * The plot line's `id` as given in the original configuration1045 * object or in the `addPlotLine` option.1046 */1047 removePlotLine: function (id) {1048 this.removePlotBandOrLine(id);1049 }1050});...
test-plots.js
Source:test-plots.js
1/*2 * Unit Test for Mapael3 * Module: Plots4 * 5 * Here are tested:6 * - options.map.defaultPlot 7 * - options.map.plots 8 */9$(function() {10 11 QUnit.module("Plots");12 13 QUnit.test("Test adding Image plot", function(assert) {14 15 CST_PLOTS = {16 // Image plot17 'paris': {18 type: "image",19 url: "./marker.png",20 width: 12,21 height: 40,22 latitude: 48.86,23 longitude: 2.3444,24 attrs: {25 opacity: 0.526 },27 attrsHover: {28 transform: "s1.5"29 }30 }31 };32 33 $(".mapcontainer").mapael($.extend(true, {}, CST_MAPCONF_NOANIMDURATION, {34 map: {35 name: "france_departments"36 },37 plots: CST_PLOTS38 })); 39 40 var $plot_paris = $(".mapcontainer .map svg image[data-id='paris']");41 42 /* PARIS PLOT */43 assert.ok($plot_paris[0], "Paris plot: created");44 assert.equal($plot_paris.attr("href"), CST_PLOTS["paris"].url,"Paris plot: URL ok");45 assert.equal($plot_paris.attr("width"), CST_PLOTS["paris"].width,"Paris plot: width ok");46 assert.equal($plot_paris.attr("height"), CST_PLOTS["paris"].height,"Paris plot: height ok");47 assert.equal($plot_paris.attr("opacity"), CST_PLOTS["paris"].attrs.opacity,"Paris plot: opacity ok");48 49 });50 51 52 QUnit.test("Test adding SVG plots", function(assert) {53 54 CST_PLOTS = {55 // SVG plot56 'limoge': {57 type: "svg",58 path: "M 24.267286,27.102843 15.08644,22.838269 6.3686216,27.983579 7.5874348,17.934248 0,11.2331 9.9341158,9.2868473 13.962641,0 l 4.920808,8.8464793 10.077199,0.961561 -6.892889,7.4136777 z",59 latitude: 45.8188276,60 longitude: 1.1060351,61 attrs: {62 opacity: 0.963 }64 }65 };66 67 $(".mapcontainer").mapael($.extend(true, {}, CST_MAPCONF_NOANIMDURATION, {68 map: {69 name: "france_departments"70 },71 plots: CST_PLOTS72 })); 73 74 var $plot_limoge = $(".mapcontainer .map svg path[data-id='limoge']");75 /* LIMOGE PLOT */76 assert.ok($plot_limoge[0], "limoge plot: created");77 // Not working: path seems to be modified ? 78 // assert.equal($plot_limoge.attr("d"), CST_PLOTS["limoge"].path.replace(/\s/g, ''),"limoge plot: Path ok");79 assert.equal($plot_limoge.attr("opacity"), CST_PLOTS["limoge"].attrs.opacity,"limoge plot: opacity ok");80 81 });82 83 84 QUnit.test("Test adding Cicle plots", function(assert) {85 86 CST_PLOTS = {87 // Circle plot88 'lyon': {89 type: "circle",90 size: 50,91 latitude: 45.758888888889,92 longitude: 4.841388888888993 },94 'bordeaux': {95 type: "circle",96 size: 30,97 latitude: 44.834763,98 longitude: -0.58099199 }100 };101 102 $(".mapcontainer").mapael($.extend(true, {}, CST_MAPCONF_NOANIMDURATION, {103 map: {104 name: "france_departments"105 },106 plots: CST_PLOTS107 })); 108 109 var $plot_lyon = $(".mapcontainer .map svg circle[data-id='lyon']");110 var $plot_bordeaux = $(".mapcontainer .map svg circle[data-id='bordeaux']");111 112 /* LYON PLOT */113 assert.ok($plot_lyon[0], "lyon plot: created");114 assert.equal($plot_lyon.attr("r"), CST_PLOTS["lyon"].size / 2,"lyon plot: Rayon ok");115 116 /* BORDEAUX PLOT */117 assert.ok($plot_bordeaux[0], "bordeaux plot: created");118 assert.equal($plot_bordeaux.attr("r"), CST_PLOTS["bordeaux"].size / 2,"bordeaux plot: Rayon ok");119 120 });121 122 123 QUnit.test("Test adding Square plots", function(assert) {124 125 CST_PLOTS = {126 // Square plot127 'rennes': {128 type: "square",129 size: 20,130 latitude: 48.114166666667,131 longitude: -1.6808333333333132 }133 };134 135 $(".mapcontainer").mapael($.extend(true, {}, CST_MAPCONF_NOANIMDURATION, {136 map: {137 name: "france_departments"138 },139 plots: CST_PLOTS140 })); 141 142 var $plot_rennes = $(".mapcontainer .map svg rect[data-id='rennes']");143 144 /* RENNES PLOT */145 assert.ok($plot_rennes[0], "rennes plot: created");146 assert.equal($plot_rennes.attr("width"), CST_PLOTS["rennes"].size,"rennes plot: width ok");147 assert.equal($plot_rennes.attr("height"), CST_PLOTS["rennes"].size,"rennes plot: height ok");148 149 });150 151 152 QUnit.test("Test adding X,Y plots", function(assert) {153 154 CST_PLOTS = {155 // Plot positioned by x and y instead of latitude, longitude156 'plotxy': {157 x: 300,158 y: 200159 }160 };161 162 $(".mapcontainer").mapael($.extend(true, {}, CST_MAPCONF_NOANIMDURATION, {163 map: {164 name: "france_departments"165 },166 plots: CST_PLOTS167 })); 168 169 var $plot_plotxy = $(".mapcontainer .map svg circle[data-id='plotxy']");170 171 /* PLOTXY PLOT */172 assert.ok($plot_plotxy[0], "plotxy plot: created");173 assert.equal($plot_plotxy.attr("cx"), CST_PLOTS["plotxy"].x,"plotxy plot: X ok");174 assert.equal($plot_plotxy.attr("cy"), CST_PLOTS["plotxy"].y,"plotxy plot: Y ok");175 176 });177 178 QUnit.test("Test adding plots with text", function(assert) {179 180 CST_PLOTS = {181 // Circle plot182 'lyon': {183 type: "circle",184 size: 50,185 latitude: 45.758888888889,186 longitude: 4.8413888888889,187 tooltip: {content: "<span style=\"font-weight:bold;\">City :</span> Lyon <br /> Rhône-Alpes"},188 text: {content: "Lyon"}189 },190 // Square plot191 'rennes': {192 type: "square",193 size: 20,194 latitude: 48.114166666667,195 longitude: -1.6808333333333,196 tooltip: {content: "<span style=\"font-weight:bold;\">City :</span> Rennes <br /> Bretagne"},197 text: {content: "Rennes"}198 },199 // Plot positioned by x and y instead of latitude, longitude200 'plotxy': {201 x: 300,202 y: 200,203 text: {204 content: "My plot"205 , position: "bottom"206 , attrs: {"font-size": 10, fill: "#004a9b", opacity: 0.6}207 , attrsHover: {fill: "#004a9b", opacity: 1}208 },209 },210 'bordeaux': {211 type: "circle",212 size: 30,213 latitude: 44.834763,214 longitude: -0.580991,215 text: {216 content: "33",217 position: "inner",218 attrs: {219 "font-size": 16220 , "font-weight": "bold"221 , fill: "#ffffff"222 },223 attrsHover: {224 "font-size": 16225 , "font-weight": "bold"226 , fill: "#ffffff"227 }228 }229 }230 };231 232 $(".mapcontainer").mapael($.extend(true, {}, CST_MAPCONF_NOANIMDURATION, {233 map: {234 name: "france_departments"235 },236 plots: CST_PLOTS237 })); 238 239 var $plot_lyon = $(".mapcontainer .map svg circle[data-id='lyon']");240 var $plot_rennes = $(".mapcontainer .map svg rect[data-id='rennes']");241 var $plot_plotxy = $(".mapcontainer .map svg circle[data-id='plotxy']");242 var $plot_bordeaux = $(".mapcontainer .map svg circle[data-id='bordeaux']");243 244 var $plot_txt_lyon = $(".mapcontainer .map svg text[data-id='lyon']");245 var $plot_txt_rennes = $(".mapcontainer .map svg text[data-id='rennes']");246 var $plot_txt_plotxy = $(".mapcontainer .map svg text[data-id='plotxy']");247 var $plot_txt_bordeaux = $(".mapcontainer .map svg text[data-id='bordeaux']");248 /* LYON PLOT TEXT */249 assert.ok($plot_txt_lyon[0], "lyon text: created");250 assert.equal($("tspan", $plot_txt_lyon).text(), CST_PLOTS["lyon"].text.content, "lyon text: content ok");251 252 /* RENNES PLOT TEXT */253 assert.ok($plot_txt_rennes[0], "rennes text: created");254 assert.equal($("tspan", $plot_txt_rennes).text(), CST_PLOTS["rennes"].text.content, "rennes text: content ok");255 256 /* PLOTXY PLOT TEXT */257 assert.ok($plot_txt_plotxy[0], "plotxy text: created");258 assert.equal($("tspan", $plot_txt_plotxy).text(), CST_PLOTS["plotxy"].text.content, "plotxy text: content ok");259 assert.equal($plot_txt_plotxy.attr("font-size"), CST_PLOTS["plotxy"].text.attrs["font-size"] + "px","plotxy text: font-size ok");260 assert.equal($plot_txt_plotxy.attr("fill"), CST_PLOTS["plotxy"].text.attrs["fill"],"plotxy text: fill ok");261 assert.equal($plot_txt_plotxy.attr("opacity"), CST_PLOTS["plotxy"].text.attrs["opacity"],"plotxy text: opacity ok");262 263 /* BORDEAUX PLOT TEXT */264 assert.ok($plot_txt_bordeaux[0], "bordeaux text: created");265 assert.equal($("tspan", $plot_txt_bordeaux).text(), CST_PLOTS["bordeaux"].text.content, "bordeaux text: content ok");266 assert.equal($plot_txt_bordeaux.attr("font-size"), CST_PLOTS["bordeaux"].text.attrs["font-size"] + "px","bordeaux text: font-size ok");267 assert.equal($plot_txt_bordeaux.attr("font-weight"), CST_PLOTS["bordeaux"].text.attrs["font-weight"],"bordeaux text: font-weight ok");268 assert.equal($plot_txt_bordeaux.attr("fill"), CST_PLOTS["bordeaux"].text.attrs["fill"],"bordeaux text: fill ok");269 270 });271 ...
Using AI Code Generation
1importClass(Packages.jnt.scimark2.BestFitLine);2var x = [1,2,3,4,5,6,7,8,9,10];3var y = [1,4,9,16,25,36,49,64,81,100];4var line = new BestFitLine(x, y);5line.plot();6The method plot() is defined in the BestFitLine class as follows:7BestFitLine.prototype.plot = function() {8 var x = this.x;9 var y = this.y;10 var n = x.length;11 var minX = x[0];12 var maxX = x[0];13 var minY = y[0];14 var maxY = y[0];15 for (var i = 1; i < n; i++) {16 if (x[i] < minX) {17 minX = x[i];18 } else if (x[i] > maxX) {19 maxX = x[i];20 }21 if (y[i] < minY) {22 minY = y[i];23 } else if (y[i] > maxY) {24 maxY = y[i];25 }26 }27 var canvas = new Canvas("Best Fit Line", minX, maxX, minY, maxY);28 canvas.addPoints(x, y);29 canvas.addLine(this.intercept, this.slope);30 canvas.draw();31}32public class Canvas extends javax.swing.JFrame {33 private final int WIDTH = 600;34 private final int HEIGHT = 400;35 private final int PADDING = 30;36 private final double minX, maxX, minY, maxY;37 private final java.util.List<java.awt.geom.Point2D.Double> points;
Using AI Code Generation
1var plot = require("BestFitLine");2var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];3var x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];4var y = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];5var line = plot(data);6console.log(line);7var line2 = plot(x, y);8console.log(line2);9var plot = require("BestFitLine");10var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];11var line = plot(data);12console.log(line);13var line2 = plot(data, data);14console.log(line2);15var plot = require("BestFitLine");16var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];17var line = plot(data);18console.log(line);19var line2 = plot(data, data);20console.log(line2);21var line3 = plot(data, data, data);22console.log(line3);23var plot = require("BestFitLine");24var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];25var line = plot(data);26console.log(line);27var line2 = plot(data, data);28console.log(line2);29var line3 = plot(data, data, data);30console.log(line3);31var line4 = plot(data, data, data, data);32console.log(line4);33var plot = require("BestFitLine");34var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
Using AI Code Generation
1var BestFitLine = require("./BestFitLine.js");2var line = new BestFitLine();3line.addPoint(0,0);4line.addPoint(1,1);5line.addPoint(2,2);6line.addPoint(3,3);7line.addPoint(4,4);8line.plot();9var BestFitLine = require("./BestFitLine.js");10var line = new BestFitLine();11line.addPoint(0,0);12line.addPoint(1,1);13line.addPoint(2,2);14line.addPoint(3,3);15line.addPoint(4,4);16line.plot();17var BestFitLine = require("./BestFitLine.js");18var line = new BestFitLine();19line.addPoint(0,0);20line.addPoint(1,1);21line.addPoint(2,2);22line.addPoint(3,3);23line.addPoint(4,4);24line.plot();25var BestFitLine = require("./BestFitLine.js");26var line = new BestFitLine();27line.addPoint(0,0);28line.addPoint(1,1);29line.addPoint(2,2);30line.addPoint(3,3);31line.addPoint(4,4);32line.plot();
Using AI Code Generation
1var line = new BestFitLine();2line.readData("data.txt");3line.plot();4line.plotBestFitLine();5line.displayEquation();6line.displayCorrelationCoefficient();7line.displayStandardError();8line.displayRSquared();9line.displayAdjustedRSquared();10line.displayStandardDeviationOfResiduals();11line.displayStandardErrorOfResiduals();12line.displaySumOfSquaresOfResiduals();13line.displayFStatistic();14line.displayPValue();15line.displayTStatistic();16line.displayPValueForTStatistic();17line.displayConfidenceIntervalForSlope();18line.displayConfidenceIntervalForIntercept();19line.displayConfidenceIntervalForBestFitLine();20line.displayPredictionIntervalForBestFitLine();21line.displayStandardErrorOfPrediction();22line.display95PercentPredictionInterval();23line.display95PercentConfidenceIntervalForMeanOfResiduals();24line.display95PercentConfidenceIntervalForMeanOfPredictions();25line.display95PercentConfidenceIntervalForMeanOfResponseVariable();26line.display95PercentConfidenceIntervalForMeanOfPredictorVariable();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!