New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@flourish/chart-layout

Package Overview
Dependencies
Maintainers
12
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 4.0.0 to 5.0.0

2

package.json
{
"name": "@flourish/chart-layout",
"version": "4.0.0",
"version": "5.0.0",
"description": "Create axes",

@@ -5,0 +5,0 @@ "main": "chart-layout.js",

@@ -244,3 +244,3 @@ # Flourish chart layout

### `chart_layout.y2Hide([value])`
If `value` is specified then sets whether or not the y2 axis should be hidden. By default this means the tick marks, labels, axis title and gridlines will not be drawn and no space will be left for them. The `y2Scale` and `y2Ticks` methods will still function as if the axis was visible (assuming it hasn't been switched off through settings). If `value` is an object with a `keep_gridlines` property that is truthy the tick marks, labels and axis title will not be drawn but gridlines will be (assuming they aren't switched off through settings).
If `value` is specified then sets whether or not the y2 axis should be hidden. By default this means the tick marks, labels, axis title and gridlines will not be drawn and no space will be left for them. The `y2Scale` and `y2Ticks` methods will still function as if the axis was visible (assuming it hasn't been switched off through settings). If `value` is an object with a `keep_gridlines` property that is truthy the tick marks, labels and axis title will not be drawn but gridlines will be (assuming they aren't switched off through settings). Unlike for the `xHide` and `yHide` methods above, the default value for this method is `true`: you must explicitly turn the y2 axis on.

@@ -247,0 +247,0 @@ ### `chart_layout.y2NumberParse([func])`

@@ -0,1 +1,8 @@

# 5.0.0
* Hide y2 axis bby default
* Don't throw error if `Data` function is passed values of unacceptable type
* Fix hiding of repeated datetime labels
* Allow user to change distance to first/last tick on categorical axis
* Tweak yml for gridlines
# 4.0.0

@@ -2,0 +9,0 @@ * Add support for custom ticks

@@ -129,4 +129,9 @@ var remToPx;

function isDate(entity) {
return Object.prototype.toString.call(entity) === "[object Date]";
}
function isValidDate(entity) {
return Object.prototype.toString.call(entity) === "[object Date]" && !isNaN(entity.getTime());
return isDate(entity) && !isNaN(entity.getTime());
}

@@ -152,4 +157,5 @@

safeScale,
isDate,
isValidDate,
textareaToArray
};
import { createNumericArray, createStringArray, createDatetimeArray } from "@flourish/enhanced-arrays";
import { isDate } from "../common";

@@ -10,8 +11,14 @@ var ERROR_MESSAGE = "Input data must be an array or Flourish array";

if (!Array.isArray(input_data)) throw new TypeError(ERROR_MESSAGE);
var acc = accessor || function(x) { return x; };
var type = input_data.length ? typeof acc(input_data[0]) : "number";
if (type === "number") return createNumericArray(input_data, accessor);
else if (type === "string") return createStringArray(input_data, accessor);
else if (type === "object") return createDatetimeArray(input_data, accessor);
throw new TypeError("Unsupported variable type");
for (var i = 0; i < input_data.length; i++) {
var value = acc(input_data[i]);
var type = typeof value;
if (type === "number") return createNumericArray(input_data, accessor);
if (type === "string") return createStringArray(input_data, accessor);
if (isDate(value)) return createDatetimeArray(input_data, accessor);
}
return createNumericArray(input_data, accessor);
}

@@ -22,2 +29,3 @@

var current_data = getFrozenData([]);
return function(data, accessor) {

@@ -24,0 +32,0 @@ if (data === undefined) return current_data;

@@ -73,2 +73,3 @@ import { prepareState } from "./state";

instance.y2Hide = initHide(instance);
instance.y2Hide(true);

@@ -75,0 +76,0 @@ instance.update = initUpdate(instance, state);

@@ -6,4 +6,4 @@ import { scaleLinear, scaleLog, scalePoint, scaleTime } from "d3-scale";

function getPointScale(data) {
var scale = scalePoint().domain(data.unique()).padding(0.5);
function getPointScale(data, edge_padding) {
var scale = scalePoint().domain(data.unique()).padding(edge_padding/100);
scale.type = "ordinal";

@@ -112,3 +112,3 @@ return scale;

var x_data = instance.xData();
if (x_data.string_array) xScale = getPointScale(x_data);
if (x_data.string_array) xScale = getPointScale(x_data, state.x.edge_padding);
else if (x_data.datetime_array) {

@@ -140,3 +140,3 @@ xScale = getDatetimeScale(x_data, state.x.datetime_min, state.x.datetime_max, instance.xDatetimeParse());

var y_data = instance.yData();
if (y_data.string_array) yScale = getPointScale(y_data);
if (y_data.string_array) yScale = getPointScale(y_data, y.edge_padding);
else if (y_data.datetime_array) {

@@ -168,3 +168,3 @@ yScale = getDatetimeScale(y_data, y.datetime_min, y.datetime_max, instance.yDatetimeParse());

var y_data = instance.y2Data();
if (y_data.string_array) yScale = getPointScale(y_data);
if (y_data.string_array) yScale = getPointScale(y_data, y.edge_padding);
else if (y_data.datetime_array) {

@@ -171,0 +171,0 @@ yScale = getDatetimeScale(y_data, y.datetime_min, y.datetime_max, instance.y2DatetimeParse());

@@ -23,2 +23,3 @@ var X_DEFAULTS = Object.freeze({

tick_padding: 0.25,
edge_padding: 50,

@@ -25,0 +26,0 @@ tick_label_position: "default",

@@ -25,2 +25,3 @@ import { fillInDefaults } from "./common";

tick_padding: 0.25,
edge_padding: 50,

@@ -27,0 +28,0 @@ tick_label_position: "default",

@@ -100,3 +100,3 @@ import { select } from "d3-selection";

// filter out dates that will give repeated tick labels
if (typeof tick_array[0] === "object") dropRepeatedLabels(tick_array, format);
if (typeof tick_array[0] === "object") tick_array = dropRepeatedLabels(tick_array, format);

@@ -212,3 +212,3 @@ var max_space = remToPx(x.tick_label_space);

// filter out dates that will give repeated tick labels
if (typeof tick_array[0] === "object") dropRepeatedLabels(tick_array, format);
if (typeof tick_array[0] === "object") tick_array = dropRepeatedLabels(tick_array, format);

@@ -215,0 +215,0 @@ var max_space = remToPx(y.tick_label_space);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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