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

abstract-chart

Package Overview
Dependencies
Maintainers
0
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-chart - npm Package Compare versions

Comparing version 8.2.1 to 9.0.1

4

CHANGELOG.md

@@ -5,2 +5,6 @@ # Change Log

## [9.0.0] - 2024-11-28
- Switch from yarn to pnpm.
## [8.1.0] - 2024-09-17

@@ -7,0 +11,0 @@

55

lib/axis.js

@@ -18,11 +18,35 @@ "use strict";

});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.inverseLogarithmicTransform = exports.inverseLinearTransform = exports.logarithmicTransform = exports.linearTransform = exports.axisMax = exports.axisMin = exports.inverseTransformValue = exports.transformValue = exports.transformPoint = exports.getLogarithmicTicks = exports.getLinearTicks = exports.getTicks = exports.createDiscreteAxis = exports.createLogarithmicAxis = exports.createLinearAxis = void 0;
exports.createLinearAxis = createLinearAxis;
exports.createLogarithmicAxis = createLogarithmicAxis;
exports.createDiscreteAxis = createDiscreteAxis;
exports.getTicks = getTicks;
exports.getLinearTicks = getLinearTicks;
exports.getLogarithmicTicks = getLogarithmicTicks;
exports.transformPoint = transformPoint;
exports.transformValue = transformValue;
exports.inverseTransformValue = inverseTransformValue;
exports.axisMin = axisMin;
exports.axisMax = axisMax;
exports.linearTransform = linearTransform;
exports.logarithmicTransform = logarithmicTransform;
exports.inverseLinearTransform = inverseLinearTransform;
exports.inverseLogarithmicTransform = inverseLogarithmicTransform;
const AI = __importStar(require("abstract-image"));

@@ -45,3 +69,2 @@ const ts_exhaustive_check_1 = require("ts-exhaustive-check");

}
exports.createLinearAxis = createLinearAxis;
function createLogarithmicAxis(min, max, label, labelColor, labelRotation, tickLabelDisp, thickness, axisColor, id, noTicks) {

@@ -62,3 +85,2 @@ return {

}
exports.createLogarithmicAxis = createLogarithmicAxis;
function createDiscreteAxis(points, label, labelColor, labelRotation, tickLabelDisp, thickness, axisColor, id, noTicks) {

@@ -78,3 +100,2 @@ return {

}
exports.createDiscreteAxis = createDiscreteAxis;
const linearMultiples = [1, 2, 5];

@@ -95,3 +116,2 @@ const linearPowers = [-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];

}
exports.getTicks = getTicks;
function getLinearTicks(desiredTicks, min, max) {

@@ -113,3 +133,2 @@ let best;

}
exports.getLinearTicks = getLinearTicks;
const logarithmicAlternatives = [

@@ -137,3 +156,2 @@ [0],

}
exports.getLogarithmicTicks = getLogarithmicTicks;
function transformPoint(point, xMin, xMax, yMin, yMax, xAxis, yAxis) {

@@ -144,3 +162,2 @@ const x = transformValue(point.x, xMin, xMax, xAxis);

}
exports.transformPoint = transformPoint;
function transformValue(value, min, max, axis) {

@@ -163,3 +180,2 @@ if (!axis) {

}
exports.transformValue = transformValue;
function inverseTransformValue(value, min, max, axis) {

@@ -182,3 +198,2 @@ if (!axis) {

}
exports.inverseTransformValue = inverseTransformValue;
function axisMin(axis) {

@@ -197,3 +212,2 @@ var _a, _b;

}
exports.axisMin = axisMin;
function axisMax(axis) {

@@ -212,7 +226,5 @@ var _a, _b;

}
exports.axisMax = axisMax;
function linearTransform(value, min, max) {
return (value - min) / (max - min);
}
exports.linearTransform = linearTransform;
function logarithmicTransform(value, min, max) {

@@ -229,11 +241,8 @@ if (value > 0) {

}
exports.logarithmicTransform = logarithmicTransform;
function inverseLinearTransform(value, min, max) {
return min + value * (max - min);
}
exports.inverseLinearTransform = inverseLinearTransform;
function inverseLogarithmicTransform(value, min, max) {
return Math.pow(10, value * (Math.log10(max) - Math.log10(min)) + Math.log10(min));
}
exports.inverseLogarithmicTransform = inverseLogarithmicTransform;
function range(from, to) {

@@ -240,0 +249,0 @@ const result = [];

@@ -18,11 +18,43 @@ "use strict";

});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateYAxisLabel = exports.generateYAxisLabels = exports.generateYAxisLines = exports.generateXAxisLabel = exports.generateXAxisLabels = exports.generateXAxisGridLines = exports.generateBars = exports.generatePoints = exports.generateLines = exports.generateStack = exports.generateDataAxisesY = exports.generateDataAxisesX = exports.yAxises = exports.xAxises = exports.generateBackground = exports.renderChart = exports.inverseTransformPoint = exports.createChartDataAxis = exports.createChartStack = exports.createChartStackConfig = exports.createChartLine = exports.createChartPoint = exports.createChart = void 0;
exports.createChart = createChart;
exports.createChartPoint = createChartPoint;
exports.createChartLine = createChartLine;
exports.createChartStackConfig = createChartStackConfig;
exports.createChartStack = createChartStack;
exports.createChartDataAxis = createChartDataAxis;
exports.inverseTransformPoint = inverseTransformPoint;
exports.renderChart = renderChart;
exports.generateBackground = generateBackground;
exports.xAxises = xAxises;
exports.yAxises = yAxises;
exports.generateDataAxisesX = generateDataAxisesX;
exports.generateDataAxisesY = generateDataAxisesY;
exports.generateStack = generateStack;
exports.generateLines = generateLines;
exports.generatePoints = generatePoints;
exports.generateBars = generateBars;
exports.generateXAxisGridLines = generateXAxisGridLines;
exports.generateXAxisLabels = generateXAxisLabels;
exports.generateXAxisLabel = generateXAxisLabel;
exports.generateYAxisLines = generateYAxisLines;
exports.generateYAxisLabels = generateYAxisLabels;
exports.generateYAxisLabel = generateYAxisLabel;
/* eslint-disable max-lines */

@@ -74,3 +106,2 @@ const AI = __importStar(require("abstract-image"));

}
exports.createChart = createChart;
function createChartPoint(props) {

@@ -94,3 +125,2 @@ const { shape = "circle", position = AI.createPoint(0, 0), color = AI.black, strokeColor = AI.black, strokeThickness = 1, size = AI.createSize(6, 6), label = "", xAxis = "bottom", yAxis = "left", fontSize, textColor, textOutlineColor, id, } = props || {};

}
exports.createChartPoint = createChartPoint;
function createChartLine(props) {

@@ -100,3 +130,2 @@ const { points = [], color = AI.black, thickness = 1, label = "", xAxis = "bottom", yAxis = "left", fontSize, textColor, textOutlineColor, id, } = props || {};

}
exports.createChartLine = createChartLine;
function createChartStackConfig(props) {

@@ -106,3 +135,2 @@ const { color = AI.black, label = "" } = props || {};

}
exports.createChartStackConfig = createChartStackConfig;
function createChartStack(props) {

@@ -112,3 +140,2 @@ const { points = [], xAxis = "bottom", yAxis = "left", config = [createChartStackConfig({})] } = props || {};

}
exports.createChartStack = createChartStack;
function createChartDataAxis(points, label, labelRotation, tickLabelDisp, labelColor, tickLabelColor, thickness, axisColor, tickFontSize, axisFontSize, id) {

@@ -129,3 +156,2 @@ return {

}
exports.createChartDataAxis = createChartDataAxis;
function inverseTransformPoint(point, chart, xAxis, yAxis) {

@@ -144,3 +170,2 @@ const padding = finalPadding(chart);

}
exports.inverseTransformPoint = inverseTransformPoint;
function finalPadding(chart) {

@@ -224,7 +249,5 @@ return {

}
exports.renderChart = renderChart;
function generateBackground(xMin, xMax, yMin, yMax, chart) {
return AI.createRectangle(AI.createPoint(xMin, yMax), AI.createPoint(xMax, yMin), AI.transparent, 0, chart.backgroundColor);
}
exports.generateBackground = generateBackground;
function xAxises(xAxis, xNumTicks, axises, xMin, xMax, yMin, yMax, xMinLineThicknessAdjustment, xMaxLineThicknessAdjustment, chart) {

@@ -268,3 +291,2 @@ var _a, _b, _c, _d;

}
exports.xAxises = xAxises;
function yAxises(yAxis, yNumTicks, axises, xMin, xMax, yMin, yMax, yMinLineThicknessAdjustment, yMaxLineThicknessAdjustment, chart) {

@@ -309,3 +331,2 @@ var _a, _b, _c, _d;

}
exports.yAxises = yAxises;
function generateDataAxisesX(xAxis, axises, numTicks, xMin, xMax, yMin, yMax, chart) {

@@ -374,3 +395,2 @@ var _a, _b, _c, _d;

}
exports.generateDataAxisesX = generateDataAxisesX;
function generateDataAxisesY(yAxis, axises, numTicks, xMin, xMax, yMin, yMax, chart) {

@@ -440,3 +460,2 @@ var _a, _b, _c, _d;

}
exports.generateDataAxisesY = generateDataAxisesY;
function generateStack(xMin, xMax, yMin, yMax, chart) {

@@ -455,3 +474,2 @@ const pointsPos = chart.chartStack.points.map((stackPoint) => ({

}
exports.generateStack = generateStack;
function generateUnsignedStack(xMin, xMax, yMin, yMax, chart) {

@@ -521,3 +539,2 @@ var _a, _b;

}
exports.generateLines = generateLines;
function getLineSegmentsInsideChart(xMin, xMax, yMin, yMax, points) {

@@ -599,3 +616,2 @@ const segments = [];

}
exports.generatePoints = generatePoints;
function generateBars(xMin, xMax, yMin, yMax, chart) {

@@ -637,3 +653,2 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;

}
exports.generateBars = generateBars;
function textHorizontalGrowth(position, xMin, xMax) {

@@ -676,3 +691,2 @@ return position > (xMin + xMax) * 0.5 ? "left" : "right";

}
exports.generateXAxisGridLines = generateXAxisGridLines;
function generateXAxisLabels(xMin, xMax, y, growVertical, ticks, axis, chart) {

@@ -699,3 +713,2 @@ var _a;

}
exports.generateXAxisLabels = generateXAxisLabels;
function generateXAxisLabel(x, y, horizontalGrowthDirection, verticalGrowthDirection, axis, chart) {

@@ -706,3 +719,2 @@ var _a, _b, _c, _d;

}
exports.generateXAxisLabel = generateXAxisLabel;
function generateYAxisLines(xMin, xMax, yMin, yMax, yTicks, yAxis, yGrid, xGrid) {

@@ -717,3 +729,2 @@ const yLines = yTicks.map((l) => {

}
exports.generateYAxisLines = generateYAxisLines;
function generateYAxisLabels(x, yMin, yMax, growHorizontal, yTicks, yAxis, chart) {

@@ -740,3 +751,2 @@ var _a;

}
exports.generateYAxisLabels = generateYAxisLabels;
function generateYAxisLabel(x, y, rotation, horizontalGrowthDirection, verticalGrowthDirection, axis, chart) {

@@ -747,3 +757,2 @@ var _a, _b, _c, _d;

}
exports.generateYAxisLabel = generateYAxisLabel;
function formatNumber(n) {

@@ -750,0 +759,0 @@ if (n >= 10000000) {

{
"name": "abstract-chart",
"version": "8.2.1",
"version": "9.0.1",
"description": "Drawing charts using multiple unit of measure axes as coordinate system",

@@ -18,6 +18,6 @@ "repository": "https://github.com/dividab/abstract-visuals/tree/master/packages/abstract-chart",

"dependencies": {
"abstract-image": "^8.3.1",
"abstract-image": "^9.0.1",
"ts-exhaustive-check": "^1.0.0"
},
"gitHead": "b371270c2308183546e19757da43daddf7c91d8f"
"gitHead": "56c5f9391ac0be006460aa8d57cd6789907fc04a"
}

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