Socket
Socket
Sign inDemoInstall

zz-chart

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zz-chart - npm Package Compare versions

Comparing version 0.1.1-beta.9 to 0.1.1-beta.10

8

lib/chart/view.js

@@ -168,3 +168,3 @@ import { isBoolean, isObject, merge, set, cloneDeep } from 'lodash';

getData() {
return this.options.data;
return this.options.data || [];
}

@@ -178,4 +178,3 @@ // -------------- Component ---------------//

set(this.options, 'legend', legendOption);
const legend = this.components.get('legend');
return legend;
return this.components.get('legend');
}

@@ -261,6 +260,9 @@ axis(field, axisOption) {

this.chartContainer.innerHTML = '';
this.options = {};
this.reactivity.unsubscribe();
[...this.components.values()].forEach(c => c.destroy());
[...this.shapeComponents.values()].forEach(c => c.destroy());
this.strategyManage.getStrategy('uPlot')?.destroy();
this.unbindThemeListener();
this.off();
}

@@ -267,0 +269,0 @@ }

@@ -9,3 +9,3 @@ import { AxisOpt } from '../types/index.js';

axes: {
values: (string | number)[][] | ((_u: import("uplot"), splits: string[]) => string[]);
values: ((_u: import("uplot"), splits: string[]) => string[]) | (string | number)[][];
}[];

@@ -12,0 +12,0 @@ };

@@ -7,5 +7,8 @@ export class BaseComponent {

destroy() {
this.container?.remove();
if (this.container) {
this.container.innerHTML = '';
this.container.remove();
}
}
}
//# sourceMappingURL=base.js.map

@@ -7,2 +7,3 @@ import { get } from 'lodash';

this.ctrl = ctrl;
this.render();
}

@@ -19,3 +20,5 @@ render() {

this.option = get(this.ctrl.getOption(), this.name);
this.isTransposed = this.option.transposed;
if (this.option) {
this.isTransposed = this.option?.transposed;
}
}

@@ -26,2 +29,6 @@ transpose() {

getOptions() {
const option = get(this.ctrl.getOption(), this.name);
if (typeof option === 'object' && option.transposed) {
this.isTransposed = option.transposed;
}
return this.isTransposed

@@ -28,0 +35,0 @@ ? {

@@ -25,5 +25,2 @@ import { ScaleOption } from '../types/index.js';

auto: boolean;
range?: undefined;
} | {
auto: boolean;
range: (_u: import("uplot"), dataMin: number, dataMax: number) => number[];

@@ -30,0 +27,0 @@ };

@@ -43,3 +43,3 @@ import { get, isNumber } from 'lodash';

}
const { max, min } = (this.option.x || {});
const { max, min } = this.option.x || {};
const maxV = isNumber(max) ? { max } : {};

@@ -53,8 +53,3 @@ const minV = isNumber(min) ? { min } : {};

getYOptions() {
if (!this.option.y) {
return {
auto: true,
};
}
const { max, min } = (this.option.y || {});
const { max, min } = this.option.y || {};
const notAuto = !isNumber(max) && !isNumber(min);

@@ -61,0 +56,0 @@ return {

/// <reference types="web" />
import { Shape } from './index.js';
import { ShapeOptions } from '../../types/options.js';
import { View } from '../../chart/view.js';
export declare type AdjustType = 'stack' | 'group';

@@ -13,7 +15,6 @@ export interface AdjustOption {

type: "bar";
adjustType: AdjustType;
private get transposed();
private adjustOption;
private get strategy();
private get isStack();
constructor(ctrl: View, opt?: ShapeOptions);
map(name: string): this;

@@ -20,0 +21,0 @@ adjust(adjustOpt: AdjustType | AdjustOption): void;

@@ -10,10 +10,17 @@ import { get } from 'lodash';

export default class Bar extends Shape {
constructor() {
super(...arguments);
constructor(ctrl, opt = {}) {
super(ctrl, opt);
this.type = ShapeType.Bar;
this.adjustType = 'group';
this.adjustOption = {
type: this.adjustType,
type: 'group',
marginRatio: 0.2,
};
const option = get(this.ctrl.getOption(), this.type);
if (typeof option === 'object') {
this.option = option;
this.adjustOption = {
...this.adjustOption,
...option.adjust,
};
}
}

@@ -26,5 +33,2 @@ get transposed() {

}
get isStack() {
return this.adjustType === 'stack';
}
map(name) {

@@ -36,7 +40,5 @@ this.mapName = name;

if (typeof adjustOpt === 'string') {
this.adjustType = adjustOpt;
this.adjustOption.type = adjustOpt;
}
if (typeof adjustOpt === 'object') {
const { type = 'group' } = adjustOpt || {};
this.adjustType = type;
this.adjustOption = adjustOpt;

@@ -59,3 +61,4 @@ }

const data = this.strategy.getData();
const stackOpt = this.isStack ? stack(data) : {};
const isStack = this.adjustOption.type === 'stack';
const stackOpt = isStack ? stack(data) : {};
return {

@@ -68,3 +71,3 @@ ...stackOpt,

dir: this.transposed ? -1 : 1,
stacked: this.isStack,
stacked: isStack,
marginRatio: this.adjustOption.marginRatio / 10,

@@ -71,0 +74,0 @@ }),

@@ -33,2 +33,3 @@ /// <reference types="web" />

getOptions(): {};
destroy(): void;
}

@@ -35,0 +36,0 @@ export declare abstract class PolarShape<T = unknown> {

@@ -29,2 +29,5 @@ export class Shape {

}
destroy() {
this.mapName = '';
}
}

@@ -37,4 +40,3 @@ export class PolarShape {

getData() {
const data = this.ctrl.getData();
return data;
return this.ctrl.getData();
}

@@ -41,0 +43,0 @@ destroy() {

/// <reference types="web" />
import { View } from '../../chart/view.js';
import { ShapeOptions } from '../../types/options.js';
import { Shape } from './index.js';

@@ -12,2 +14,3 @@ export declare type StepType = 'start' | 'end';

step(type: 'start' | 'end'): void;
constructor(ctrl: View, opt?: ShapeOptions);
getSeries(): ({

@@ -66,2 +69,3 @@ paths: import("uplot").Series.PathBuilder;

})[];
destroy(): void;
}

@@ -0,1 +1,2 @@

import { get } from 'lodash';
import { getSeriesPathType } from '../../strategy/utils.js';

@@ -8,5 +9,9 @@ import { ShapeType } from '../../utils/index.js';

export default class Line extends Shape {
constructor() {
super(...arguments);
constructor(ctrl, opt = {}) {
super(ctrl, opt);
this.type = ShapeType.Line;
const option = get(this.ctrl.getOption(), this.type);
if (typeof option === 'object' && option.step) {
this.stepType = option.step;
}
}

@@ -33,3 +38,7 @@ map(name) {

}
destroy() {
this.stepType = null;
super.destroy();
}
}
//# sourceMappingURL=line.js.map

@@ -86,2 +86,3 @@ import { StyleSheet, css } from 'aphrodite/no-important.js';

(popupContainer || document.body).append(overlay);
overlay.style.visibility = 'hidden';
this.container = overlay;

@@ -100,2 +101,5 @@ }

const itemTpl = this.getTooltipItem(values);
if (!itemTpl) {
return;
}
const isEl = isElement(itemTpl);

@@ -102,0 +106,0 @@ const list = `<ul class="${css(styles['tooltip-list'])}">${itemTpl}</ul>`;

@@ -68,12 +68,16 @@ import { registerShape } from './chart/view.js';

],
end: [
{ trigger: ChartEvent.PLOT_MOUSEUP, action: ActionType.BRUSH_X_END },
],
end: [{ trigger: ChartEvent.PLOT_MOUSEUP, action: ActionType.BRUSH_X_END }],
});
registerInteraction('element-active', {
start: [
{ trigger: ChartEvent.ELEMENT_MOUSEMOVE, action: ActionType.ELEMENT_ACTIVE },
{
trigger: ChartEvent.ELEMENT_MOUSEMOVE,
action: ActionType.ELEMENT_ACTIVE,
},
],
end: [
{ trigger: ChartEvent.ELEMENT_MOUSELEAVE, action: ActionType.ELEMENT_RESET },
{
trigger: ChartEvent.ELEMENT_MOUSELEAVE,
action: ActionType.ELEMENT_RESET,
},
],

@@ -80,0 +84,0 @@ });

@@ -1,3 +0,1 @@

/// <reference types="react" resolution-mode="require"/>
/// <reference types="web" />
import UPlot from 'uplot';

@@ -7,6 +5,2 @@ import { Data, Size } from '../types/index.js';

import { Quadtree } from './quadtree.js';
export interface BrushContext {
start: number;
end: number;
}
/**

@@ -13,0 +7,0 @@ * 渲染策略

@@ -9,2 +9,13 @@ import { cloneDeep, merge, mergeWith, omit, isFunction } from 'lodash';

import { Quadtree } from './quadtree.js';
// export interface MarkContext {
// title: Date | number | string;
// values: MarkContextItem[];
// }
// export interface MarkContextItem {
// name: string;
// color: string;
// x: string;
// y: number;
// activated?: boolean;
// }
const SHAPES = SHAPE_TYPES;

@@ -11,0 +22,0 @@ /**

@@ -5,1 +5,5 @@ export interface Size {

}
export interface BrushContext {
start: number;
end: number;
}
{
"name": "zz-chart",
"version": "0.1.1-beta.9",
"version": "0.1.1-beta.10",
"type": "module",

@@ -5,0 +5,0 @@ "author": "Alauda",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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