Socket
Socket
Sign inDemoInstall

node-jsgraph

Package Overview
Dependencies
2
Maintainers
2
Versions
190
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.4.9 to 2.4.10

2

package.json
{
"name": "node-jsgraph",
"description": "library that can be used to render scientific data in the form of graphs and charts",
"version": "2.4.9",
"version": "2.4.10",
"scripts": {

@@ -6,0 +6,0 @@ "build": "npx webpack",

import { SerieInterface, SERIE_TYPE } from '../../types/series';
import Graph, { ns } from '../graph.core';
import SerieLine, { LineStyle, SerieLineOptions } from './graph.serie.line'
import * as util from '../graph.util.js';
import { Waveform } from '../util/waveform';
import SerieLine, { LineStyle, SerieLineOptions } from './graph.serie.line';

@@ -40,8 +40,8 @@ export type HistogramStyle = {

constructor(graph: Graph, name: string, options: SerieHistogramOptions ) {
super( graph, name, options);
constructor(graph: Graph, name: string, options: SerieHistogramOptions) {
super(graph, name, options);
this.init();
// Unselected style
this.extendStyle( {
this.extendStyle({
histogram: this.options.histogramStyle

@@ -52,3 +52,3 @@ }, "unselected", null);

protected init() {
this.options = this.extendLineOptions( this.options );
this.options = this.extendLineOptions(this.options);
util.mapEventEmission(this.options, this); // Register events

@@ -67,22 +67,22 @@ }

applyHistogramStyles() {
this.applyLineStyles();
this.applyLineStyles();
for (var i = 0; i < this.lines.length; i++) {
this.applyHistogramStyle(this.lines[i]);
this.applyHistogramStyle(this.lines[i]);
}
}
/**
* Applies the current style to a line element. Mostly used internally
* @memberof SerieLine
*/
applyHistogramStyle(line: SVGPolylineElement) {
/**
* Applies the current style to a line element. Mostly used internally
* @memberof SerieLine
*/
applyHistogramStyle(line: SVGPolylineElement) {
if (this.getFillColor()) {
line.setAttribute('fill', this.getFillColor());
line.setAttribute('fill', this.getFillColor());
} else {
line.setAttribute('fill', 'none');
line.setAttribute('fill', 'none');
}
line.setAttribute('fill-opacity', this.getFillOpacity() );
}
line.setAttribute('fill-opacity', this.getFillOpacity());
}

@@ -96,3 +96,3 @@

*/
getSymbolForLegend() : SVGElement {
getSymbolForLegend(): SVGElement {
const container = this.symbolLegendContainer;

@@ -103,3 +103,3 @@

this.applyLineStyle(line);
line.setAttribute('d', "M 5 -5 v 10 h 5 v -10");

@@ -119,3 +119,2 @@ line.setAttribute('cursor', 'pointer');

protected drawInit(force) {
var data, xData;

@@ -129,4 +128,4 @@ try {

if( ! this.waveform ) {
throw "No waveform for this serie";
if (!this.waveform) {
throw "No waveform for this serie";
}

@@ -145,18 +144,18 @@ }

//console.log('drawing');
// this.removeLinesGroup();
//if( ! this._histForLegend ) {
// this.removeLinesGroup();
//if( ! this._histForLegend ) {
this._calculateHistogram( this.getXAxis().firstTick, this.getXAxis().lastTick, this.getXAxis()._secondaryTickIncrement);
try {
this._createLine();
this._calculateHistogram(this.getXAxis().firstTick, this.getXAxis().lastTick, this.getXAxis()._secondaryTickIncrement);
for( let i = 0; i < this._histogramWaveform.getLength(); i ++ ) {
this._addHistogramPoint( this._histogramWaveform.getX( i ), this._histogramWaveform.getY( i ), this.getXAxis()._secondaryTickIncrement )
}
} catch( e ) {
try {
this._createLine();
for (let i = 0; i < this._histogramWaveform.getLength(); i++) {
this._addHistogramPoint(this._histogramWaveform.getX(i), this._histogramWaveform.getY(i), this.getXAxis()._secondaryTickIncrement)
}
this.removeExtraLines();
// this.insertLinesGroup();
} catch (e) {
}
this.removeExtraLines();
// this.insertLinesGroup();
}

@@ -174,24 +173,24 @@

/**
* Notifies jsGraph that the data of the serie has changed
* @returns {Serie} The current serie
* @memberof Serie
*/
dataHasChanged(arg) {
/**
* Notifies jsGraph that the data of the serie has changed
* @returns {Serie} The current serie
* @memberof Serie
*/
dataHasChanged(arg) {
super.dataHasChanged( arg );
if (this.waveform ) {
if( this.getXAxis() ) {
this._calculateHistogram( this.waveform.getMinY(), this.waveform.getMaxY(), ( this.waveform.getMaxY() - this.waveform.getMinY() ) / 20 );
}
super.dataHasChanged(arg);
if (this.waveform) {
if (this.getXAxis()) {
this._calculateHistogram(this.waveform.getMinY(), this.waveform.getMaxY(), (this.waveform.getMaxY() - this.waveform.getMinY()) / 20);
}
return this;
}
return this;
}
private _calculateHistogram( xMin: number, xMax: number, dX: number) {
private _calculateHistogram(xMin: number, xMax: number, dX: number) {
try {
this._histogramWaveform = this.waveform.calculateHistogram( xMin, xMax, dX );
this._histogramWaveform = this.waveform.calculateHistogram(xMin, xMax, dX);
this.minX = this.waveform.getMinY();

@@ -201,5 +200,5 @@ this.maxX = this.waveform.getMaxY();

this.maxY = this._histogramWaveform.getMax();
} catch( e ) {
console.warn("Could not calculate histogram");
//console.log( this.minX, this.maxX, this.minY, this.maxY );
} catch (e) {
//console.warn("Could not calculate histogram");
// TODO: Signal that the serie is invalid and but soft fails the drawing

@@ -209,21 +208,21 @@ }

_addHistogramPoint(x: number, y: number, dx: number) {
let xpx = this.getX( x );
let xpx2 = this.getX( x + dx );
let ypx = this.getY( y );
let ypx0 = this.getY( 0 );
let xpx = this.getX(x);
let xpx2 = this.getX(x + dx);
let ypx = this.getY(y);
let ypx0 = this.getY(0);
if( isNaN( ypx0 ) ) {
if (isNaN(ypx0)) {
return;
}
if (xpx !== xpx || ypx !== ypx || xpx2 !== xpx2 || ypx0 !== ypx0 ) {
if (xpx !== xpx || ypx !== ypx || xpx2 !== xpx2 || ypx0 !== ypx0) {
return;
}
if( this.counter == 0 ) {
this.currentLine = "";
if (this.counter == 0) {
this.currentLine = "";
}
this.counter++;
this.currentLine += `M ${ xpx } ${ ypx0 } V ${ ypx } H ${ xpx2 } V ${ ypx0 } z`
this.currentLine += `M ${xpx} ${ypx0} V ${ypx} H ${xpx2} V ${ypx0} z`
}

@@ -255,3 +254,3 @@

}
setFillColor(color, selectionType, applyToSelected: boolean = false) {

@@ -273,3 +272,3 @@ let s = this.getRawHistogramStyle(selectionType);

setFillOpacity(opacity: number, selectionType: string, applyToSelected: boolean = false) {

@@ -276,0 +275,0 @@ let s = this.getRawHistogramStyle(selectionType);

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc