Skip to content

Commit f3c67e0

Browse files
committed
feat: add support for various axis title properties
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 41eed21 commit f3c67e0

File tree

40 files changed

+2121
-0
lines changed

40 files changed

+2121
-0
lines changed

lib/node_modules/@stdlib/plot/vega/axis/ctor/lib/main.js

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,32 @@ var setTickWidth = require( './tick-width/set.js' );
171171

172172
var getTitle = require( './title/get.js' );
173173
var setTitle = require( './title/set.js' );
174+
var getTitleAlign = require( './title-align/get.js' );
175+
var setTitleAlign = require( './title-align/set.js' );
176+
var getTitleAnchor = require( './title-anchor/get.js' );
177+
var setTitleAnchor = require( './title-anchor/set.js' );
178+
var getTitleAngle = require( './title-angle/get.js' );
179+
var setTitleAngle = require( './title-angle/set.js' );
180+
var getTitleBaseline = require( './title-baseline/get.js' );
181+
var setTitleBaseline = require( './title-baseline/set.js' );
182+
var getTitleColor = require( './title-color/get.js' );
183+
var setTitleColor = require( './title-color/set.js' );
184+
var getTitleFont = require( './title-font/get.js' );
185+
var setTitleFont = require( './title-font/set.js' );
186+
var getTitleFontSize = require( './title-font-size/get.js' );
187+
var setTitleFontSize = require( './title-font-size/set.js' );
188+
var getTitleFontStyle = require( './title-font-style/get.js' );
189+
var setTitleFontStyle = require( './title-font-style/set.js' );
190+
var getTitleFontWeight = require( './title-font-weight/get.js' );
191+
var setTitleFontWeight = require( './title-font-weight/set.js' );
192+
var getTitleLimit = require( './title-limit/get.js' );
193+
var setTitleLimit = require( './title-limit/set.js' );
194+
var getTitleLineHeight = require( './title-line-height/get.js' );
195+
var setTitleLineHeight = require( './title-line-height/set.js' );
196+
var getTitleOpacity = require( './title-opacity/get.js' );
197+
var setTitleOpacity = require( './title-opacity/set.js' );
198+
var getTitlePadding = require( './title-padding/get.js' );
199+
var setTitlePadding = require( './title-padding/set.js' );
174200

175201
var getZIndex = require( './zindex/get.js' );
176202
var setZIndex = require( './zindex/set.js' );
@@ -1525,6 +1551,255 @@ setReadWriteAccessor( Axis.prototype, 'tickWidth', getTickWidth, setTickWidth );
15251551
*/
15261552
setReadWriteAccessor( Axis.prototype, 'title', getTitle, setTitle );
15271553

1554+
/**
1555+
* Anchor position for placing an axis title.
1556+
*
1557+
* @name titleAnchor
1558+
* @memberof Axis.prototype
1559+
* @type {(void|string|null)}
1560+
* @default null
1561+
*
1562+
* @example
1563+
* var axis = new Axis({
1564+
* 'scale': 'xScale',
1565+
* 'orient': 'bottom',
1566+
* 'titleAnchor': 'start'
1567+
* });
1568+
*
1569+
* var v = axis.titleAnchor;
1570+
* // returns 'start'
1571+
*/
1572+
setReadWriteAccessor( Axis.prototype, 'titleAnchor', getTitleAnchor, setTitleAnchor );
1573+
1574+
/**
1575+
* Horizontal text alignment of an axis title.
1576+
*
1577+
* @name titleAlign
1578+
* @memberof Axis.prototype
1579+
* @type {(void|string)}
1580+
*
1581+
* @example
1582+
* var axis = new Axis({
1583+
* 'scale': 'xScale',
1584+
* 'orient': 'bottom',
1585+
* 'titleAlign': 'left'
1586+
* });
1587+
*
1588+
* var v = axis.titleAlign;
1589+
* // returns 'left'
1590+
*/
1591+
setReadWriteAccessor( Axis.prototype, 'titleAlign', getTitleAlign, setTitleAlign );
1592+
1593+
/**
1594+
* Angle (in degrees) of an axis title.
1595+
*
1596+
* @name titleAngle
1597+
* @memberof Axis.prototype
1598+
* @type {(void|number)}
1599+
*
1600+
* @example
1601+
* var axis = new Axis({
1602+
* 'scale': 'xScale',
1603+
* 'orient': 'bottom',
1604+
* 'titleAngle': 45
1605+
* });
1606+
*
1607+
* var v = axis.titleAngle;
1608+
* // returns 45
1609+
*/
1610+
setReadWriteAccessor( Axis.prototype, 'titleAngle', getTitleAngle, setTitleAngle );
1611+
1612+
/**
1613+
* Vertical baseline of an axis title.
1614+
*
1615+
* @name titleBaseline
1616+
* @memberof Axis.prototype
1617+
* @type {(string|void)}
1618+
*
1619+
* @example
1620+
* var axis = new Axis({
1621+
* 'scale': 'xScale',
1622+
* 'orient': 'bottom',
1623+
* 'titleBaseline': 'middle'
1624+
* });
1625+
*
1626+
* var v = axis.titleBaseline;
1627+
* // returns 'middle'
1628+
*/
1629+
setReadWriteAccessor( Axis.prototype, 'titleBaseline', getTitleBaseline, setTitleBaseline );
1630+
1631+
/**
1632+
* Color of an axis title.
1633+
*
1634+
* @name titleColor
1635+
* @memberof Axis.prototype
1636+
* @type {(void|string)}
1637+
*
1638+
* @example
1639+
* var axis = new Axis({
1640+
* 'scale': 'xScale',
1641+
* 'orient': 'bottom',
1642+
* 'titleColor': 'steelblue'
1643+
* });
1644+
*
1645+
* var v = axis.titleColor;
1646+
* // returns 'steelblue'
1647+
*/
1648+
setReadWriteAccessor( Axis.prototype, 'titleColor', getTitleColor, setTitleColor );
1649+
1650+
/**
1651+
* Font name for an axis title.
1652+
*
1653+
* @name titleFont
1654+
* @memberof Axis.prototype
1655+
* @type {(string|void)}
1656+
*
1657+
* @example
1658+
* var axis = new Axis({
1659+
* 'scale': 'xScale',
1660+
* 'orient': 'bottom',
1661+
* 'titleFont': 'arial'
1662+
* });
1663+
*
1664+
* var v = axis.titleFont;
1665+
* // returns 'arial'
1666+
*/
1667+
setReadWriteAccessor( Axis.prototype, 'titleFont', getTitleFont, setTitleFont );
1668+
1669+
/**
1670+
* Font size (in pixels) of an axis title.
1671+
*
1672+
* @name titleFontSize
1673+
* @memberof Axis.prototype
1674+
* @type {(number|void)}
1675+
*
1676+
* @example
1677+
* var axis = new Axis({
1678+
* 'scale': 'xScale',
1679+
* 'orient': 'bottom',
1680+
* 'titleFontSize': 16
1681+
* });
1682+
*
1683+
* var v = axis.titleFontSize;
1684+
* // returns 16
1685+
*/
1686+
setReadWriteAccessor( Axis.prototype, 'titleFontSize', getTitleFontSize, setTitleFontSize );
1687+
1688+
/**
1689+
* Font style of an axis title.
1690+
*
1691+
* @name titleFontStyle
1692+
* @memberof Axis.prototype
1693+
* @type {(string|void)}
1694+
*
1695+
* @example
1696+
* var axis = new Axis({
1697+
* 'scale': 'xScale',
1698+
* 'orient': 'bottom',
1699+
* 'titleFontStyle': 'italic'
1700+
* });
1701+
*
1702+
* var v = axis.titleFontStyle;
1703+
* // returns 'italic'
1704+
*/
1705+
setReadWriteAccessor( Axis.prototype, 'titleFontStyle', getTitleFontStyle, setTitleFontStyle );
1706+
1707+
/**
1708+
* Font weight of an axis title.
1709+
*
1710+
* @name titleFontWeight
1711+
* @memberof Axis.prototype
1712+
* @type {(string|number|void)}
1713+
*
1714+
* @example
1715+
* var axis = new Axis({
1716+
* 'scale': 'xScale',
1717+
* 'orient': 'bottom',
1718+
* 'titleFontWeight': 'bold'
1719+
* });
1720+
*
1721+
* var v = axis.titleFontWeight;
1722+
* // returns 'bold'
1723+
*/
1724+
setReadWriteAccessor( Axis.prototype, 'titleFontWeight', getTitleFontWeight, setTitleFontWeight );
1725+
1726+
/**
1727+
* Maximum allowed length (in pixels) of an axis title.
1728+
*
1729+
* @name titleLimit
1730+
* @memberof Axis.prototype
1731+
* @type {(NonNegativeNumber|void)}
1732+
*
1733+
* @example
1734+
* var axis = new Axis({
1735+
* 'scale': 'xScale',
1736+
* 'orient': 'bottom',
1737+
* 'titleLimit': 120
1738+
* });
1739+
*
1740+
* var v = axis.titleLimit;
1741+
* // returns 120
1742+
*/
1743+
setReadWriteAccessor( Axis.prototype, 'titleLimit', getTitleLimit, setTitleLimit );
1744+
1745+
/**
1746+
* Line height (in pixels) for multi-line axis title text or axis title text with "line-top" or "line-bottom" baseline.
1747+
*
1748+
* @name titleLineHeight
1749+
* @memberof Axis.prototype
1750+
* @type {(number|void)}
1751+
*
1752+
* @example
1753+
* var axis = new Axis({
1754+
* 'scale': 'xScale',
1755+
* 'orient': 'bottom',
1756+
* 'titleLineHeight': 24
1757+
* });
1758+
*
1759+
* var v = axis.titleLineHeight;
1760+
* // returns 24
1761+
*/
1762+
setReadWriteAccessor( Axis.prototype, 'titleLineHeight', getTitleLineHeight, setTitleLineHeight );
1763+
1764+
/**
1765+
* Opacity of an axis title.
1766+
*
1767+
* @name titleOpacity
1768+
* @memberof Axis.prototype
1769+
* @type {number}
1770+
* @default 1
1771+
*
1772+
* @example
1773+
* var axis = new Axis({
1774+
* 'scale': 'xScale',
1775+
* 'orient': 'bottom',
1776+
* 'titleOpacity': 0.5
1777+
* });
1778+
*
1779+
* var v = axis.titleOpacity;
1780+
* // returns 0.5
1781+
*/
1782+
setReadWriteAccessor( Axis.prototype, 'titleOpacity', getTitleOpacity, setTitleOpacity );
1783+
1784+
/**
1785+
* Padding (in pixels) between axis tick labels and an axis title.
1786+
*
1787+
* @name titlePadding
1788+
* @memberof Axis.prototype
1789+
* @type {(number|void)}
1790+
*
1791+
* @example
1792+
* var axis = new Axis({
1793+
* 'scale': 'xScale',
1794+
* 'orient': 'bottom',
1795+
* 'titlePadding': 10
1796+
* });
1797+
*
1798+
* var v = axis.titlePadding;
1799+
* // returns 10
1800+
*/
1801+
setReadWriteAccessor( Axis.prototype, 'titlePadding', getTitlePadding, setTitlePadding );
1802+
15281803
/**
15291804
* Integer z-index indicating the layering of the title group relative to other axis, mark, and legend groups.
15301805
*
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
/* eslint-disable no-invalid-this */
20+
21+
'use strict';
22+
23+
// MODULES //
24+
25+
var prop = require( './properties.js' );
26+
27+
28+
// MAIN //
29+
30+
/**
31+
* Returns the horizontal text alignment of an axis title.
32+
*
33+
* @private
34+
* @returns {(string|void)} alignment
35+
*/
36+
function get() {
37+
return this[ prop.private ];
38+
}
39+
40+
41+
// EXPORTS //
42+
43+
module.exports = get;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var property2object = require( '@stdlib/plot/vega/base/property2object' );
24+
25+
26+
// MAIN //
27+
28+
var obj = property2object( 'titleAlign' );
29+
30+
31+
// EXPORTS //
32+
33+
module.exports = obj;

0 commit comments

Comments
 (0)