@flourish/chart-layout
Advanced tools
Comparing version 9.0.0 to 9.1.0
{ | ||
"name": "@flourish/chart-layout", | ||
"version": "9.0.0", | ||
"version": "9.1.0", | ||
"description": "Create axes", | ||
@@ -5,0 +5,0 @@ "main": "chart-layout.js", |
@@ -235,2 +235,4 @@ # Flourish chart layout | ||
### `chart_layout.xFlipAxis([value])` | ||
If `value` is specified, sets whether the x axis should be flipped (after converting `value` to a Boolean) so it runs from right to left rather than left to right. | ||
### `chart_layout.xFormat([func])` | ||
@@ -262,2 +264,5 @@ If `func` is specified, sets the formatting function to be applied to the tick formats on the x axis. The `func` function is called for every tick on the axis on `update` with the ticks own value as the only argument. The value returned is then used as the printed tick label. If `chart_layout.xFormat` is never called with a `func` or `func` is falsy (but not undefined) the default formatting function, `function(value) { return "" + value; }`, is used. | ||
### `chart_layout.yFlipAxis([value])` | ||
If `value` is specified, sets whether the y axis should be flipped (after converting `value` to a Boolean) so it runs from top to bottom rather than bottom to top. | ||
### `chart_layout.yFormat([func])` | ||
@@ -289,2 +294,5 @@ If `func` is specified, sets the formatting function to be applied to the tick formats on the primary y axis. The `func` function is called for every tick on the axis on `update` with the ticks own value as the only argument. The value returned is then used as the printed tick label. If `chart_layout.yFormat` is never called with a `func` or `func` is falsy (but not undefined) the default formatting function, `function(value) { return "" + value; }`, is used. | ||
### `chart_layout.yF2lipAxis([value])` | ||
If `value` is specified, sets whether the y2 axis should be flipped (after converting `value` to a Boolean) so it runs from top to bottom rather than bottom to top. | ||
### `chart_layout.y2Format([func])` | ||
@@ -291,0 +299,0 @@ If `func` is specified, sets the formatting function to be applied to the tick formats on the secondary y axis. The `func` function is called for every tick on the axis on `update` with the ticks own value as the only argument. The value returned is then used as the printed tick label. If `chart_layout.y2Format` is never called with a `func` or `func` is falsy (but not undefined) the default formatting function, `function(value) { return "" + value; }`, is used. |
@@ -0,1 +1,4 @@ | ||
# 9.1.0 | ||
* Add *FlipAxis methods | ||
# 9.0.0 | ||
@@ -2,0 +5,0 @@ * Add settings to flip axes (Treating as a breaking change, as flipping the axes could end up with odd results in some templates, so needs careful testing) |
@@ -25,2 +25,3 @@ import { prepareState } from "./state"; | ||
initY2Scale, | ||
initFlipAxis, | ||
initZeroAxis, | ||
@@ -101,2 +102,5 @@ initXMinStep, | ||
instance.y2MinStep = initY2MinStep(instance); | ||
instance.xFlipAxis = initFlipAxis(instance); | ||
instance.yFlipAxis = initFlipAxis(instance); | ||
instance.y2FlipAxis = initFlipAxis(instance); | ||
instance.xZeroAxis = initZeroAxis(instance); | ||
@@ -103,0 +107,0 @@ instance.yZeroAxis = initZeroAxis(instance); |
@@ -11,2 +11,13 @@ function initZeroAxis(instance) { | ||
export { initZeroAxis }; | ||
function initFlipAxis(instance) { | ||
let flip = false; | ||
return function(value) { | ||
if (value === undefined) return flip; | ||
flip = !!value; | ||
return instance; | ||
}; | ||
} | ||
export { initFlipAxis, initZeroAxis }; |
export { initXScale, initXMinStep, initXPadding } from "./x"; | ||
export { initYScale, initYMinStep, initYPadding } from "./y"; | ||
export { initY2Scale, initY2MinStep, initY2Padding } from "./y2"; | ||
export { initZeroAxis } from "./common"; | ||
export { initFlipAxis, initZeroAxis } from "./common"; |
@@ -58,3 +58,3 @@ import { getPointScale, getLinearScale, getLogScale, getDatetimeScale } from "./scales"; | ||
const x_data = instance.xData(); | ||
const settings = { nice: x.nice }; | ||
const settings = { nice: x.nice, flip: instance.xFlipAxis() !== x.flip }; | ||
let getScale; | ||
@@ -64,3 +64,2 @@ if (x_data.string_array) { | ||
settings.edge_padding = x.edge_padding; | ||
settings.flip = x.flip; | ||
} | ||
@@ -71,3 +70,2 @@ else if (x_data.datetime_array) { | ||
settings.max = x.datetime_max; | ||
settings.flip = x.flip; | ||
settings.format = instance.xDatetimeParse(); | ||
@@ -79,3 +77,2 @@ } | ||
settings.max = x.log_max; | ||
settings.flip = x.flip; | ||
} | ||
@@ -86,3 +83,2 @@ else { | ||
settings.max = x.linear_max; | ||
settings.flip = x.flip; | ||
settings.include_zero = x.zero_axis === "off" ? false : (x.zero_axis === "on" ? true : instance.xZeroAxis()); | ||
@@ -89,0 +85,0 @@ } |
@@ -59,3 +59,3 @@ import { getPointScale, getLinearScale, getLogScale, getDatetimeScale } from "./scales"; | ||
const settings = { nice: y.nice }; | ||
const settings = { nice: y.nice, flip: instance.yFlipAxis() !== y.flip }; | ||
let getScale; | ||
@@ -65,3 +65,2 @@ if (y_data.string_array) { | ||
settings.edge_padding = y.edge_padding; | ||
settings.flip = y.flip; | ||
} | ||
@@ -72,3 +71,2 @@ else if (y_data.datetime_array) { | ||
settings.max = y.datetime_max; | ||
settings.flip = y.flip; | ||
settings.format = instance.yDatetimeParse(); | ||
@@ -80,3 +78,2 @@ } | ||
settings.max = y.log_max; | ||
settings.flip = y.flip; | ||
} | ||
@@ -87,3 +84,2 @@ else { | ||
settings.max = y.linear_max; | ||
settings.flip = y.flip; | ||
settings.include_zero = y.zero_axis === "off" ? false : (y.zero_axis === "on" ? true : instance.yZeroAxis()); | ||
@@ -90,0 +86,0 @@ } |
@@ -59,3 +59,3 @@ import { getPointScale, getLinearScale, getLogScale, getDatetimeScale } from "./scales"; | ||
const settings = { nice: y2.nice }; | ||
const settings = { nice: y2.nice, flip: instance.y2FlipAxis() !== y2.flip }; | ||
let getScale; | ||
@@ -65,3 +65,2 @@ if (y2_data.string_array) { | ||
settings.edge_padding = y2.edge_padding; | ||
settings.flip = y2.flip; | ||
} | ||
@@ -72,3 +71,2 @@ else if (y2_data.datetime_array) { | ||
settings.max = y2.datetime_max; | ||
settings.flip = y2.flip; | ||
settings.format = instance.y2DatetimeParse(); | ||
@@ -80,3 +78,2 @@ } | ||
settings.max = y2.log_max; | ||
settings.flip = y2.flip; | ||
} | ||
@@ -87,3 +84,2 @@ else { | ||
settings.max = y2.linear_max; | ||
settings.flip = y2.flip; | ||
settings.include_zero = y2.zero_axis === "off" ? false : (y2.zero_axis === "on" ? true : instance.y2ZeroAxis()); | ||
@@ -90,0 +86,0 @@ } |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
415546
309
10162