@flourish/chart-layout
Advanced tools
Comparing version 1.0.0-prerelease.6 to 1.0.0-prerelease.7
{ | ||
"name": "@flourish/chart-layout", | ||
"version": "1.0.0-prerelease.6", | ||
"version": "1.0.0-prerelease.7", | ||
"description": "Create axes", | ||
@@ -5,0 +5,0 @@ "main": "chart-layout.js", |
@@ -109,2 +109,5 @@ # Flourish chart layout | ||
### `chart_layout.xFormat([func])` | ||
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 x 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.xOffset([value])` | ||
@@ -114,4 +117,7 @@ | ||
### `chart_layout.yFormat([func])` | ||
If `func` is specified, sets the formatting function to be applied to the tick formats on the y axis. The `func` function is called for every tick on the y 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.yOffset([value])` | ||
If `value` is specified, sets the vertical transform applied to the whole `chart_layout` instance (defaults to 0). |
@@ -7,2 +7,3 @@ import { prepareState } from "./state"; | ||
import { initAnimationDuration } from "./animation"; | ||
import { initFormat } from "./format"; | ||
import { initHeight, initWidth, initXOffset, initYOffset } from "./dimensions"; | ||
@@ -29,2 +30,4 @@ import { initData } from "./data"; | ||
instance.height = initHeight(instance); | ||
instance.xFormat = initFormat(instance); | ||
instance.yFormat = initFormat(instance); | ||
instance.xOffset = initXOffset(instance); | ||
@@ -31,0 +34,0 @@ instance.yOffset = initYOffset(instance); |
@@ -19,2 +19,3 @@ import { select } from "d3-selection"; | ||
var max_box_height = 0; | ||
var format = instance.xFormat(); | ||
@@ -26,3 +27,4 @@ var text_selection = group.append("text") | ||
ticks = tick_array.map(function(value, index) { | ||
text_selection.text(value); | ||
var text = format(value); | ||
text_selection.text(text); | ||
var bounds = text_selection.node().getBoundingClientRect(); | ||
@@ -62,2 +64,3 @@ var text_width = bounds.width; | ||
value: value, | ||
text: text, | ||
significant_digits: significant_digits, | ||
@@ -101,2 +104,3 @@ exponent: exponent, | ||
var max_box_width = 0; | ||
var format = instance.yFormat(); | ||
@@ -108,3 +112,4 @@ var text_selection = group.append("text") | ||
ticks = tick_array.map(function(value, index) { | ||
text_selection.text(value); | ||
var text = format(value); | ||
text_selection.text(text); | ||
var bounds = text_selection.node().getBoundingClientRect(); | ||
@@ -144,2 +149,3 @@ var text_width = bounds.width; | ||
value: value, | ||
text: text, | ||
type: type, | ||
@@ -146,0 +152,0 @@ significant_digits: significant_digits, |
@@ -114,3 +114,3 @@ import { select } from "d3-selection"; | ||
sel.select("text") | ||
.text(function(d) { return d.value; }) | ||
.text(function(d) { return d.text; }) | ||
.style("fill", tick_label_color) | ||
@@ -180,3 +180,3 @@ .style("font-size", tick_label_size) | ||
sel.select("text") | ||
.text(function(d) { return d.value; }) | ||
.text(function(d) { return d.text; }) | ||
.attr("text-anchor", "end") | ||
@@ -183,0 +183,0 @@ .style("fill", tick_label_color) |
@@ -113,3 +113,3 @@ import { select } from "d3-selection"; | ||
sel.select("text") | ||
.text(function(d) { return d.value; }) | ||
.text(function(d) { return d.text; }) | ||
.style("fill", tick_label_color) | ||
@@ -179,3 +179,3 @@ .style("font-size", tick_label_size) | ||
sel.select("text") | ||
.text(function(d) { return d.value; }) | ||
.text(function(d) { return d.text; }) | ||
.attr("text-anchor", "end") | ||
@@ -230,2 +230,3 @@ .style("fill", tick_label_color) | ||
export { initYAxisUpdating }; |
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
246770
33
6748
122