Skip to content

Commit

Permalink
Moved PlotLineOrBand into a subfolder.
Browse files Browse the repository at this point in the history
  • Loading branch information
bre1470 authored and TorsteinHonsi committed Jul 9, 2021
1 parent cb422f7 commit c719141
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 68 deletions.
4 changes: 2 additions & 2 deletions ts/Core/Axis/Axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import type Chart from '../Chart/Chart';
import type CSSObject from '../Renderer/CSSObject';
import type { EventCallback } from '../Callback';
import type FontMetricsObject from '../Renderer/FontMetricsObject';
import type PlotLineOptions from './PlotLineOptions';
import type PlotLineOrBand from './PlotLineOrBand';
import type PlotLineOptions from './PlotLineOrBand/PlotLineOptions';
import type PlotLineOrBand from './PlotLineOrBand/PlotLineOrBand';
import type Point from '../Series/Point';
import type PointerEvent from '../PointerEvent';
import type PositionObject from '../Renderer/PositionObject';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import type {
AlignValue,
VerticalAlignValue
} from '../Renderer/AlignObject';
import type ColorString from '../Color/ColorString';
import type ColorType from '../Color/ColorType';
import type CSSObject from '../Renderer/CSSObject';
import type FormatUtilities from '../FormatUtilities';
} from '../../Renderer/AlignObject';
import type ColorString from '../../Color/ColorString';
import type ColorType from '../../Color/ColorType';
import type CSSObject from '../../Renderer/CSSObject';
import type FormatUtilities from '../../FormatUtilities';
import type PlotLineOrBand from './PlotLineOrBand';

/* *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import type {
AlignValue,
VerticalAlignValue
} from '../Renderer/AlignObject';
import type ColorString from '../Color/ColorString';
import type CSSObject from '../Renderer/CSSObject';
import type DashStyleValue from '../Renderer/DashStyleValue';
import type FormatUtilities from '../FormatUtilities';
} from '../../Renderer/AlignObject';
import type ColorString from '../../Color/ColorString';
import type CSSObject from '../../Renderer/CSSObject';
import type DashStyleValue from '../../Renderer/DashStyleValue';
import type FormatUtilities from '../../FormatUtilities';
import type PlotLineOrBand from './PlotLineOrBand';

/* *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* */

import type FormatUtilities from '../FormatUtilities';
import type FormatUtilities from '../../FormatUtilities';
import type {
PlotBandLabelOptions,
PlotBandOptions
Expand All @@ -25,20 +25,34 @@ import type {
PlotLineLabelOptions,
PlotLineOptions
} from './PlotLineOptions';
import type SVGAttributes from '../Renderer/SVG/SVGAttributes';
import type SVGElement from '../Renderer/SVG/SVGElement';
import type SVGPath from '../Renderer/SVG/SVGPath';
import type SVGAttributes from '../../Renderer/SVG/SVGAttributes';
import type SVGElement from '../../Renderer/SVG/SVGElement';
import type SVGPath from '../../Renderer/SVG/SVGPath';

import Axis from './Axis.js';
import palette from '../../Core/Color/Palette.js';
import Axis from '../Axis.js';
import Palette from '../../Color/Palette.js';
import U from '../../Utilities.js';
const {
arrayMax,
arrayMin,
defined,
destroyObjectProperties,
erase,
extend,
fireEvent,
isNumber,
merge,
objectEach,
pick
} = U;

/* *
*
* Declarations
*
* */

declare module './AxisLike' {
declare module '../AxisLike' {
interface AxisLike {
addPlotBand(
options: PlotBandOptions
Expand All @@ -65,27 +79,18 @@ declare module './AxisLike' {
}
}

declare module './AxisOptions' {
declare module '../AxisOptions' {
interface AxisOptions {
plotBands?: Array<PlotBandOptions>;
plotLines?: Array<PlotLineOptions>;
}
}

import U from '../Utilities.js';
const {
arrayMax,
arrayMin,
defined,
destroyObjectProperties,
erase,
extend,
fireEvent,
isNumber,
merge,
objectEach,
pick
} = U;
/* *
*
* Class
*
* */

/* eslint-disable no-invalid-this, valid-jsdoc */

Expand All @@ -100,6 +105,13 @@ const {
* @param {Highcharts.AxisPlotLinesOptions|Highcharts.AxisPlotBandsOptions} [options]
*/
class PlotLineOrBand {

/* *
*
* Constructor
*
* */

public constructor(
axis: Axis,
options?: (PlotBandOptions|PlotLineOptions)
Expand All @@ -111,6 +123,12 @@ class PlotLineOrBand {
}
}

/* *
*
* Properties
*
* */

public axis: Axis;
public id?: string;
public isActive?: boolean;
Expand All @@ -119,13 +137,17 @@ class PlotLineOrBand {
public options?: (PlotBandOptions|PlotLineOptions);
public svgElem?: SVGElement;

/* *
*
* Functions
*
* */

/**
* Render the plot line or plot band. If it is already existing,
* move it.
*
* @private
* @function Highcharts.PlotLineOrBand#render
* @return {Highcharts.PlotLineOrBand|undefined}
*/
public render(): (PlotLineOrBand|undefined) {
fireEvent(this, 'render');
Expand Down Expand Up @@ -167,7 +189,7 @@ class PlotLineOrBand {
// Set the presentational attributes
if (!axis.chart.styledMode) {
if (isLine) {
attribs.stroke = color || palette.neutralColor40;
attribs.stroke = color || Palette.neutralColor40;
attribs['stroke-width'] = pick(
(options as PlotLineOptions).width,
1
Expand All @@ -178,7 +200,7 @@ class PlotLineOrBand {
}

} else if (isBand) { // plot band
attribs.fill = color || palette.highlightColor10;
attribs.fill = color || Palette.highlightColor10;
if ((options as PlotBandOptions).borderWidth) {
attribs.stroke = (
options as PlotBandOptions
Expand Down Expand Up @@ -285,14 +307,8 @@ class PlotLineOrBand {

/**
* Render and align label for plot line or band.
*
* @private
* @function Highcharts.PlotLineOrBand#renderLabel
* @param {Highcharts.AxisPlotLinesLabelOptions|Highcharts.AxisPlotBandsLabelOptions} optionsLabel
* @param {Highcharts.SVGPathArray} path
* @param {boolean} [isBand]
* @param {number} [zIndex]
* @return {void}
*/
public renderLabel(
optionsLabel: (PlotBandLabelOptions|PlotLineLabelOptions),
Expand Down Expand Up @@ -369,11 +385,8 @@ class PlotLineOrBand {

/**
* Get label's text content.
*
* @private
* @function Highcharts.PlotLineOrBand#getLabelText
* @param {Highcharts.AxisPlotLinesLabelOptions|Highcharts.AxisPlotBandsLabelOptions} optionsLabel
* @return {string}
*/
public getLabelText(
optionsLabel: (PlotBandLabelOptions|PlotLineLabelOptions)
Expand All @@ -389,7 +402,6 @@ class PlotLineOrBand {
* Remove the plot line or band.
*
* @function Highcharts.PlotLineOrBand#destroy
* @return {void}
*/
public destroy(): void {
// remove it from the lookup
Expand All @@ -405,6 +417,12 @@ class PlotLineOrBand {
// Object with members for extending the Axis prototype
extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {

/* *
*
* API Options
*
* */

/**
* An array of colored bands stretching across the plot area marking an
* interval on the axis.
Expand Down Expand Up @@ -976,7 +994,6 @@ extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {
*/

/**
*
* @type {Array<*>}
* @extends xAxis.plotBands
* @apioption yAxis.plotBands
Expand Down Expand Up @@ -1044,16 +1061,16 @@ extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {
* @function Highcharts.Axis#getPlotBandPath
*
* @param {number} from
* The axis value to start from.
* The axis value to start from.
*
* @param {number} to
* The axis value to end on.
* The axis value to end on.
*
* @param {Highcharts.AxisPlotBandsOptions|Highcharts.AxisPlotLinesOptions} options
* The plotBand or plotLine configuration object.
* The plotBand or plotLine configuration object.
*
* @return {Highcharts.SVGPathArray}
* The SVG path definition in array form.
* The SVG path definition in array form.
*/
getPlotBandPath: function (
this: Axis,
Expand Down Expand Up @@ -1142,11 +1159,11 @@ extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {
* @function Highcharts.Axis#addPlotBand
*
* @param {Highcharts.AxisPlotBandsOptions} options
* A configuration object for the plot band, as defined in
* [xAxis.plotBands](https://api.highcharts.com/highcharts/xAxis.plotBands).
* A configuration object for the plot band, as defined in
* [xAxis.plotBands](https://api.highcharts.com/highcharts/xAxis.plotBands).
*
* @return {Highcharts.PlotLineOrBand|undefined}
* The added plot band.
* The added plot band.
*/
addPlotBand: function (
this: Axis,
Expand All @@ -1164,11 +1181,11 @@ extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {
* @function Highcharts.Axis#addPlotLine
*
* @param {Highcharts.AxisPlotLinesOptions} options
* A configuration object for the plot line, as defined in
* [xAxis.plotLines](https://api.highcharts.com/highcharts/xAxis.plotLines).
* A configuration object for the plot line, as defined in
* [xAxis.plotLines](https://api.highcharts.com/highcharts/xAxis.plotLines).
*
* @return {Highcharts.PlotLineOrBand|undefined}
* The added plot line.
* The added plot line.
*/
addPlotLine: function (
this: Axis,
Expand All @@ -1185,7 +1202,7 @@ extend(Axis.prototype, /** @lends Highcharts.Axis.prototype */ {
* @function Highcharts.Axis#addPlotBandOrLine
*
* @param {Highcharts.AxisPlotBandsOptions|Highcharts.AxisPlotLinesOptions} options
* The plotBand or plotLine configuration object.
* The plotBand or plotLine configuration object.
*
* @param {"plotBands"|"plotLines"} [coll]
*
Expand Down
8 changes: 4 additions & 4 deletions ts/Core/Axis/RadialAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import type Axis from './Axis.js';
import type Chart from '../Chart/Chart';
import type Pane from '../../Extensions/Pane';
import type PlotBandOptions from './PlotBandOptions';
import type PlotLineOptions from './PlotLineOptions';
import type PlotBandOptions from './PlotLineOrBand/PlotBandOptions';
import type PlotLineOptions from './PlotLineOrBand/PlotLineOptions';
import type Point from '../Series/Point';
import type PositionObject from '../Renderer/PositionObject';
import type SVGElement from '../Renderer/SVG/SVGElement';
Expand Down Expand Up @@ -69,7 +69,7 @@ declare module '../Chart/ChartLike'{
}
}

declare module './PlotBandOptions' {
declare module './PlotLineOrBand/PlotBandOptions' {
interface PlotBandOptions {
innerRadius?: (number|string);
outerRadius?: (number|string);
Expand All @@ -78,7 +78,7 @@ declare module './PlotBandOptions' {
}
}

declare module './PlotLineOptions' {
declare module './PlotLineOrBand/PlotLineOptions' {
interface PlotLineOptions {
chartX?: number;
chartY?: number;
Expand Down
6 changes: 3 additions & 3 deletions ts/Extensions/CurrentDateIndication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import type ColorString from '../Core/Color/ColorString';
import type CSSObject from '../Core/Renderer/CSSObject';
import type DashStyleValue from '../Core/Renderer/DashStyleValue';
import type FormatUtilities from '../Core/FormatUtilities';
import type { PlotBandLabelOptions } from '../Core/Axis/PlotBandOptions';
import type { PlotBandLabelOptions } from '../Core/Axis/PlotLineOrBand/PlotBandOptions';
import type {
PlotLineLabelOptions,
PlotLineOptions
} from '../Core/Axis/PlotLineOptions';
} from '../Core/Axis/PlotLineOrBand/PlotLineOptions';

import Axis from '../Core/Axis/Axis.js';
import Palette from '../Core/Color/Palette.js';
import PlotLineOrBand from '../Core/Axis/PlotLineOrBand.js';
import PlotLineOrBand from '../Core/Axis/PlotLineOrBand/PlotLineOrBand.js';
import U from '../Core/Utilities.js';
const {
addEvent,
Expand Down
2 changes: 1 addition & 1 deletion ts/masters/highcharts.src.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import HTMLRenderer from '../Core/Renderer/HTML/HTMLRenderer.js';
import Axis from '../Core/Axis/Axis.js';
import DateTimeAxis from '../Core/Axis/DateTimeAxis.js';
import LogarithmicAxis from '../Core/Axis/LogarithmicAxis.js';
import PlotLineOrBand from '../Core/Axis/PlotLineOrBand.js';
import PlotLineOrBand from '../Core/Axis/PlotLineOrBand/PlotLineOrBand.js';
import Tick from '../Core/Axis/Tick.js';
import Tooltip from '../Core/Tooltip.js';
import Point from '../Core/Series/Point.js';
Expand Down

0 comments on commit c719141

Please sign in to comment.