Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flourish/chart-layout

Package Overview
Dependencies
Maintainers
10
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flourish/chart-layout - npm Package Compare versions

Comparing version 1.0.0-prerelease.6 to 1.0.0-prerelease.7

src/format/index.js

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc