From e2508bc4e0abea1e27c689881343aba436a4139f Mon Sep 17 00:00:00 2001 From: archmoj Date: Wed, 23 Jun 2021 12:28:08 -0400 Subject: [PATCH 1/7] add half-year format directive --- src/lib/dates.js | 14 +++++++- test/image/baselines/period_positioning9.png | Bin 0 -> 15060 bytes test/image/mocks/period_positioning9.json | 33 +++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 test/image/baselines/period_positioning9.png create mode 100644 test/image/mocks/period_positioning9.json diff --git a/src/lib/dates.js b/src/lib/dates.js index 57a35ea51ac..3d32f465538 100644 --- a/src/lib/dates.js +++ b/src/lib/dates.js @@ -370,11 +370,19 @@ exports.cleanDate = function(v, dflt, calendar) { */ /* - * modDateFormat: Support world calendars, and add one item to + * modDateFormat: Support world calendars, and add two items to * d3's vocabulary: * %{n}f where n is the max number of digits of fractional seconds + * %h formats: half of the year as a decimal number [1,2] */ var fracMatch = /%\d?f/g; +var halfYearMatch = /%h/g; +var quarterToHalfYear = { + '1': 1, + '2': 1, + '3': 2, + '4': 2, +}; function modDateFormat(fmt, x, formatter, calendar) { fmt = fmt.replace(fracMatch, function(match) { var digits = Math.min(+(match.charAt(1)) || 6, 6); @@ -386,6 +394,10 @@ function modDateFormat(fmt, x, formatter, calendar) { var d = new Date(Math.floor(x + 0.05)); + fmt = fmt.replace(halfYearMatch, function() { + return quarterToHalfYear[formatter('%q')(d)]; + }); + if(isWorldCalendar(calendar)) { try { fmt = Registry.getComponentMethod('calendars', 'worldCalFmt')(fmt, x, calendar); diff --git a/test/image/baselines/period_positioning9.png b/test/image/baselines/period_positioning9.png new file mode 100644 index 0000000000000000000000000000000000000000..98834749e3def6c22a810629beb8d01323d3d8c9 GIT binary patch literal 15060 zcmeIZ2T;^s(=Mn(9uS5oh`>nBASgKu2uRL3X9P)t8Jbj30GHrd<%L9dgI28TMF_r znm2CTi~+x#xY*#yR_)T48#mxL6lA2dy-l~?~Ey6NbGy3+w}{( zr}M7}53C&f9@dYg>`zX&ECm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;JMZbb&cd!Xj?sk$&-`0!TKmizol>BS4}#@L@9q%hQ)T*t$=x5m;< zpOr^+-&$d4yIR&pn%|fwz=^j67a_zC3BV$R!f+2nIfUXXG~p+*3dL9D)p;sAwxU$J zH^J2&4V<}Y4zb3&&&Eu=eEJ{S4y2cuK5yNQFsCMLq04^%bhZ&)i{`+=1#4)ekY_z} zhI`6kWhJGg3lQqejO=|&jUEu&k0J^8DmQ{7CxGl_{jlEU`~O<5N%uW_m3~yUmo7$* zt4p5Dx?@Yu4Bd7GS6mLQq4u-(luAb%r46c0aa5Zws^qwd8{Q@4lXBDd#$5_9&r=iS zRMkvCgUVqnp|%|VnC-egSx+2Z27`_A$lDybUk`O3ILvF$6Q zCuEDuu?fpEDG4p-Ti^OWA`bX|{v6dkHo2>)SFEowKR-WA!BVra!(MmH^KPOEf;XDp z_RRt)OONmR7Parh&mKSEXoZ5`2|b(F@yke7F6YF2;GcKn{P4sP!c5&L7!BKWIcbQm zDR-re7B?-~G{l&{a})&78~O+TNU%s39@7a5_bT7}EP`t~vu*z6geWc+&ao!5iVh>a z7;Fe(=RM*J8Y04pd&22guC2|W$gdjOW)}$KVey={sn~~!lLZK}cp93xpWVgP4QM+{ zjm2YRxw1Xup5FT!6ob=Wv_4#r?Rm$4rts(fPWG`Bd%noZaC+N1)sz2%$VD7q573Mw z7;}>WfgJCACkzS@VuFjn30J9usxGJ*`2WB8e_RF^l27IrjaBbTyaTsYZz#yB%9Ki* Ghx~601>p_= literal 0 HcmV?d00001 diff --git a/test/image/mocks/period_positioning9.json b/test/image/mocks/period_positioning9.json new file mode 100644 index 00000000000..9a25492229b --- /dev/null +++ b/test/image/mocks/period_positioning9.json @@ -0,0 +1,33 @@ +{ + "data": [ + { + "xperiod": "M6", + "name": "Half year", + "type": "bar", + "y": [1, 2, 3, 4, 5, 6], + "x": ["2001-01", "2001-07", "2002-01", "2002-07", "2003-01", "2003-07"], + "texttemplate": "%{x}", + "textangle": 0 + } + ], + "layout": { + "title": { + "text": "half-year periods and tickformat" + }, + "width": 400, + "height": 300, + "margin": { + "t": 50, + "b": 50, + "l": 25, + "r": 25 + }, + + "xaxis": { + "dtick": "M6", + "tickformat": "%Y H%h", + "ticklabelmode": "period", + "tickcolor": "black" + } + } +} From efcbfaaccf4f3956d6e3f1a7ec4fcb59c3410640 Mon Sep 17 00:00:00 2001 From: archmoj Date: Thu, 24 Jun 2021 10:14:20 -0400 Subject: [PATCH 2/7] refactor - centralize axis format descriptions --- src/plots/cartesian/axis_format.js | 49 +++++++++++++++++++++ src/plots/cartesian/layout_attributes.js | 27 ++---------- src/plots/hoverformat_attributes.js | 27 ------------ src/traces/bar/attributes.js | 2 +- src/traces/box/attributes.js | 2 +- src/traces/candlestick/attributes.js | 2 +- src/traces/carpet/axis_attributes.js | 16 +------ src/traces/cone/attributes.js | 2 +- src/traces/contour/attributes.js | 11 ++--- src/traces/funnel/attributes.js | 2 +- src/traces/heatmap/attributes.js | 2 +- src/traces/histogram/attributes.js | 2 +- src/traces/histogram2d/attributes.js | 2 +- src/traces/histogram2dcontour/attributes.js | 2 +- src/traces/indicator/attributes.js | 14 ++---- src/traces/isosurface/attributes.js | 2 +- src/traces/mesh3d/attributes.js | 2 +- src/traces/ohlc/attributes.js | 2 +- src/traces/sankey/attributes.js | 9 +--- src/traces/scatter/attributes.js | 2 +- src/traces/scatter3d/attributes.js | 2 +- src/traces/scattergl/attributes.js | 2 +- src/traces/splom/attributes.js | 2 +- src/traces/streamtube/attributes.js | 2 +- src/traces/surface/attributes.js | 2 +- src/traces/table/attributes.js | 15 ++----- src/traces/violin/attributes.js | 2 +- src/traces/waterfall/attributes.js | 2 +- 28 files changed, 86 insertions(+), 122 deletions(-) create mode 100644 src/plots/cartesian/axis_format.js delete mode 100644 src/plots/hoverformat_attributes.js diff --git a/src/plots/cartesian/axis_format.js b/src/plots/cartesian/axis_format.js new file mode 100644 index 00000000000..2b14e11e74a --- /dev/null +++ b/src/plots/cartesian/axis_format.js @@ -0,0 +1,49 @@ +'use strict'; + +var docs = require('../../constants/docs'); +var FORMAT_LINK = docs.FORMAT_LINK; +var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK; + +function axisHoverFormat(x, noDates) { + return { + valType: 'string', + dflt: '', + editType: 'none', + description: [ + 'Sets the hover text formatting rule for `' + x + '`', + ' using d3 formatting mini-languages which are very similar to those in Python.', + 'See: ' + FORMAT_LINK + ( + noDates ? + '' : + ' And for dates see: ' + DATE_FORMAT_LINK + ), + 'By default the values are formatted using ' + ( + noDates ? + 'generic number format' : + ('`' + x + 'axis.hoverformat`') + ) + '.', + ].join(' ') + }; +} + +function descriptionOnlyNumbers(label) { + return [ + 'Sets the ' + label + ' formatting rule using d3 formatting mini-languages', + 'which are very similar to those in Python. For numbers, see: ' + FORMAT_LINK + ].join(' '); +} + +function descriptionWithDates(label) { + return descriptionOnlyNumbers(label) + [ + ' And for dates see: ' + DATE_FORMAT_LINK, + 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', + 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', + '*%H~%M~%S.%2f* would display *09~15~23.46*' + ].join(' '); +} + +module.exports = { + axisHoverFormat: axisHoverFormat, + descriptionOnlyNumbers: descriptionOnlyNumbers, + descriptionWithDates: descriptionWithDates +}; diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index 4cdf5e9239a..d36298959fc 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -5,10 +5,7 @@ var colorAttrs = require('../../components/color/attributes'); var dash = require('../../components/drawing/attributes').dash; var extendFlat = require('../../lib/extend').extendFlat; var templatedArray = require('../../plot_api/plot_template').templatedArray; - -var docs = require('../../constants/docs'); -var FORMAT_LINK = docs.FORMAT_LINK; -var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK; +var descriptionWithDates = require('../../plots/cartesian/axis_format').descriptionWithDates; var ONEDAY = require('../../constants/numerical').ONEDAY; var constants = require('./constants'); @@ -702,16 +699,7 @@ module.exports = { valType: 'string', dflt: '', editType: 'ticks', - description: [ - 'Sets the tick label formatting rule using d3 formatting mini-languages', - 'which are very similar to those in Python. For numbers, see:', - FORMAT_LINK, - 'And for dates see:', - DATE_FORMAT_LINK, - 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', - 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', - '*%H~%M~%S.%2f* would display *09~15~23.46*' - ].join(' ') + description: descriptionWithDates('tick label') }, tickformatstops: templatedArray('tickformatstop', { enabled: { @@ -750,16 +738,7 @@ module.exports = { valType: 'string', dflt: '', editType: 'none', - description: [ - 'Sets the hover text formatting rule using d3 formatting mini-languages', - 'which are very similar to those in Python. For numbers, see:', - FORMAT_LINK, - 'And for dates see:', - DATE_FORMAT_LINK, - 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', - 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', - '*%H~%M~%S.%2f* would display *09~15~23.46*' - ].join(' ') + description: descriptionWithDates('hover text') }, // lines and grids showline: { diff --git a/src/plots/hoverformat_attributes.js b/src/plots/hoverformat_attributes.js deleted file mode 100644 index 58ef52c0010..00000000000 --- a/src/plots/hoverformat_attributes.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -var docs = require('../constants/docs'); -var FORMAT_LINK = docs.FORMAT_LINK; -var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK; - -module.exports = function axisHoverFormat(x, noDates) { - return { - valType: 'string', - dflt: '', - editType: 'none', - description: [ - 'Sets the hover text formatting rule for `' + x + '`', - ' using d3 formatting mini-languages which are very similar to those in Python.', - 'See: ' + FORMAT_LINK + ( - noDates ? - '' : - ' And for dates see: ' + DATE_FORMAT_LINK - ), - 'By default the values are formatted using ' + ( - noDates ? - 'generic number format' : - ('`' + x + 'axis.hoverformat`') - ) + '.', - ].join(' ') - }; -}; diff --git a/src/traces/bar/attributes.js b/src/traces/bar/attributes.js index 1657292ec03..a412ea63aba 100644 --- a/src/traces/bar/attributes.js +++ b/src/traces/bar/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var scatterAttrs = require('../scatter/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/box/attributes.js b/src/traces/box/attributes.js index 2d4ca2755c0..4bca6960cd8 100644 --- a/src/traces/box/attributes.js +++ b/src/traces/box/attributes.js @@ -3,7 +3,7 @@ var scatterAttrs = require('../scatter/attributes'); var barAttrs = require('../bar/attributes'); var colorAttrs = require('../../components/color/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var extendFlat = require('../../lib/extend').extendFlat; diff --git a/src/traces/candlestick/attributes.js b/src/traces/candlestick/attributes.js index 5bd37ebcb8b..26914ee64ad 100644 --- a/src/traces/candlestick/attributes.js +++ b/src/traces/candlestick/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var extendFlat = require('../../lib').extendFlat; -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var OHLCattrs = require('../ohlc/attributes'); var boxAttrs = require('../box/attributes'); diff --git a/src/traces/carpet/axis_attributes.js b/src/traces/carpet/axis_attributes.js index e3548c68d8b..84adaf414d9 100644 --- a/src/traces/carpet/axis_attributes.js +++ b/src/traces/carpet/axis_attributes.js @@ -3,12 +3,9 @@ var fontAttrs = require('../../plots/font_attributes'); var colorAttrs = require('../../components/color/attributes'); var axesAttrs = require('../../plots/cartesian/layout_attributes'); +var descriptionWithDates = require('../../plots/cartesian/axis_format').descriptionWithDates; var overrideAll = require('../../plot_api/edit_types').overrideAll; -var docs = require('../../constants/docs'); -var FORMAT_LINK = docs.FORMAT_LINK; -var DATE_FORMAT_LINK = docs.DATE_FORMAT_LINK; - module.exports = { color: { valType: 'color', @@ -279,16 +276,7 @@ module.exports = { valType: 'string', dflt: '', editType: 'calc', - description: [ - 'Sets the tick label formatting rule using d3 formatting mini-languages', - 'which are very similar to those in Python. For numbers, see:', - FORMAT_LINK, - 'And for dates see:', - DATE_FORMAT_LINK, - 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', - 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', - '*%H~%M~%S.%2f* would display *09~15~23.46*' - ].join(' ') + description: descriptionWithDates('tick label') }, tickformatstops: overrideAll(axesAttrs.tickformatstops, 'calc', 'from-root'), categoryorder: { diff --git a/src/traces/cone/attributes.js b/src/traces/cone/attributes.js index 640fa2e0ae0..21f0f3e0a47 100644 --- a/src/traces/cone/attributes.js +++ b/src/traces/cone/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var mesh3dAttrs = require('../mesh3d/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/contour/attributes.js b/src/traces/contour/attributes.js index dd59ee803d4..2cce0dc3d3f 100644 --- a/src/traces/contour/attributes.js +++ b/src/traces/contour/attributes.js @@ -2,7 +2,9 @@ var heatmapAttrs = require('../heatmap/attributes'); var scatterAttrs = require('../scatter/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisFormat = require('../../plots/cartesian/axis_format'); +var axisHoverFormat = axisFormat.axisHoverFormat; +var descriptionOnlyNumbers = axisFormat.descriptionOnlyNumbers; var colorScaleAttrs = require('../../components/colorscale/attributes'); var dash = require('../../components/drawing/attributes').dash; var fontAttrs = require('../../plots/font_attributes'); @@ -12,7 +14,6 @@ var filterOps = require('../../constants/filter_ops'); var COMPARISON_OPS2 = filterOps.COMPARISON_OPS2; var INTERVAL_OPS = filterOps.INTERVAL_OPS; -var FORMAT_LINK = require('../../constants/docs').FORMAT_LINK; var scatterLineAttrs = scatterAttrs.line; @@ -181,11 +182,7 @@ module.exports = extendFlat({ valType: 'string', dflt: '', editType: 'plot', - description: [ - 'Sets the contour label formatting rule using d3 formatting', - 'mini-language which is very similar to Python, see:', - FORMAT_LINK - ].join(' ') + description: descriptionOnlyNumbers('contour label') }, operation: { valType: 'enumerated', diff --git a/src/traces/funnel/attributes.js b/src/traces/funnel/attributes.js index 0ba415b83a7..be8e4d63b2f 100644 --- a/src/traces/funnel/attributes.js +++ b/src/traces/funnel/attributes.js @@ -3,7 +3,7 @@ var barAttrs = require('../bar/attributes'); var lineAttrs = require('../scatter/attributes').line; var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var constants = require('./constants'); diff --git a/src/traces/heatmap/attributes.js b/src/traces/heatmap/attributes.js index be43069692b..81343231130 100644 --- a/src/traces/heatmap/attributes.js +++ b/src/traces/heatmap/attributes.js @@ -2,7 +2,7 @@ var scatterAttrs = require('../scatter/attributes'); var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/histogram/attributes.js b/src/traces/histogram/attributes.js index 763ff0241a0..8585cb91bc4 100644 --- a/src/traces/histogram/attributes.js +++ b/src/traces/histogram/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var barAttrs = require('../bar/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var makeBinAttrs = require('./bin_attributes'); var constants = require('./constants'); diff --git a/src/traces/histogram2d/attributes.js b/src/traces/histogram2d/attributes.js index 8f02b906261..b30f380e6dd 100644 --- a/src/traces/histogram2d/attributes.js +++ b/src/traces/histogram2d/attributes.js @@ -4,7 +4,7 @@ var histogramAttrs = require('../histogram/attributes'); var makeBinAttrs = require('../histogram/bin_attributes'); var heatmapAttrs = require('../heatmap/attributes'); var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/histogram2dcontour/attributes.js b/src/traces/histogram2dcontour/attributes.js index 0f8cca3fb62..f5577515aa9 100644 --- a/src/traces/histogram2dcontour/attributes.js +++ b/src/traces/histogram2dcontour/attributes.js @@ -3,7 +3,7 @@ var histogram2dAttrs = require('../histogram2d/attributes'); var contourAttrs = require('../contour/attributes'); var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var extendFlat = require('../../lib/extend').extendFlat; diff --git a/src/traces/indicator/attributes.js b/src/traces/indicator/attributes.js index 3a7276df14b..96a8df10498 100644 --- a/src/traces/indicator/attributes.js +++ b/src/traces/indicator/attributes.js @@ -9,7 +9,7 @@ var domainAttrs = require('../../plots/domain').attributes; var axesAttrs = require('../../plots/cartesian/layout_attributes'); var templatedArray = require('../../plot_api/plot_template').templatedArray; var delta = require('../../constants/delta.js'); -var FORMAT_LINK = require('../../constants/docs').FORMAT_LINK; +var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format').descriptionOnlyNumbers; var textFontAttrs = fontAttrs({ editType: 'plot', @@ -147,11 +147,7 @@ module.exports = { valType: 'string', dflt: '', editType: 'plot', - description: [ - 'Sets the value formatting rule using d3 formatting mini-language', - 'which is similar to those of Python. See', - FORMAT_LINK - ].join(' ') + description: descriptionOnlyNumbers('value') }, font: extendFlat({}, textFontAttrs, { description: [ @@ -205,11 +201,7 @@ module.exports = { valueformat: { valType: 'string', editType: 'plot', - description: [ - 'Sets the value formatting rule using d3 formatting mini-language', - 'which is similar to those of Python. See', - FORMAT_LINK - ].join(' ') + description: descriptionOnlyNumbers('value') }, increasing: { symbol: { diff --git a/src/traces/isosurface/attributes.js b/src/traces/isosurface/attributes.js index 7e7499314a6..77e77508887 100644 --- a/src/traces/isosurface/attributes.js +++ b/src/traces/isosurface/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var meshAttrs = require('../mesh3d/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/mesh3d/attributes.js b/src/traces/mesh3d/attributes.js index b0aebf3b5f9..0e2892e97fd 100644 --- a/src/traces/mesh3d/attributes.js +++ b/src/traces/mesh3d/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var surfaceAttrs = require('../surface/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/ohlc/attributes.js b/src/traces/ohlc/attributes.js index 7ce3c82b348..f74d3457cfa 100644 --- a/src/traces/ohlc/attributes.js +++ b/src/traces/ohlc/attributes.js @@ -2,7 +2,7 @@ var extendFlat = require('../../lib').extendFlat; var scatterAttrs = require('../scatter/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var dash = require('../../components/drawing/attributes').dash; var fxAttrs = require('../../components/fx/attributes'); var delta = require('../../constants/delta.js'); diff --git a/src/traces/sankey/attributes.js b/src/traces/sankey/attributes.js index e029b635412..ad63589bec8 100644 --- a/src/traces/sankey/attributes.js +++ b/src/traces/sankey/attributes.js @@ -8,12 +8,11 @@ var domainAttrs = require('../../plots/domain').attributes; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorAttributes = require('../../components/colorscale/attributes'); var templatedArray = require('../../plot_api/plot_template').templatedArray; +var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format').descriptionOnlyNumbers; var extendFlat = require('../../lib/extend').extendFlat; var overrideAll = require('../../plot_api/edit_types').overrideAll; -var FORMAT_LINK = require('../../constants/docs').FORMAT_LINK; - var attrs = module.exports = overrideAll({ hoverinfo: extendFlat({}, baseAttrs.hoverinfo, { flags: [], @@ -39,11 +38,7 @@ var attrs = module.exports = overrideAll({ valueformat: { valType: 'string', dflt: '.3s', - description: [ - 'Sets the value formatting rule using d3 formatting mini-language', - 'which is similar to those of Python. See', - FORMAT_LINK - ].join(' ') + description: descriptionOnlyNumbers('value') }, valuesuffix: { diff --git a/src/traces/scatter/attributes.js b/src/traces/scatter/attributes.js index 7860cdd693a..2a02014fc8c 100644 --- a/src/traces/scatter/attributes.js +++ b/src/traces/scatter/attributes.js @@ -1,6 +1,6 @@ 'use strict'; -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/scatter3d/attributes.js b/src/traces/scatter3d/attributes.js index ca9c6c5979d..555fb8d14fa 100644 --- a/src/traces/scatter3d/attributes.js +++ b/src/traces/scatter3d/attributes.js @@ -2,7 +2,7 @@ var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/scattergl/attributes.js b/src/traces/scattergl/attributes.js index d69c8b6c349..d24889122d4 100644 --- a/src/traces/scattergl/attributes.js +++ b/src/traces/scattergl/attributes.js @@ -2,7 +2,7 @@ var baseAttrs = require('../../plots/attributes'); var scatterAttrs = require('../scatter/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var colorScaleAttrs = require('../../components/colorscale/attributes'); var extendFlat = require('../../lib/extend').extendFlat; diff --git a/src/traces/splom/attributes.js b/src/traces/splom/attributes.js index a02947883b9..6199e826bda 100644 --- a/src/traces/splom/attributes.js +++ b/src/traces/splom/attributes.js @@ -2,7 +2,7 @@ var scatterAttrs = require('../scatter/attributes'); var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var scatterGlAttrs = require('../scattergl/attributes'); var cartesianIdRegex = require('../../plots/cartesian/constants').idRegex; diff --git a/src/traces/streamtube/attributes.js b/src/traces/streamtube/attributes.js index 2b7e50f628c..169c6f4b7ad 100644 --- a/src/traces/streamtube/attributes.js +++ b/src/traces/streamtube/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var mesh3dAttrs = require('../mesh3d/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/surface/attributes.js b/src/traces/surface/attributes.js index 1efb5e18fe2..864f49274ef 100644 --- a/src/traces/surface/attributes.js +++ b/src/traces/surface/attributes.js @@ -2,7 +2,7 @@ var Color = require('../../components/color'); var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/table/attributes.js b/src/traces/table/attributes.js index fdd562758eb..2520c879074 100644 --- a/src/traces/table/attributes.js +++ b/src/traces/table/attributes.js @@ -5,8 +5,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var overrideAll = require('../../plot_api/edit_types').overrideAll; var fontAttrs = require('../../plots/font_attributes'); var domainAttrs = require('../../plots/domain').attributes; - -var FORMAT_LINK = require('../../constants/docs').FORMAT_LINK; +var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format').descriptionOnlyNumbers; var attrs = module.exports = overrideAll({ domain: domainAttrs({name: 'table', trace: true}), @@ -45,11 +44,7 @@ var attrs = module.exports = overrideAll({ format: { valType: 'data_array', dflt: [], - description: [ - 'Sets the cell value formatting rule using d3 formatting mini-language', - 'which is similar to those of Python. See', - FORMAT_LINK - ].join(' ') + description: descriptionOnlyNumbers('cell value') }, prefix: { @@ -117,11 +112,7 @@ var attrs = module.exports = overrideAll({ format: { valType: 'data_array', dflt: [], - description: [ - 'Sets the cell value formatting rule using d3 formatting mini-language', - 'which is similar to those of Python. See', - FORMAT_LINK - ].join(' ') + description: descriptionOnlyNumbers('cell value') }, prefix: { diff --git a/src/traces/violin/attributes.js b/src/traces/violin/attributes.js index a34e5c4dbbc..743c89de16a 100644 --- a/src/traces/violin/attributes.js +++ b/src/traces/violin/attributes.js @@ -2,7 +2,7 @@ var boxAttrs = require('../box/attributes'); var extendFlat = require('../../lib/extend').extendFlat; -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; module.exports = { y: boxAttrs.y, diff --git a/src/traces/waterfall/attributes.js b/src/traces/waterfall/attributes.js index 73d7313a7e0..34bf093e433 100644 --- a/src/traces/waterfall/attributes.js +++ b/src/traces/waterfall/attributes.js @@ -3,7 +3,7 @@ var barAttrs = require('../bar/attributes'); var lineAttrs = require('../scatter/attributes').line; var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/hoverformat_attributes'); +var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var constants = require('./constants'); From defaf8e416a3b10a3226c951865a3fb7b8b7265b Mon Sep 17 00:00:00 2001 From: archmoj Date: Thu, 24 Jun 2021 10:57:34 -0400 Subject: [PATCH 3/7] add half-year directive to descriptions --- src/plots/cartesian/axis_format.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plots/cartesian/axis_format.js b/src/plots/cartesian/axis_format.js index 2b14e11e74a..2d7bd0f687b 100644 --- a/src/plots/cartesian/axis_format.js +++ b/src/plots/cartesian/axis_format.js @@ -36,7 +36,9 @@ function descriptionOnlyNumbers(label) { function descriptionWithDates(label) { return descriptionOnlyNumbers(label) + [ ' And for dates see: ' + DATE_FORMAT_LINK, - 'We add one item to d3\'s date formatter: *%{n}f* for fractional seconds', + 'We add two items to d3\'s date formatter:', + '*%h* for half of the year as a decimal number as well as', + '*%{n}f* for fractional seconds', 'with n digits. For example, *2016-10-13 09:15:23.456* with tickformat', '*%H~%M~%S.%2f* would display *09~15~23.46*' ].join(' '); From 98a90ce481c9fac0df3914b75dba11edf02c4932 Mon Sep 17 00:00:00 2001 From: archmoj Date: Thu, 24 Jun 2021 11:13:41 -0400 Subject: [PATCH 4/7] mention extra date formatting options in (x|y)hoverformat too --- src/plots/cartesian/axis_format.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/plots/cartesian/axis_format.js b/src/plots/cartesian/axis_format.js index 2d7bd0f687b..0e1d3c001d5 100644 --- a/src/plots/cartesian/axis_format.js +++ b/src/plots/cartesian/axis_format.js @@ -9,14 +9,9 @@ function axisHoverFormat(x, noDates) { valType: 'string', dflt: '', editType: 'none', - description: [ - 'Sets the hover text formatting rule for `' + x + '`', - ' using d3 formatting mini-languages which are very similar to those in Python.', - 'See: ' + FORMAT_LINK + ( - noDates ? - '' : - ' And for dates see: ' + DATE_FORMAT_LINK - ), + description: ( + noDates ? descriptionOnlyNumbers : descriptionWithDates + )('hover text', x) + [ 'By default the values are formatted using ' + ( noDates ? 'generic number format' : @@ -26,15 +21,16 @@ function axisHoverFormat(x, noDates) { }; } -function descriptionOnlyNumbers(label) { +function descriptionOnlyNumbers(label, x) { return [ - 'Sets the ' + label + ' formatting rule using d3 formatting mini-languages', + 'Sets the ' + label + ' formatting rule' + (x ? 'for `' + x + '` ' : ''), + 'using d3 formatting mini-languages', 'which are very similar to those in Python. For numbers, see: ' + FORMAT_LINK ].join(' '); } -function descriptionWithDates(label) { - return descriptionOnlyNumbers(label) + [ +function descriptionWithDates(label, x) { + return descriptionOnlyNumbers(label, x) + [ ' And for dates see: ' + DATE_FORMAT_LINK, 'We add two items to d3\'s date formatter:', '*%h* for half of the year as a decimal number as well as', From 73676ca712d36611d98394a92ba1b6ccfa7f5a4b Mon Sep 17 00:00:00 2001 From: archmoj Date: Thu, 24 Jun 2021 11:22:30 -0400 Subject: [PATCH 5/7] add dots after links to end the sentences --- src/plots/cartesian/axis_format.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plots/cartesian/axis_format.js b/src/plots/cartesian/axis_format.js index 0e1d3c001d5..d64a495a20f 100644 --- a/src/plots/cartesian/axis_format.js +++ b/src/plots/cartesian/axis_format.js @@ -25,13 +25,13 @@ function descriptionOnlyNumbers(label, x) { return [ 'Sets the ' + label + ' formatting rule' + (x ? 'for `' + x + '` ' : ''), 'using d3 formatting mini-languages', - 'which are very similar to those in Python. For numbers, see: ' + FORMAT_LINK + 'which are very similar to those in Python. For numbers, see: ' + FORMAT_LINK + '.' ].join(' '); } function descriptionWithDates(label, x) { return descriptionOnlyNumbers(label, x) + [ - ' And for dates see: ' + DATE_FORMAT_LINK, + ' And for dates see: ' + DATE_FORMAT_LINK + '.', 'We add two items to d3\'s date formatter:', '*%h* for half of the year as a decimal number as well as', '*%{n}f* for fractional seconds', From 4caa5d8a95254ee3ef5329c1e0b551246e0c4474 Mon Sep 17 00:00:00 2001 From: archmoj Date: Thu, 24 Jun 2021 11:32:59 -0400 Subject: [PATCH 6/7] maintain string type --- src/lib/dates.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/dates.js b/src/lib/dates.js index 3d32f465538..8fb03a2b31c 100644 --- a/src/lib/dates.js +++ b/src/lib/dates.js @@ -378,10 +378,10 @@ exports.cleanDate = function(v, dflt, calendar) { var fracMatch = /%\d?f/g; var halfYearMatch = /%h/g; var quarterToHalfYear = { - '1': 1, - '2': 1, - '3': 2, - '4': 2, + '1': '1', + '2': '1', + '3': '2', + '4': '2', }; function modDateFormat(fmt, x, formatter, calendar) { fmt = fmt.replace(fracMatch, function(match) { From 780821722226a6ed1e689d4b5ec01b6703c65f29 Mon Sep 17 00:00:00 2001 From: archmoj Date: Thu, 24 Jun 2021 13:44:34 -0400 Subject: [PATCH 7/7] rename file to axis_format_attributes --- .../cartesian/{axis_format.js => axis_format_attributes.js} | 0 src/plots/cartesian/layout_attributes.js | 2 +- src/traces/bar/attributes.js | 2 +- src/traces/box/attributes.js | 2 +- src/traces/candlestick/attributes.js | 2 +- src/traces/carpet/axis_attributes.js | 2 +- src/traces/cone/attributes.js | 2 +- src/traces/contour/attributes.js | 2 +- src/traces/funnel/attributes.js | 2 +- src/traces/heatmap/attributes.js | 2 +- src/traces/histogram/attributes.js | 2 +- src/traces/histogram2d/attributes.js | 2 +- src/traces/histogram2dcontour/attributes.js | 2 +- src/traces/indicator/attributes.js | 2 +- src/traces/isosurface/attributes.js | 2 +- src/traces/mesh3d/attributes.js | 2 +- src/traces/ohlc/attributes.js | 2 +- src/traces/sankey/attributes.js | 2 +- src/traces/scatter/attributes.js | 2 +- src/traces/scatter3d/attributes.js | 2 +- src/traces/scattergl/attributes.js | 2 +- src/traces/splom/attributes.js | 2 +- src/traces/streamtube/attributes.js | 2 +- src/traces/surface/attributes.js | 2 +- src/traces/table/attributes.js | 2 +- src/traces/violin/attributes.js | 2 +- src/traces/waterfall/attributes.js | 2 +- 27 files changed, 26 insertions(+), 26 deletions(-) rename src/plots/cartesian/{axis_format.js => axis_format_attributes.js} (100%) diff --git a/src/plots/cartesian/axis_format.js b/src/plots/cartesian/axis_format_attributes.js similarity index 100% rename from src/plots/cartesian/axis_format.js rename to src/plots/cartesian/axis_format_attributes.js diff --git a/src/plots/cartesian/layout_attributes.js b/src/plots/cartesian/layout_attributes.js index d36298959fc..ababd7d9649 100644 --- a/src/plots/cartesian/layout_attributes.js +++ b/src/plots/cartesian/layout_attributes.js @@ -5,7 +5,7 @@ var colorAttrs = require('../../components/color/attributes'); var dash = require('../../components/drawing/attributes').dash; var extendFlat = require('../../lib/extend').extendFlat; var templatedArray = require('../../plot_api/plot_template').templatedArray; -var descriptionWithDates = require('../../plots/cartesian/axis_format').descriptionWithDates; +var descriptionWithDates = require('../../plots/cartesian/axis_format_attributes').descriptionWithDates; var ONEDAY = require('../../constants/numerical').ONEDAY; var constants = require('./constants'); diff --git a/src/traces/bar/attributes.js b/src/traces/bar/attributes.js index a412ea63aba..de48a83c666 100644 --- a/src/traces/bar/attributes.js +++ b/src/traces/bar/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var scatterAttrs = require('../scatter/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/box/attributes.js b/src/traces/box/attributes.js index 4bca6960cd8..2c0d615a4d5 100644 --- a/src/traces/box/attributes.js +++ b/src/traces/box/attributes.js @@ -3,7 +3,7 @@ var scatterAttrs = require('../scatter/attributes'); var barAttrs = require('../bar/attributes'); var colorAttrs = require('../../components/color/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var extendFlat = require('../../lib/extend').extendFlat; diff --git a/src/traces/candlestick/attributes.js b/src/traces/candlestick/attributes.js index 26914ee64ad..e114d59307b 100644 --- a/src/traces/candlestick/attributes.js +++ b/src/traces/candlestick/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var extendFlat = require('../../lib').extendFlat; -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var OHLCattrs = require('../ohlc/attributes'); var boxAttrs = require('../box/attributes'); diff --git a/src/traces/carpet/axis_attributes.js b/src/traces/carpet/axis_attributes.js index 84adaf414d9..480e6685344 100644 --- a/src/traces/carpet/axis_attributes.js +++ b/src/traces/carpet/axis_attributes.js @@ -3,7 +3,7 @@ var fontAttrs = require('../../plots/font_attributes'); var colorAttrs = require('../../components/color/attributes'); var axesAttrs = require('../../plots/cartesian/layout_attributes'); -var descriptionWithDates = require('../../plots/cartesian/axis_format').descriptionWithDates; +var descriptionWithDates = require('../../plots/cartesian/axis_format_attributes').descriptionWithDates; var overrideAll = require('../../plot_api/edit_types').overrideAll; module.exports = { diff --git a/src/traces/cone/attributes.js b/src/traces/cone/attributes.js index 21f0f3e0a47..d951562f69a 100644 --- a/src/traces/cone/attributes.js +++ b/src/traces/cone/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var mesh3dAttrs = require('../mesh3d/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/contour/attributes.js b/src/traces/contour/attributes.js index 2cce0dc3d3f..ca6e8e3b2f5 100644 --- a/src/traces/contour/attributes.js +++ b/src/traces/contour/attributes.js @@ -2,7 +2,7 @@ var heatmapAttrs = require('../heatmap/attributes'); var scatterAttrs = require('../scatter/attributes'); -var axisFormat = require('../../plots/cartesian/axis_format'); +var axisFormat = require('../../plots/cartesian/axis_format_attributes'); var axisHoverFormat = axisFormat.axisHoverFormat; var descriptionOnlyNumbers = axisFormat.descriptionOnlyNumbers; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/funnel/attributes.js b/src/traces/funnel/attributes.js index be8e4d63b2f..0ac65a5ad59 100644 --- a/src/traces/funnel/attributes.js +++ b/src/traces/funnel/attributes.js @@ -3,7 +3,7 @@ var barAttrs = require('../bar/attributes'); var lineAttrs = require('../scatter/attributes').line; var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var constants = require('./constants'); diff --git a/src/traces/heatmap/attributes.js b/src/traces/heatmap/attributes.js index 81343231130..db0bfd6bf10 100644 --- a/src/traces/heatmap/attributes.js +++ b/src/traces/heatmap/attributes.js @@ -2,7 +2,7 @@ var scatterAttrs = require('../scatter/attributes'); var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/histogram/attributes.js b/src/traces/histogram/attributes.js index 8585cb91bc4..4eac95a177d 100644 --- a/src/traces/histogram/attributes.js +++ b/src/traces/histogram/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var barAttrs = require('../bar/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var makeBinAttrs = require('./bin_attributes'); var constants = require('./constants'); diff --git a/src/traces/histogram2d/attributes.js b/src/traces/histogram2d/attributes.js index b30f380e6dd..79c84651228 100644 --- a/src/traces/histogram2d/attributes.js +++ b/src/traces/histogram2d/attributes.js @@ -4,7 +4,7 @@ var histogramAttrs = require('../histogram/attributes'); var makeBinAttrs = require('../histogram/bin_attributes'); var heatmapAttrs = require('../heatmap/attributes'); var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/histogram2dcontour/attributes.js b/src/traces/histogram2dcontour/attributes.js index f5577515aa9..8423b9ab57f 100644 --- a/src/traces/histogram2dcontour/attributes.js +++ b/src/traces/histogram2dcontour/attributes.js @@ -3,7 +3,7 @@ var histogram2dAttrs = require('../histogram2d/attributes'); var contourAttrs = require('../contour/attributes'); var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var extendFlat = require('../../lib/extend').extendFlat; diff --git a/src/traces/indicator/attributes.js b/src/traces/indicator/attributes.js index 96a8df10498..2757fa82dc8 100644 --- a/src/traces/indicator/attributes.js +++ b/src/traces/indicator/attributes.js @@ -9,7 +9,7 @@ var domainAttrs = require('../../plots/domain').attributes; var axesAttrs = require('../../plots/cartesian/layout_attributes'); var templatedArray = require('../../plot_api/plot_template').templatedArray; var delta = require('../../constants/delta.js'); -var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format').descriptionOnlyNumbers; +var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format_attributes').descriptionOnlyNumbers; var textFontAttrs = fontAttrs({ editType: 'plot', diff --git a/src/traces/isosurface/attributes.js b/src/traces/isosurface/attributes.js index 77e77508887..cb00ecbef76 100644 --- a/src/traces/isosurface/attributes.js +++ b/src/traces/isosurface/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var meshAttrs = require('../mesh3d/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/mesh3d/attributes.js b/src/traces/mesh3d/attributes.js index 0e2892e97fd..6614a4bf4b2 100644 --- a/src/traces/mesh3d/attributes.js +++ b/src/traces/mesh3d/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var surfaceAttrs = require('../surface/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/ohlc/attributes.js b/src/traces/ohlc/attributes.js index f74d3457cfa..faf59ab3308 100644 --- a/src/traces/ohlc/attributes.js +++ b/src/traces/ohlc/attributes.js @@ -2,7 +2,7 @@ var extendFlat = require('../../lib').extendFlat; var scatterAttrs = require('../scatter/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var dash = require('../../components/drawing/attributes').dash; var fxAttrs = require('../../components/fx/attributes'); var delta = require('../../constants/delta.js'); diff --git a/src/traces/sankey/attributes.js b/src/traces/sankey/attributes.js index ad63589bec8..223ced245d8 100644 --- a/src/traces/sankey/attributes.js +++ b/src/traces/sankey/attributes.js @@ -8,7 +8,7 @@ var domainAttrs = require('../../plots/domain').attributes; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorAttributes = require('../../components/colorscale/attributes'); var templatedArray = require('../../plot_api/plot_template').templatedArray; -var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format').descriptionOnlyNumbers; +var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format_attributes').descriptionOnlyNumbers; var extendFlat = require('../../lib/extend').extendFlat; var overrideAll = require('../../plot_api/edit_types').overrideAll; diff --git a/src/traces/scatter/attributes.js b/src/traces/scatter/attributes.js index 2a02014fc8c..634104692df 100644 --- a/src/traces/scatter/attributes.js +++ b/src/traces/scatter/attributes.js @@ -1,6 +1,6 @@ 'use strict'; -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var colorScaleAttrs = require('../../components/colorscale/attributes'); diff --git a/src/traces/scatter3d/attributes.js b/src/traces/scatter3d/attributes.js index 555fb8d14fa..2fc67501b4d 100644 --- a/src/traces/scatter3d/attributes.js +++ b/src/traces/scatter3d/attributes.js @@ -2,7 +2,7 @@ var scatterAttrs = require('../scatter/attributes'); var colorAttributes = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/scattergl/attributes.js b/src/traces/scattergl/attributes.js index d24889122d4..d61cbb243e5 100644 --- a/src/traces/scattergl/attributes.js +++ b/src/traces/scattergl/attributes.js @@ -2,7 +2,7 @@ var baseAttrs = require('../../plots/attributes'); var scatterAttrs = require('../scatter/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var colorScaleAttrs = require('../../components/colorscale/attributes'); var extendFlat = require('../../lib/extend').extendFlat; diff --git a/src/traces/splom/attributes.js b/src/traces/splom/attributes.js index 6199e826bda..dfbb585255a 100644 --- a/src/traces/splom/attributes.js +++ b/src/traces/splom/attributes.js @@ -2,7 +2,7 @@ var scatterAttrs = require('../scatter/attributes'); var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var scatterGlAttrs = require('../scattergl/attributes'); var cartesianIdRegex = require('../../plots/cartesian/constants').idRegex; diff --git a/src/traces/streamtube/attributes.js b/src/traces/streamtube/attributes.js index 169c6f4b7ad..46f5a7f1f9f 100644 --- a/src/traces/streamtube/attributes.js +++ b/src/traces/streamtube/attributes.js @@ -1,7 +1,7 @@ 'use strict'; var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var mesh3dAttrs = require('../mesh3d/attributes'); var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/surface/attributes.js b/src/traces/surface/attributes.js index 864f49274ef..10f86d14fe0 100644 --- a/src/traces/surface/attributes.js +++ b/src/traces/surface/attributes.js @@ -2,7 +2,7 @@ var Color = require('../../components/color'); var colorScaleAttrs = require('../../components/colorscale/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var baseAttrs = require('../../plots/attributes'); diff --git a/src/traces/table/attributes.js b/src/traces/table/attributes.js index 2520c879074..ba2e790a6ca 100644 --- a/src/traces/table/attributes.js +++ b/src/traces/table/attributes.js @@ -5,7 +5,7 @@ var extendFlat = require('../../lib/extend').extendFlat; var overrideAll = require('../../plot_api/edit_types').overrideAll; var fontAttrs = require('../../plots/font_attributes'); var domainAttrs = require('../../plots/domain').attributes; -var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format').descriptionOnlyNumbers; +var descriptionOnlyNumbers = require('../../plots/cartesian/axis_format_attributes').descriptionOnlyNumbers; var attrs = module.exports = overrideAll({ domain: domainAttrs({name: 'table', trace: true}), diff --git a/src/traces/violin/attributes.js b/src/traces/violin/attributes.js index 743c89de16a..7b0a60978d6 100644 --- a/src/traces/violin/attributes.js +++ b/src/traces/violin/attributes.js @@ -2,7 +2,7 @@ var boxAttrs = require('../box/attributes'); var extendFlat = require('../../lib/extend').extendFlat; -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; module.exports = { y: boxAttrs.y, diff --git a/src/traces/waterfall/attributes.js b/src/traces/waterfall/attributes.js index 34bf093e433..cadd27a18ab 100644 --- a/src/traces/waterfall/attributes.js +++ b/src/traces/waterfall/attributes.js @@ -3,7 +3,7 @@ var barAttrs = require('../bar/attributes'); var lineAttrs = require('../scatter/attributes').line; var baseAttrs = require('../../plots/attributes'); -var axisHoverFormat = require('../../plots/cartesian/axis_format').axisHoverFormat; +var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat; var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; var constants = require('./constants');