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

chart2music

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chart2music - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/types/audio/AudioEngine.d.ts

2

dist/index.d.ts

@@ -102,4 +102,4 @@ interface AudioEngine {

_generateSummary(): void;
private _setData;
setData(data: SonifyTypes["data"], axes?: SonifyTypes["axes"]): void;
setOptions(option: c2mOptions): void;
getCurrent(): {

@@ -106,0 +106,0 @@ group: string;

@@ -353,20 +353,20 @@ var c2mChart = (function (exports) {

const sentenceCase = (str) => `${str.substring(0, 1).toUpperCase()}${str.substring(1).toLowerCase()}`;
const generatePointDescription = (point, xAxis, yAxis, stat) => {
const generatePointDescription = (point, xFormat, yFormat, stat) => {
if (isOHLCDataPoint(point)) {
if (typeof stat !== "undefined") {
return `${xAxis.format(point.x)}, ${yAxis.format(point[stat])}`;
return `${xFormat(point.x)}, ${yFormat(point[stat])}`;
}
return `${xAxis.format(point.x)}, ${yAxis.format(point.open)} - ${yAxis.format(point.high)} - ${yAxis.format(point.low)} - ${yAxis.format(point.close)}`;
return `${xFormat(point.x)}, ${yFormat(point.open)} - ${yFormat(point.high)} - ${yFormat(point.low)} - ${yFormat(point.close)}`;
}
if (isHighLowDataPoint(point)) {
if (typeof stat !== "undefined") {
return `${xAxis.format(point.x)}, ${yAxis.format(point[stat])}`;
return `${xFormat(point.x)}, ${yFormat(point[stat])}`;
}
return `${xAxis.format(point.x)}, ${yAxis.format(point.high)} - ${yAxis.format(point.low)}`;
return `${xFormat(point.x)}, ${yFormat(point.high)} - ${yFormat(point.low)}`;
}
if (isSimpleDataPoint(point)) {
return `${xAxis.format(point.x)}, ${yAxis.format(point.y)}`;
return `${xFormat(point.x)}, ${yFormat(point.y)}`;
}
if (isAlternateAxisDataPoint(point)) {
return `${xAxis.format(point.x)}, ${yAxis.format(point.y2)}`;
return `${xFormat(point.x)}, ${yFormat(point.y2)}`;
}

@@ -557,2 +557,20 @@ return "";

};
const formatWrapper = (axis) => {
const format = (num) => {
if (isNaN(num)) {
return "missing";
}
if ((axis.minimum && num < axis.minimum)) {
return "too low";
}
if ((axis.maximum && num > axis.maximum)) {
return "too high";
}
return axis.format(num);
};
return format;
};
const isUnplayable = (yValue, yAxis) => {
return isNaN(yValue) || yValue < yAxis.minimum || yValue > yAxis.maximum;
};
const c2mChart = (input) => {

@@ -609,3 +627,3 @@ const validationErrorString = validateInput(input);

this._ccElement = input.cc ?? this._chartElement;
this.setData(input.data, input.axes);
this._setData(input.data, input.axes);
if (input?.options) {

@@ -634,3 +652,3 @@ this._options = {

}
setData(data, axes) {
_setData(data, axes) {
this._explicitAxes = {

@@ -660,7 +678,7 @@ x: {

}
setOptions(option) {
this._options = {
...this._options,
...option
};
setData(data, axes) {
this._setData(data, axes);
this._pointIndex = 0;
this._groupIndex = 0;
this._sr.render(`${this._title || "Chart"} updated`);
}

@@ -679,2 +697,3 @@ getCurrent() {

}
let recalculateX = false, recalculateY = false, recalculateY2 = false;
for (let i = 0; i < this._data.length; i++) {

@@ -687,10 +706,7 @@ if (this._data[i].length <= this._options.maxWidth) {

this._xAxis.maximum === tmp.x) {
this._xAxis.minimum = calculateAxisMinimum(this._data, "x");
this._xAxis.maximum = calculateAxisMaximum(this._data, "x");
recalculateX = true;
}
this._yAxis.minimum = calculateAxisMinimum(this._data, "y");
this._yAxis.maximum = calculateAxisMaximum(this._data, "y");
recalculateY = true;
if (isAlternateAxisDataPoint(tmp)) {
this._y2Axis.minimum = calculateAxisMinimum(this._data, "y2");
this._y2Axis.maximum = calculateAxisMaximum(this._data, "y2");
recalculateY2 = true;
}

@@ -704,2 +720,14 @@ const targetType = this._metadataByGroup[i].inputType;

}
if (recalculateX) {
this._xAxis.minimum = calculateAxisMinimum(this._data, "x");
this._xAxis.maximum = calculateAxisMaximum(this._data, "x");
}
if (recalculateY) {
this._yAxis.minimum = calculateAxisMinimum(this._data, "y");
this._yAxis.maximum = calculateAxisMaximum(this._data, "y");
}
if (recalculateY2) {
this._y2Axis.minimum = calculateAxisMinimum(this._data, "y2");
this._y2Axis.maximum = calculateAxisMaximum(this._data, "y2");
}
}

@@ -1171,5 +1199,11 @@ appendData(dataPoint, group) {

}
if (isUnplayable(current.x, this._xAxis)) {
return;
}
const xPan = calcPan((current.x - this._xAxis.minimum) /
(this._xAxis.maximum - this._xAxis.minimum));
if (isSimpleDataPoint(current)) {
if (isUnplayable(current.y, this._yAxis)) {
return;
}
const yBin = interpolateBin(current.y, this._yAxis.minimum, this._yAxis.maximum, HERTZ.length - 1);

@@ -1180,2 +1214,5 @@ this._audioEngine.playDataPoint(HERTZ[yBin], xPan, NOTE_LENGTH);

if (isAlternateAxisDataPoint(current)) {
if (isUnplayable(current.y2, this._y2Axis)) {
return;
}
const yBin = interpolateBin(current.y2, this._y2Axis.minimum, this._y2Axis.maximum, HERTZ.length - 1);

@@ -1188,2 +1225,5 @@ this._audioEngine.playDataPoint(HERTZ[yBin], xPan, NOTE_LENGTH);

const stat = availableStats[statIndex];
if (isUnplayable(current[stat], this._yAxis)) {
return;
}
const yBin = interpolateBin(current[stat], this._yAxis.minimum, this._yAxis.maximum, HERTZ.length - 1);

@@ -1195,2 +1235,5 @@ this._audioEngine.playDataPoint(HERTZ[yBin], xPan, NOTE_LENGTH);

availableStats.forEach((stat, index) => {
if (isUnplayable(current[stat], this._yAxis)) {
return;
}
const yBin = interpolateBin(current[stat], this._yAxis.minimum, this._yAxis.maximum, HERTZ.length - 1);

@@ -1221,3 +1264,5 @@ setTimeout(() => {

const current = this._data[this._groupIndex][this._pointIndex];
const point = generatePointDescription(current, this._xAxis, isAlternateAxisDataPoint(current) ? this._y2Axis : this._yAxis, availableStats[statIndex]);
const point = generatePointDescription(current, formatWrapper(this._xAxis), formatWrapper(isAlternateAxisDataPoint(current)
? this._y2Axis
: this._yAxis), availableStats[statIndex]);
const text = (this._flagNewGroup ? `${this._groups[this._groupIndex]}, ` : "") +

@@ -1224,0 +1269,0 @@ (this._flagNewStat

{
"name": "chart2music",
"version": "1.0.0",
"version": "1.0.1",
"main": "dist/index.js",

@@ -43,2 +43,3 @@ "module": "dist/index.mjs",

"lint-staged": "lint-staged",
"lint-check": "eslint --quiet src/ --ext .ts && prettier --config .prettierrc.json src/**/*.ts --check",
"format": "prettier --config .prettierrc.json src/**/*.ts --write && prettier examples/**/*.js --write",

@@ -50,27 +51,27 @@ "prepare": "husky install",

"devDependencies": {
"@docusaurus/core": "^2.0.1",
"@docusaurus/preset-classic": "^2.0.1",
"@rollup/plugin-typescript": "^8.3.3",
"@types/jest": "^28.1.6",
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.31.0",
"concurrently": "^7.3.0",
"eslint": "^8.20.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jsdoc": "^39.3.3",
"http-server": "^14.1.1",
"husky": "^8.0.1",
"jest": "^28.1.3",
"jest-environment-jsdom": "^28.1.3",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"rimraf": "^3.0.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rollup": "^2.77.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-dts": "^4.2.2",
"ts-jest": "^28.0.7",
"tslib": "^2.4.0",
"typescript": "^4.7.4"
"@docusaurus/core": "2.0.1",
"@docusaurus/preset-classic": "2.0.1",
"@rollup/plugin-typescript": "8.3.3",
"@types/jest": "28.1.6",
"@typescript-eslint/eslint-plugin": "5.32.0",
"@typescript-eslint/parser": "5.32.0",
"concurrently": "7.3.0",
"eslint": "8.21.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jsdoc": "39.3.4",
"http-server": "14.1.1",
"husky": "8.0.1",
"jest": "28.1.3",
"jest-environment-jsdom": "28.1.3",
"lint-staged": "13.0.3",
"prettier": "2.7.1",
"rimraf": "3.0.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"rollup": "2.77.0",
"rollup-plugin-delete": "2.0.0",
"rollup-plugin-dts": "4.2.2",
"ts-jest": "28.0.7",
"tslib": "2.4.0",
"typescript": "4.7.4"
},

@@ -77,0 +78,0 @@ "resolutions": {

@@ -60,2 +60,3 @@ # Chart2Music

* [with Plotly.js](https://codepen.io/chart2music/full/BarrXYr)
* [with Vega-Lite](https://codepen.io/chart2music/pen/jOzpyME)
* [with Morris.js](https://codepen.io/chart2music/full/abYGobm)

@@ -62,0 +63,0 @@ * [with Frappe](https://codepen.io/chart2music/full/QWmrWWE)

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