billboard.js 4.1.4 → 4.2.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billboard.css +87 -1
- package/dist/billboard.js +11129 -7032
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +20 -20
- package/dist/billboard.pkgd.js +22703 -14154
- package/dist/billboard.pkgd.min.js +37 -37
- package/dist/billboard.react.js +5 -5
- package/dist/billboard.react.min.js +2 -2
- package/dist/billboard.worker.js +1 -1
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +21 -4
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +22 -13
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +20 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1689 -1252
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2288 -1012
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6350 -2390
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1310 -1006
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1293 -1006
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
- package/dist/theme/dark.css +90 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +87 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +87 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +87 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +87 -1
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/Chart/Chart.js +5 -5
- package/dist-esm/Chart/api/axis.js +2 -3
- package/dist-esm/Chart/api/category.js +2 -3
- package/dist-esm/Chart/api/chart.js +3 -4
- package/dist-esm/Chart/api/color.js +2 -3
- package/dist-esm/Chart/api/data.js +3 -4
- package/dist-esm/Chart/api/export.js +3 -4
- package/dist-esm/Chart/api/flow.js +15 -9
- package/dist-esm/Chart/api/focus.js +5 -3
- package/dist-esm/Chart/api/grid.js +2 -3
- package/dist-esm/Chart/api/group.js +2 -3
- package/dist-esm/Chart/api/legend.js +1 -2
- package/dist-esm/Chart/api/load.js +3 -4
- package/dist-esm/Chart/api/regions.js +3 -4
- package/dist-esm/Chart/api/selection.js +3 -4
- package/dist-esm/Chart/api/show.js +2 -3
- package/dist-esm/Chart/api/stubs.js +3 -4
- package/dist-esm/Chart/api/subchart.js +4 -5
- package/dist-esm/Chart/api/tooltip.js +28 -9
- package/dist-esm/Chart/api/x.js +2 -3
- package/dist-esm/Chart/api/zoom.js +6 -7
- package/dist-esm/ChartInternal/Axis/Axis.js +5 -6
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +26 -17
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +40 -12
- package/dist-esm/ChartInternal/ChartInternal.js +39 -24
- package/dist-esm/ChartInternal/data/convert.helper.js +2 -3
- package/dist-esm/ChartInternal/data/convert.js +3 -4
- package/dist-esm/ChartInternal/data/data.js +18 -11
- package/dist-esm/ChartInternal/data/load.js +4 -5
- package/dist-esm/ChartInternal/interactions/drag.js +3 -4
- package/dist-esm/ChartInternal/interactions/eventrect.js +4 -5
- package/dist-esm/ChartInternal/interactions/flow.js +25 -19
- package/dist-esm/ChartInternal/interactions/interaction.js +14 -13
- package/dist-esm/ChartInternal/interactions/subchart.js +5 -6
- package/dist-esm/ChartInternal/interactions/zoom.js +4 -5
- package/dist-esm/ChartInternal/internals/category.js +2 -3
- package/dist-esm/ChartInternal/internals/class.js +5 -5
- package/dist-esm/ChartInternal/internals/clip.js +2 -3
- package/dist-esm/ChartInternal/internals/color.js +4 -5
- package/dist-esm/ChartInternal/internals/domain.js +7 -7
- package/dist-esm/ChartInternal/internals/format.js +3 -4
- package/dist-esm/ChartInternal/internals/grid.js +4 -5
- package/dist-esm/ChartInternal/internals/legend.js +7 -7
- package/dist-esm/ChartInternal/internals/redraw.js +13 -13
- package/dist-esm/ChartInternal/internals/region.js +4 -5
- package/dist-esm/ChartInternal/internals/scale.js +2 -3
- package/dist-esm/ChartInternal/internals/selection.js +3 -4
- package/dist-esm/ChartInternal/internals/size.axis.js +2 -3
- package/dist-esm/ChartInternal/internals/size.js +8 -9
- package/dist-esm/ChartInternal/internals/style.js +4 -5
- package/dist-esm/ChartInternal/internals/subchart.util.js +2 -3
- package/dist-esm/ChartInternal/internals/text.arc.js +3 -4
- package/dist-esm/ChartInternal/internals/text.js +22 -23
- package/dist-esm/ChartInternal/internals/text.util.js +4 -5
- package/dist-esm/ChartInternal/internals/title.js +4 -5
- package/dist-esm/ChartInternal/internals/tooltip.js +42 -23
- package/dist-esm/ChartInternal/internals/transform.js +5 -6
- package/dist-esm/ChartInternal/internals/type.js +78 -11
- package/dist-esm/ChartInternal/shape/arc.js +5 -6
- package/dist-esm/ChartInternal/shape/area.js +4 -5
- package/dist-esm/ChartInternal/shape/bar.js +5 -6
- package/dist-esm/ChartInternal/shape/boxplot.js +111 -0
- package/dist-esm/ChartInternal/shape/bubble.js +2 -3
- package/dist-esm/ChartInternal/shape/bullet.js +213 -0
- package/dist-esm/ChartInternal/shape/candlestick.js +5 -6
- package/dist-esm/ChartInternal/shape/core/barRadius.js +2 -3
- package/dist-esm/ChartInternal/shape/core/boxplot.js +192 -0
- package/dist-esm/ChartInternal/shape/core/bubble.js +4 -5
- package/dist-esm/ChartInternal/shape/core/bullet.js +528 -0
- package/dist-esm/ChartInternal/shape/core/candlestick.js +2 -3
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +2 -3
- package/dist-esm/ChartInternal/shape/core/geometry.js +2 -3
- package/dist-esm/ChartInternal/shape/core/heatmap.js +453 -0
- package/dist-esm/ChartInternal/shape/core/path.js +2 -3
- package/dist-esm/ChartInternal/shape/core/point.js +2 -3
- package/dist-esm/ChartInternal/shape/core/sankey.js +576 -0
- package/dist-esm/ChartInternal/shape/core/treemap.js +2 -3
- package/dist-esm/ChartInternal/shape/funnel.js +45 -6
- package/dist-esm/ChartInternal/shape/gauge.js +3 -4
- package/dist-esm/ChartInternal/shape/heatmap.js +144 -0
- package/dist-esm/ChartInternal/shape/line.js +7 -8
- package/dist-esm/ChartInternal/shape/point.js +9 -9
- package/dist-esm/ChartInternal/shape/polar.js +3 -4
- package/dist-esm/ChartInternal/shape/radar.js +19 -7
- package/dist-esm/ChartInternal/shape/sankey.js +154 -0
- package/dist-esm/ChartInternal/shape/shape.js +15 -11
- package/dist-esm/ChartInternal/shape/treemap.js +8 -5
- package/dist-esm/canvas/CanvasAxisRenderer.js +28 -328
- package/dist-esm/canvas/CanvasEngine.js +2 -3
- package/dist-esm/canvas/CanvasPainter.js +2 -3
- package/dist-esm/canvas/CanvasRenderer.js +38 -408
- package/dist-esm/canvas/CanvasTheme.js +28 -8
- package/dist-esm/canvas/HitDetector.js +20 -24
- package/dist-esm/canvas/axisTicks.js +5 -6
- package/dist-esm/canvas/boxplot.js +201 -0
- package/dist-esm/canvas/bullet.js +212 -0
- package/dist-esm/canvas/classes.js +2 -3
- package/dist-esm/canvas/color.js +2 -3
- package/dist-esm/canvas/flow.js +190 -0
- package/dist-esm/canvas/geometry.js +2 -3
- package/dist-esm/canvas/grid.js +206 -0
- package/dist-esm/canvas/heatmap.js +141 -0
- package/dist-esm/canvas/labels.js +3 -4
- package/dist-esm/canvas/pointPattern.js +2 -3
- package/dist-esm/canvas/sankey.js +137 -0
- package/dist-esm/canvas/selection.js +473 -0
- package/dist-esm/canvas/subchart.js +814 -0
- package/dist-esm/canvas/treemap.js +100 -0
- package/dist-esm/canvas/util.js +2 -3
- package/dist-esm/config/Options/Options.js +3 -4
- package/dist-esm/config/Options/axis/axis.js +2 -3
- package/dist-esm/config/Options/axis/x.js +2 -3
- package/dist-esm/config/Options/axis/y.js +2 -3
- package/dist-esm/config/Options/axis/y2.js +14 -3
- package/dist-esm/config/Options/common/boost.js +2 -3
- package/dist-esm/config/Options/common/color.js +2 -3
- package/dist-esm/config/Options/common/grid.js +2 -3
- package/dist-esm/config/Options/common/legend.js +2 -3
- package/dist-esm/config/Options/common/main.js +2 -3
- package/dist-esm/config/Options/common/point.js +2 -3
- package/dist-esm/config/Options/common/title.js +2 -3
- package/dist-esm/config/Options/common/tooltip.js +2 -3
- package/dist-esm/config/Options/data/axis.js +2 -3
- package/dist-esm/config/Options/data/data.js +49 -4
- package/dist-esm/config/Options/data/selection.js +2 -3
- package/dist-esm/config/Options/interaction/interaction.js +2 -3
- package/dist-esm/config/Options/interaction/subchart.js +6 -3
- package/dist-esm/config/Options/interaction/zoom.js +2 -3
- package/dist-esm/config/Options/shape/arc.js +2 -3
- package/dist-esm/config/Options/shape/area.js +2 -3
- package/dist-esm/config/Options/shape/bar.js +2 -3
- package/dist-esm/config/Options/shape/boxplot.js +106 -0
- package/dist-esm/config/Options/shape/bubble.js +2 -3
- package/dist-esm/config/Options/shape/bullet.js +177 -0
- package/dist-esm/config/Options/shape/candlestick.js +2 -3
- package/dist-esm/config/Options/shape/donut.js +2 -3
- package/dist-esm/config/Options/shape/funnel.js +2 -3
- package/dist-esm/config/Options/shape/gauge.js +2 -3
- package/dist-esm/config/Options/shape/heatmap.js +137 -0
- package/dist-esm/config/Options/shape/line.js +2 -3
- package/dist-esm/config/Options/shape/pie.js +2 -3
- package/dist-esm/config/Options/shape/polar.js +2 -3
- package/dist-esm/config/Options/shape/radar.js +2 -3
- package/dist-esm/config/Options/shape/sankey.js +116 -0
- package/dist-esm/config/Options/shape/scatter.js +2 -3
- package/dist-esm/config/Options/shape/spline.js +2 -3
- package/dist-esm/config/Options/shape/treemap.js +2 -3
- package/dist-esm/config/Store/Element.js +2 -3
- package/dist-esm/config/Store/State.js +4 -4
- package/dist-esm/config/Store/Store.js +2 -3
- package/dist-esm/config/classes.js +2 -4
- package/dist-esm/config/config.js +2 -3
- package/dist-esm/config/const.js +31 -23
- package/dist-esm/config/resolver/axis.core.js +4 -5
- package/dist-esm/config/resolver/axis.js +2 -3
- package/dist-esm/config/resolver/canvas.js +113 -900
- package/dist-esm/config/resolver/canvasBoxplot.js +49 -0
- package/dist-esm/config/resolver/canvasBullet.js +29 -0
- package/dist-esm/config/resolver/canvasFlow.js +28 -0
- package/dist-esm/config/resolver/canvasGrid.js +27 -0
- package/dist-esm/config/resolver/canvasHeatmap.js +31 -0
- package/dist-esm/config/resolver/canvasSankey.js +31 -0
- package/dist-esm/config/resolver/canvasSelection.js +30 -0
- package/dist-esm/config/resolver/canvasShape.js +13 -12
- package/dist-esm/config/resolver/canvasSubchart.js +30 -0
- package/dist-esm/config/resolver/canvasType.js +48 -0
- package/dist-esm/config/resolver/category.js +3 -4
- package/dist-esm/config/resolver/customType.js +58 -0
- package/dist-esm/config/resolver/export.js +3 -4
- package/dist-esm/config/resolver/flow.js +5 -6
- package/dist-esm/config/resolver/grid.js +6 -7
- package/dist-esm/config/resolver/interaction/selection.js +6 -7
- package/dist-esm/config/resolver/interaction/subchart.js +6 -7
- package/dist-esm/config/resolver/interaction/zoom.js +6 -7
- package/dist-esm/config/resolver/regions.js +5 -6
- package/dist-esm/config/resolver/shape/arc.helpers.js +5 -6
- package/dist-esm/config/resolver/shape/area.js +3 -4
- package/dist-esm/config/resolver/shape/axis.helpers.js +2 -3
- package/dist-esm/config/resolver/shape/bar.js +5 -6
- package/dist-esm/config/resolver/shape/boxplot.js +30 -0
- package/dist-esm/config/resolver/shape/bubble.js +5 -6
- package/dist-esm/config/resolver/shape/bullet.js +23 -0
- package/dist-esm/config/resolver/shape/candlestick.js +5 -6
- package/dist-esm/config/resolver/shape/donut.js +2 -3
- package/dist-esm/config/resolver/shape/funnel.js +7 -6
- package/dist-esm/config/resolver/shape/gauge.js +4 -5
- package/dist-esm/config/resolver/shape/heatmap.js +23 -0
- package/dist-esm/config/resolver/shape/line.js +2 -3
- package/dist-esm/config/resolver/shape/pie.js +3 -4
- package/dist-esm/config/resolver/shape/polar.js +4 -5
- package/dist-esm/config/resolver/shape/radar.js +5 -6
- package/dist-esm/config/resolver/shape/sankey.js +23 -0
- package/dist-esm/config/resolver/shape/scatter.js +4 -5
- package/dist-esm/config/resolver/shape/treemap.js +4 -5
- package/dist-esm/core.js +5 -6
- package/dist-esm/index.canvas.js +13 -9
- package/dist-esm/index.esm.js +6 -2
- package/dist-esm/module/Cache.js +2 -3
- package/dist-esm/module/browser.js +2 -3
- package/dist-esm/module/dsv.js +2 -3
- package/dist-esm/module/error.js +23 -16
- package/dist-esm/module/generator.js +3 -4
- package/dist-esm/module/sanitize.js +2 -3
- package/dist-esm/module/util/brush.js +2 -3
- package/dist-esm/module/util/dom.js +3 -4
- package/dist-esm/module/util/object.js +13 -6
- package/dist-esm/module/util/type-checks.js +2 -3
- package/dist-esm/module/worker.js +2 -3
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +6 -10
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +10 -18
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +17 -45
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -18
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +9 -16
- package/dist-esm/react/index.js +2 -3
- package/package.json +44 -44
- package/src/Chart/Chart.ts +1 -0
- package/src/Chart/api/chart.ts +2 -1
- package/src/Chart/api/flow.ts +20 -7
- package/src/Chart/api/focus.ts +3 -0
- package/src/Chart/api/subchart.ts +1 -1
- package/src/Chart/api/tooltip.ts +54 -15
- package/src/ChartInternal/Axis/AxisRenderer.ts +29 -20
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +45 -9
- package/src/ChartInternal/ChartInternal.ts +46 -19
- package/src/ChartInternal/data/IData.ts +13 -0
- package/src/ChartInternal/data/data.ts +26 -5
- package/src/ChartInternal/data/load.ts +2 -2
- package/src/ChartInternal/interactions/flow.ts +50 -19
- package/src/ChartInternal/interactions/interaction.ts +15 -11
- package/src/ChartInternal/internals/class.ts +3 -2
- package/src/ChartInternal/internals/domain.ts +4 -2
- package/src/ChartInternal/internals/format.ts +3 -1
- package/src/ChartInternal/internals/legend.ts +2 -1
- package/src/ChartInternal/internals/redraw.ts +18 -12
- package/src/ChartInternal/internals/size.ts +5 -3
- package/src/ChartInternal/internals/text.ts +24 -28
- package/src/ChartInternal/internals/tooltip.ts +59 -20
- package/src/ChartInternal/internals/transform.ts +2 -2
- package/src/ChartInternal/internals/type.ts +101 -9
- package/src/ChartInternal/shape/boxplot.ts +172 -0
- package/src/ChartInternal/shape/bullet.ts +323 -0
- package/src/ChartInternal/shape/core/boxplot.ts +241 -0
- package/src/ChartInternal/shape/core/bullet.ts +734 -0
- package/src/ChartInternal/shape/core/heatmap.ts +665 -0
- package/src/ChartInternal/shape/core/sankey.ts +782 -0
- package/src/ChartInternal/shape/funnel.ts +73 -2
- package/src/ChartInternal/shape/heatmap.ts +236 -0
- package/src/ChartInternal/shape/point.ts +6 -3
- package/src/ChartInternal/shape/radar.ts +30 -1
- package/src/ChartInternal/shape/sankey.ts +242 -0
- package/src/ChartInternal/shape/shape.ts +16 -4
- package/src/ChartInternal/shape/treemap.ts +10 -0
- package/src/Plugin/stanford/index.ts +1 -28
- package/src/canvas/CanvasAxisRenderer.ts +54 -596
- package/src/canvas/CanvasRenderer.ts +68 -640
- package/src/canvas/CanvasTheme.ts +92 -6
- package/src/canvas/HitDetector.ts +30 -28
- package/src/canvas/boxplot.ts +230 -0
- package/src/canvas/bullet.ts +269 -0
- package/src/canvas/flow.ts +237 -0
- package/src/canvas/grid.ts +359 -0
- package/src/canvas/heatmap.ts +147 -0
- package/src/canvas/labels.ts +3 -1
- package/src/canvas/sankey.ts +151 -0
- package/src/canvas/selection.ts +626 -0
- package/src/canvas/subchart.ts +1292 -0
- package/src/canvas/treemap.ts +142 -0
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/data/data.ts +47 -1
- package/src/config/Options/interaction/subchart.ts +4 -0
- package/src/config/Options/shape/boxplot.ts +95 -0
- package/src/config/Options/shape/bullet.ts +170 -0
- package/src/config/Options/shape/heatmap.ts +125 -0
- package/src/config/Options/shape/sankey.ts +108 -0
- package/src/config/Store/State.ts +2 -1
- package/src/config/classes.ts +0 -1
- package/src/config/const.ts +30 -21
- package/src/config/resolver/canvas.ts +147 -1293
- package/src/config/resolver/canvasBoxplot.ts +42 -0
- package/src/config/resolver/canvasBullet.ts +20 -0
- package/src/config/resolver/canvasFlow.ts +18 -0
- package/src/config/resolver/canvasGrid.ts +17 -0
- package/src/config/resolver/canvasHeatmap.ts +23 -0
- package/src/config/resolver/canvasSankey.ts +23 -0
- package/src/config/resolver/canvasSelection.ts +20 -0
- package/src/config/resolver/canvasShape.ts +6 -1
- package/src/config/resolver/canvasSubchart.ts +20 -0
- package/src/config/resolver/canvasType.ts +51 -0
- package/src/config/resolver/customType.ts +69 -0
- package/src/config/resolver/shape/boxplot.ts +31 -0
- package/src/config/resolver/shape/bullet.ts +18 -0
- package/src/config/resolver/shape/funnel.ts +8 -2
- package/src/config/resolver/shape/heatmap.ts +18 -0
- package/src/config/resolver/shape/index.ts +4 -0
- package/src/config/resolver/shape/sankey.ts +18 -0
- package/src/index.canvas.ts +9 -3
- package/src/index.esm.ts +4 -0
- package/src/index.ts +34 -0
- package/src/module/error.ts +32 -18
- package/src/module/util/object.ts +26 -1
- package/src/scss/billboard.scss +106 -0
- package/src/scss/theme/dark.scss +110 -0
- package/src/scss/theme/datalab.scss +106 -0
- package/src/scss/theme/graph.scss +106 -0
- package/src/scss/theme/insight.scss +106 -0
- package/src/scss/theme/modern.scss +106 -0
- package/types/bb.d.ts +4 -0
- package/types/canvas.d.ts +3 -0
- package/types/chart.d.ts +5 -0
- package/types/index.d.ts +4 -0
- package/types/options.d.ts +13 -1
- package/types/options.shape.d.ts +431 -0
- package/types/types.d.ts +4 -0
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import { getAdditionalAxisScale, getAdditionalAxisTickFormat, getAdditionalAxisTickValues, getSubXTickLineValues, getSubXTickValues, getXScale, getXTickLinePosition, getXTickLineValues, getXTickValues, getYGridTickValues, getYTickValues, isSameTickValue, normalizeXValue, normalizeYValue } from "./axisTicks.js";
|
|
10
|
+
import { getAdditionalAxisScale, getAdditionalAxisTickFormat, getAdditionalAxisTickValues, getXScale, getXTickLinePosition, getXTickLineValues, getXTickValues, getYTickValues, isSameTickValue, normalizeXValue, normalizeYValue } from "./axisTicks.js";
|
|
12
11
|
import CanvasPainter from "./CanvasPainter.js";
|
|
13
|
-
|
|
12
|
+
import { getFontSize } from "./util.js";
|
|
13
|
+
// src/canvas/CanvasAxisRenderer.ts
|
|
14
14
|
const X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING = 20;
|
|
15
15
|
const X_AXIS_TICK_TEXT_VERTICAL_CLIP_PADDING = 15;
|
|
16
16
|
/**
|
|
@@ -33,44 +33,6 @@ function getYTickTextDirection(isRotated, isY2) {
|
|
|
33
33
|
return isRotated ? isY2 ? -1 : 1 : isY2 ? 1 : -1;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
* Get tick formatter for the canvas subchart y/y2 axis.
|
|
37
|
-
* @param {object} $$ ChartInternal context
|
|
38
|
-
* @param {string} id Axis id
|
|
39
|
-
* @returns {function} Tick formatter
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
function getSubYTickFormat($$, id) {
|
|
43
|
-
const axisFormat = $$.axis?.[id === "y2" ? "subY2" : "subY"]?.tickFormat?.();
|
|
44
|
-
const configFormat = $$.config[`subchart_axis_${id}_tick_format`] || $$.config[`axis_${id}_tick_format`];
|
|
45
|
-
if (axisFormat) return axisFormat;
|
|
46
|
-
return typeof configFormat === "function" ? configFormat.bind($$.api) : ((v) => v);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Convert resolved grid line style to painter line style.
|
|
50
|
-
* @param {object} style Grid line style
|
|
51
|
-
* @returns {object|undefined} Canvas line style
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
function getGridLineCanvasStyle(style) {
|
|
55
|
-
return style ? {
|
|
56
|
-
stroke: style.lineColor,
|
|
57
|
-
lineWidth: style.lineWidth,
|
|
58
|
-
lineDash: style.dashArray
|
|
59
|
-
} : void 0;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Convert resolved grid text style to painter text style.
|
|
63
|
-
* @param {object} style Grid text style
|
|
64
|
-
* @returns {object|undefined} Canvas text style
|
|
65
|
-
* @private
|
|
66
|
-
*/
|
|
67
|
-
function getGridTextCanvasStyle(style) {
|
|
68
|
-
return style ? {
|
|
69
|
-
fill: style.labelColor,
|
|
70
|
-
font: style.labelFont
|
|
71
|
-
} : void 0;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
36
|
* Get horizontal x-axis clip rect with small text overflow tolerance.
|
|
75
37
|
* @param {object} margin Chart margin
|
|
76
38
|
* @param {number} width Plot width
|
|
@@ -250,22 +212,25 @@ function resolveTextOffset(value, fontSize) {
|
|
|
250
212
|
function splitTickTextByWidth(text, width, painter) {
|
|
251
213
|
if (!width) return [text];
|
|
252
214
|
const charWidth = painter.measureText("0").width || 5.5;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
* @param {string} value Remaining text fragment
|
|
257
|
-
* @returns {Array} Text lines
|
|
258
|
-
* @private
|
|
259
|
-
*/
|
|
260
|
-
function split(lines, value) {
|
|
215
|
+
const lines = [];
|
|
216
|
+
let start = 0;
|
|
217
|
+
while (true) {
|
|
261
218
|
let spaceIndex;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (
|
|
219
|
+
let splitAt = -1;
|
|
220
|
+
for (let i = 1; start + i < text.length; i++) {
|
|
221
|
+
if (text.charAt(start + i) === " ") spaceIndex = i;
|
|
222
|
+
if (width < charWidth * (i + 1)) {
|
|
223
|
+
splitAt = i;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (splitAt === -1) {
|
|
228
|
+
lines.push(text.slice(start));
|
|
229
|
+
return lines;
|
|
265
230
|
}
|
|
266
|
-
|
|
231
|
+
lines.push(text.slice(start, start + (spaceIndex || splitAt)));
|
|
232
|
+
start += spaceIndex ? spaceIndex + 1 : splitAt;
|
|
267
233
|
}
|
|
268
|
-
return split([], text);
|
|
269
234
|
}
|
|
270
235
|
/**
|
|
271
236
|
* Get max width for splitting canvas x axis tick text.
|
|
@@ -448,32 +413,6 @@ function getYPosition($$, value, axis = "y") {
|
|
|
448
413
|
return $$.scale[axis || "y"](normalizeYValue($$, value, axis));
|
|
449
414
|
}
|
|
450
415
|
/**
|
|
451
|
-
* Get a text position along a grid line.
|
|
452
|
-
* @param {string} position Grid label position
|
|
453
|
-
* @param {number} start Start coordinate
|
|
454
|
-
* @param {number} end End coordinate
|
|
455
|
-
* @returns {number} Label coordinate
|
|
456
|
-
* @private
|
|
457
|
-
*/
|
|
458
|
-
function getLineTextPosition(position, start, end) {
|
|
459
|
-
if (position === "start") return start + 4;
|
|
460
|
-
if (position === "middle") return (start + end) / 2;
|
|
461
|
-
return end - 4;
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Get a text position for labels drawn with SVG-compatible rotate(-90).
|
|
465
|
-
* @param {string} position Grid label position
|
|
466
|
-
* @param {number} start Start coordinate
|
|
467
|
-
* @param {number} end End coordinate
|
|
468
|
-
* @returns {number} Label coordinate
|
|
469
|
-
* @private
|
|
470
|
-
*/
|
|
471
|
-
function getRotatedLineTextPosition(position, start, end) {
|
|
472
|
-
if (position === "start") return end - 4;
|
|
473
|
-
if (position === "middle") return (start + end) / 2;
|
|
474
|
-
return start + 4;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
416
|
* Get global region rectangle.
|
|
478
417
|
* @param {object} $$ ChartInternal context
|
|
479
418
|
* @param {object} region Region option
|
|
@@ -561,7 +500,7 @@ var CanvasAxisRenderer = class {
|
|
|
561
500
|
*/
|
|
562
501
|
draw($$) {
|
|
563
502
|
this.drawRegions($$);
|
|
564
|
-
|
|
503
|
+
$$.getCanvasFeature?.("grid")?.draw?.call($$, this);
|
|
565
504
|
this.drawAxis($$);
|
|
566
505
|
}
|
|
567
506
|
/**
|
|
@@ -578,130 +517,6 @@ var CanvasAxisRenderer = class {
|
|
|
578
517
|
this.drawAxisLabels($$);
|
|
579
518
|
}
|
|
580
519
|
/**
|
|
581
|
-
* Draw the canvas subchart x axis.
|
|
582
|
-
* @param {object} $$ ChartInternal instance
|
|
583
|
-
* @private
|
|
584
|
-
*/
|
|
585
|
-
drawSubXAxis($$) {
|
|
586
|
-
const { ctx, painter, theme: { style: { axis } } } = this;
|
|
587
|
-
const { config, format, scale, state: { current, margin2, width2, height2 } } = $$;
|
|
588
|
-
if (!config.subchart_show || !config.subchart_axis_x_show || !scale.subX || width2 <= 0 || height2 <= 0) return;
|
|
589
|
-
const isRotated = config.axis_rotated;
|
|
590
|
-
const x = painter.crisp(margin2.left, axis.lineWidth);
|
|
591
|
-
const y = painter.crisp(margin2.top + height2, axis.lineWidth);
|
|
592
|
-
const x1 = margin2.left;
|
|
593
|
-
const x2 = margin2.left + width2;
|
|
594
|
-
const y1 = margin2.top;
|
|
595
|
-
const y2 = margin2.top + height2;
|
|
596
|
-
const rangeStart = isRotated ? y1 : x1;
|
|
597
|
-
const rangeEnd = isRotated ? y2 : x2;
|
|
598
|
-
const ticks = getSubXTickValues($$);
|
|
599
|
-
const lineTicks = getSubXTickLineValues($$, ticks, axis.tickWidth);
|
|
600
|
-
const outerTick = config.subchart_axis_x_tick_outer ?? config.axis_x_tick_outer;
|
|
601
|
-
const tickDirection = isRotated ? config.axis_x_tick_inner ? 1 : -1 : config.axis_x_tick_inner ? -1 : 1;
|
|
602
|
-
const outerTickDirection = getXOuterTickDirection(isRotated);
|
|
603
|
-
const tickTextDirection = getXTickTextDirection(isRotated);
|
|
604
|
-
const tickTextPosition = config.axis_x_tick_text_position;
|
|
605
|
-
const tickRotate = !isRotated ? $$.getAxisTickRotate?.("x") || 0 : 0;
|
|
606
|
-
const tickFormat = format.subXAxisTick || $$.axis?.getXAxisTickFormat?.(true);
|
|
607
|
-
painter.clipRect(isRotated ? getRotatedXAxisClipRect(margin2, current.width, height2) : {
|
|
608
|
-
...getHorizontalXAxisClipRect(margin2, width2, current.height - margin2.top),
|
|
609
|
-
y: margin2.top
|
|
610
|
-
}, () => {
|
|
611
|
-
ctx.globalAlpha = 1;
|
|
612
|
-
ctx.strokeStyle = axis.lineColor;
|
|
613
|
-
ctx.lineWidth = axis.lineWidth;
|
|
614
|
-
ctx.setLineDash([]);
|
|
615
|
-
painter.strokePath(() => {
|
|
616
|
-
if (isRotated) painter.traceLine(x, y1, x, y2);
|
|
617
|
-
else painter.traceLine(x1, y, x2, y);
|
|
618
|
-
if (outerTick) {
|
|
619
|
-
if (isRotated) {
|
|
620
|
-
painter.traceLine(x, y1, x + 6 * outerTickDirection, y1);
|
|
621
|
-
painter.traceLine(x, y2, x + 6 * outerTickDirection, y2);
|
|
622
|
-
} else {
|
|
623
|
-
painter.traceLine(x1, y, x1, y + 6 * outerTickDirection);
|
|
624
|
-
painter.traceLine(x2, y, x2, y + 6 * outerTickDirection);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
});
|
|
628
|
-
const tickFont = getAxisTickFont(axis, "x");
|
|
629
|
-
ctx.font = tickFont;
|
|
630
|
-
ctx.fillStyle = axis.labelColor;
|
|
631
|
-
ctx.textAlign = isRotated ? tickTextDirection > 0 ? "left" : "right" : "center";
|
|
632
|
-
ctx.textBaseline = isRotated ? "middle" : tickTextDirection > 0 ? "top" : "bottom";
|
|
633
|
-
ctx.strokeStyle = axis.tickColor;
|
|
634
|
-
ctx.lineWidth = axis.tickWidth;
|
|
635
|
-
const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
|
|
636
|
-
const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, scale.subX);
|
|
637
|
-
if (config.subchart_axis_x_tick_show) for (const tick of lineTicks) {
|
|
638
|
-
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
639
|
-
const tx = margin2.left + tickPos;
|
|
640
|
-
const ty = margin2.top + tickPos;
|
|
641
|
-
if (!isInAxisRange(isRotated ? ty : tx, rangeStart, rangeEnd)) continue;
|
|
642
|
-
painter.strokePath(() => {
|
|
643
|
-
if (isRotated) painter.traceLine(x, ty, x + 6 * tickDirection, ty);
|
|
644
|
-
else painter.traceLine(tx, y, tx, y + 6 * tickDirection);
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
for (const tick of ticks) {
|
|
648
|
-
const tickPos = scale.subX(normalizeXValue($$, tick));
|
|
649
|
-
const tx = margin2.left + tickPos;
|
|
650
|
-
const ty = margin2.top + tickPos;
|
|
651
|
-
if (!isInAxisRange(isRotated ? ty : tx, rangeStart, rangeEnd)) continue;
|
|
652
|
-
if (!config.subchart_axis_x_tick_text_show) continue;
|
|
653
|
-
const lines = getXTickTextLines($$, painter, tickFormat, tick, ticks, isRotated, scale.subX, tickTextWidth);
|
|
654
|
-
let textX;
|
|
655
|
-
let textY;
|
|
656
|
-
if (isRotated) {
|
|
657
|
-
textX = x + 9 * tickTextDirection + (tickTextPosition.x || 0);
|
|
658
|
-
textY = ty + (tickTextPosition.y || 0);
|
|
659
|
-
ctx.textAlign = tickTextDirection > 0 ? "left" : "right";
|
|
660
|
-
ctx.textBaseline = "middle";
|
|
661
|
-
} else {
|
|
662
|
-
textX = tx + (tickTextPosition.x || 0);
|
|
663
|
-
textY = y + 9 * tickTextDirection + (tickTextPosition.y || 0);
|
|
664
|
-
ctx.textAlign = tickRotate ? tickRotate > 0 ? "left" : "right" : "center";
|
|
665
|
-
ctx.textBaseline = tickTextDirection > 0 ? "top" : "bottom";
|
|
666
|
-
}
|
|
667
|
-
painter.withState((textCtx) => {
|
|
668
|
-
textCtx.translate(textX, textY);
|
|
669
|
-
tickRotate && textCtx.rotate(tickRotate * Math.PI / 180);
|
|
670
|
-
lines.forEach((line, i) => {
|
|
671
|
-
textCtx.fillText(line, 0, i * lineHeight);
|
|
672
|
-
});
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
});
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Draw the canvas subchart y/y2 axes.
|
|
679
|
-
* @param {object} $$ ChartInternal instance
|
|
680
|
-
* @private
|
|
681
|
-
*/
|
|
682
|
-
drawSubYAxes($$) {
|
|
683
|
-
const { config, scale, state: { margin2, width2, height2 } } = $$;
|
|
684
|
-
if (!config.subchart_show || width2 <= 0 || height2 <= 0) return;
|
|
685
|
-
["y", "y2"].forEach((id) => {
|
|
686
|
-
const subScale = id === "y2" ? scale.subY2 : scale.subY;
|
|
687
|
-
if (!config[`subchart_axis_${id}_show`] || !subScale) return;
|
|
688
|
-
this.drawYAxis($$, id, {
|
|
689
|
-
scale: subScale,
|
|
690
|
-
ticks: getYTickValues($$, id, void 0, true, subScale, `subchart_axis_${id}`),
|
|
691
|
-
format: getSubYTickFormat($$, id),
|
|
692
|
-
index: 0,
|
|
693
|
-
outerTick: config[`subchart_axis_${id}_tick_outer`] ?? config[`axis_${id}_tick_outer`],
|
|
694
|
-
margin: margin2,
|
|
695
|
-
width: width2,
|
|
696
|
-
height: height2,
|
|
697
|
-
prefix: `subchart_axis_${id}`,
|
|
698
|
-
tickShow: config[`subchart_axis_${id}_tick_show`],
|
|
699
|
-
tickTextShow: config[`subchart_axis_${id}_tick_text_show`],
|
|
700
|
-
tickTextPosition: config[`axis_${id}_tick_text_position`]
|
|
701
|
-
});
|
|
702
|
-
});
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
520
|
* Draw chart title.
|
|
706
521
|
* @param {object} $$ ChartInternal instance
|
|
707
522
|
* @private
|
|
@@ -767,44 +582,6 @@ var CanvasAxisRenderer = class {
|
|
|
767
582
|
});
|
|
768
583
|
}
|
|
769
584
|
/**
|
|
770
|
-
* Draw visible grid lines.
|
|
771
|
-
* @param {object} $$ ChartInternal instance
|
|
772
|
-
* @private
|
|
773
|
-
*/
|
|
774
|
-
drawGrid($$) {
|
|
775
|
-
const { ctx, painter, theme: { style: { grid } } } = this;
|
|
776
|
-
const { config, scale, state: { height, margin, width } } = $$;
|
|
777
|
-
if (!grid.lineColor) return;
|
|
778
|
-
const isRotated = config.axis_rotated;
|
|
779
|
-
const x1 = margin.left;
|
|
780
|
-
const x2 = margin.left + width;
|
|
781
|
-
const y1 = margin.top;
|
|
782
|
-
const y2 = margin.top + height;
|
|
783
|
-
painter.withState(() => {
|
|
784
|
-
ctx.strokeStyle = grid.lineColor;
|
|
785
|
-
ctx.lineWidth = grid.lineWidth;
|
|
786
|
-
grid.dashArray.length && ctx.setLineDash(grid.dashArray);
|
|
787
|
-
if (config.grid_x_show && scale.x) painter.strokePath(() => {
|
|
788
|
-
for (const tick of getXTickValues($$)) {
|
|
789
|
-
const pos = getXPosition($$, tick);
|
|
790
|
-
if (!isDrawable(pos)) continue;
|
|
791
|
-
if (isRotated) painter.traceCrispLine(x1, margin.top + pos, x2, margin.top + pos, grid.lineWidth);
|
|
792
|
-
else painter.traceCrispLine(margin.left + pos, y1, margin.left + pos, y2, grid.lineWidth);
|
|
793
|
-
}
|
|
794
|
-
});
|
|
795
|
-
if (config.grid_y_show && scale.y) painter.strokePath(() => {
|
|
796
|
-
for (const tick of getYGridTickValues($$)) {
|
|
797
|
-
const value = normalizeYValue($$, tick);
|
|
798
|
-
const pos = scale.y(value);
|
|
799
|
-
if (!isDrawable(pos)) continue;
|
|
800
|
-
if (isRotated) painter.traceCrispLine(margin.left + pos, y1, margin.left + pos, y2, grid.lineWidth);
|
|
801
|
-
else painter.traceCrispLine(x1, margin.top + pos, x2, margin.top + pos, grid.lineWidth);
|
|
802
|
-
}
|
|
803
|
-
});
|
|
804
|
-
!config.grid_lines_front && this.drawGridLines($$);
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
585
|
* Draw configured global regions.
|
|
809
586
|
* @param {object} $$ ChartInternal instance
|
|
810
587
|
* @private
|
|
@@ -857,85 +634,6 @@ var CanvasAxisRenderer = class {
|
|
|
857
634
|
});
|
|
858
635
|
}
|
|
859
636
|
/**
|
|
860
|
-
* Draw configured x/y grid lines and labels.
|
|
861
|
-
* @param {object} $$ ChartInternal instance
|
|
862
|
-
* @private
|
|
863
|
-
*/
|
|
864
|
-
drawGridLines($$) {
|
|
865
|
-
const { ctx, painter, theme: { style: { axis, grid } } } = this;
|
|
866
|
-
const { config, scale, state: { height, margin, width } } = $$;
|
|
867
|
-
const isRotated = config.axis_rotated;
|
|
868
|
-
const x1 = margin.left;
|
|
869
|
-
const x2 = margin.left + width;
|
|
870
|
-
const y1 = margin.top;
|
|
871
|
-
const y2 = margin.top + height;
|
|
872
|
-
if (!grid.lineColor) return;
|
|
873
|
-
painter.withState(() => {
|
|
874
|
-
ctx.strokeStyle = grid.lineColor;
|
|
875
|
-
ctx.lineWidth = grid.lineWidth;
|
|
876
|
-
ctx.font = grid.labelFont || axis.labelFont;
|
|
877
|
-
ctx.fillStyle = grid.labelColor;
|
|
878
|
-
ctx.textBaseline = "middle";
|
|
879
|
-
ctx.setLineDash([]);
|
|
880
|
-
const drawLabel = (text, x, y, rotated = false, style) => {
|
|
881
|
-
if (!text) return;
|
|
882
|
-
painter.text(text, x, y, {
|
|
883
|
-
...style,
|
|
884
|
-
angle: rotated ? -90 : 0
|
|
885
|
-
});
|
|
886
|
-
};
|
|
887
|
-
const drawLine = (line, axisId, draw) => {
|
|
888
|
-
const style = getGridLineCanvasStyle(this.theme.getGridLineStyle(axisId, line, "line"));
|
|
889
|
-
painter.strokePath(draw, style);
|
|
890
|
-
};
|
|
891
|
-
const getTextStyle = (axisId, line) => getGridTextCanvasStyle(this.theme.getGridLineStyle(axisId, line, "text"));
|
|
892
|
-
const drawXLine = (line) => {
|
|
893
|
-
if (line.value === void 0 || !scale.x) return;
|
|
894
|
-
const pos = getXPosition($$, line.value);
|
|
895
|
-
if (!isDrawable(pos)) return;
|
|
896
|
-
if (isRotated) {
|
|
897
|
-
const y = margin.top + pos;
|
|
898
|
-
drawLine(line, "x", () => {
|
|
899
|
-
painter.traceLine(x1, y, x2, y);
|
|
900
|
-
});
|
|
901
|
-
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
902
|
-
drawLabel(line.text, getLineTextPosition(line.position, x1, x2), y - 5, false, getTextStyle("x", line));
|
|
903
|
-
} else {
|
|
904
|
-
const x = margin.left + pos;
|
|
905
|
-
drawLine(line, "x", () => {
|
|
906
|
-
painter.traceLine(x, y1, x, y2);
|
|
907
|
-
});
|
|
908
|
-
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
909
|
-
drawLabel(line.text, x - 5, getRotatedLineTextPosition(line.position, y1, y2), true, getTextStyle("x", line));
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
const drawYLine = (line) => {
|
|
913
|
-
const targetScale = line.axis === "y2" ? scale.y2 : scale.y;
|
|
914
|
-
const axisId = line.axis === "y2" ? "y2" : "y";
|
|
915
|
-
if (line.value === void 0 || !targetScale) return;
|
|
916
|
-
const pos = targetScale(normalizeYValue($$, line.value, axisId));
|
|
917
|
-
if (!isDrawable(pos)) return;
|
|
918
|
-
if (isRotated) {
|
|
919
|
-
const x = margin.left + pos;
|
|
920
|
-
drawLine(line, "y", () => {
|
|
921
|
-
painter.traceLine(x, y1, x, y2);
|
|
922
|
-
});
|
|
923
|
-
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
924
|
-
drawLabel(line.text, x - 5, getRotatedLineTextPosition(line.position, y1, y2), true, getTextStyle("y", line));
|
|
925
|
-
} else {
|
|
926
|
-
const y = margin.top + pos;
|
|
927
|
-
drawLine(line, "y", () => {
|
|
928
|
-
painter.traceLine(x1, y, x2, y);
|
|
929
|
-
});
|
|
930
|
-
ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
|
|
931
|
-
drawLabel(line.text, getLineTextPosition(line.position, x1, x2), y - 5, false, getTextStyle("y", line));
|
|
932
|
-
}
|
|
933
|
-
};
|
|
934
|
-
(config.grid_x_lines || []).forEach(drawXLine);
|
|
935
|
-
(config.grid_y_lines || []).forEach(drawYLine);
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
/**
|
|
939
637
|
* Draw axes configured with axis.x/y/y2.axes.
|
|
940
638
|
* @param {object} $$ ChartInternal instance
|
|
941
639
|
* @private
|
|
@@ -1173,9 +871,9 @@ var CanvasAxisRenderer = class {
|
|
|
1173
871
|
let textY;
|
|
1174
872
|
if (isRotated) {
|
|
1175
873
|
textX = x + 9 * tickTextDirection + (tickTextPosition.x || 0);
|
|
1176
|
-
textY = ty + (tickTextPosition.y || 0);
|
|
874
|
+
textY = ty + (tickTextPosition.y || 0) + 3 - (lines.length - 1) * lineHeight / 2;
|
|
1177
875
|
ctx.textAlign = getXTickTextAlign($$, options);
|
|
1178
|
-
ctx.textBaseline = "
|
|
876
|
+
ctx.textBaseline = "alphabetic";
|
|
1179
877
|
} else if (tickRotate) {
|
|
1180
878
|
const fontSize = getFontSize(tickFont);
|
|
1181
879
|
const firstDy = tickTextPosition.y ? resolveTextOffset(tickTextPosition.y, fontSize) : .71 * fontSize;
|
|
@@ -1282,10 +980,12 @@ var CanvasAxisRenderer = class {
|
|
|
1282
980
|
for (const { tx, ty } of drawableLineTicks) if (isRotated) painter.traceLine(tx, y, tx, y + 6 * tickDirection);
|
|
1283
981
|
else painter.traceLine(x, ty, x + 6 * tickDirection, ty);
|
|
1284
982
|
});
|
|
1285
|
-
if (tickTextShow) for (const { tick, tx, ty } of drawableTicks) if (isRotated
|
|
983
|
+
if (tickTextShow) for (const { tick, tx, ty } of drawableTicks) if (isRotated && tickTextDirection > 0) {
|
|
984
|
+
ctx.textBaseline = "alphabetic";
|
|
985
|
+
painter.text(formatTick(format, tick), tx + (tickTextPosition.x || 0), y + 9 * tickTextDirection + (tickTextPosition.y ? resolveTextOffset(tickTextPosition.y, getFontSize(tickFont)) : .71 * getFontSize(tickFont)));
|
|
986
|
+
} else if (isRotated) painter.text(formatTick(format, tick), tx + (tickTextPosition.x || 0), y + 6 * tickTextDirection + (tickTextPosition.y || 0));
|
|
1286
987
|
else painter.text(formatTick(format, tick), x + 9 * tickTextDirection + (tickTextPosition.x || 0), ty + (tickTextPosition.y || 0));
|
|
1287
988
|
});
|
|
1288
989
|
}
|
|
1289
990
|
};
|
|
1290
|
-
|
|
1291
|
-
export { CanvasAxisRenderer as default };
|
|
991
|
+
export { CanvasAxisRenderer as default, getAxisTickFont, getHorizontalXAxisClipRect, getRotatedXAxisClipRect, getXOuterTickDirection, getXPosition, getXTickTextDirection, getXTickTextLineHeight, getXTickTextLines, getXTickTextWidth, isDrawable, isInAxisRange };
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
import { document as doc, window as win } from "../module/browser.js";
|
|
11
11
|
import { $CANVAS } from "./classes.js";
|
|
12
|
-
|
|
12
|
+
// src/canvas/CanvasEngine.ts
|
|
13
13
|
/**
|
|
14
14
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
15
15
|
* billboard.js project is licensed under the MIT license
|
|
@@ -155,5 +155,4 @@ var CanvasEngine = class {
|
|
|
155
155
|
this.frameValid = false;
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
//#endregion
|
|
159
158
|
export { CanvasEngine as default };
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.1
|
|
8
|
+
* @version 4.2.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
import { getFontSize } from "./util.js";
|
|
11
|
-
|
|
11
|
+
// src/canvas/CanvasPainter.ts
|
|
12
12
|
/**
|
|
13
13
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
14
14
|
* billboard.js project is licensed under the MIT license
|
|
@@ -402,5 +402,4 @@ var CanvasPainter = class {
|
|
|
402
402
|
return lineWidth % 2 ? Math.round(value) + .5 : Math.round(value);
|
|
403
403
|
}
|
|
404
404
|
};
|
|
405
|
-
//#endregion
|
|
406
405
|
export { CanvasPainter as default };
|