Browse Source

upd core: github -> npm && rm dist

merge-requests/1/merge
rozetko 3 years ago
parent
commit
e85a0fcc65
  1. 2
      .gitignore
  2. 22
      dist/gauge.d.ts
  3. 131
      dist/index.d.ts
  4. 9
      dist/index.js
  5. 12
      dist/pod.d.ts
  6. 50
      dist/types.d.ts
  7. 8
      dist/utils.d.ts
  8. 4638
      package-lock.json
  9. 2
      package.json
  10. 11
      src/index.ts
  11. 7
      yarn.lock

2
.gitignore vendored

@ -102,3 +102,5 @@ typings/
# TernJS port file # TernJS port file
.tern-port .tern-port
.dotrun.json .dotrun.json
dist

22
dist/gauge.d.ts vendored

@ -1,22 +0,0 @@
import { GaugeOptions } from './types';
import * as d3 from 'd3';
export declare type D3SVGSelection = d3.Selection<SVGElement, unknown, null, undefined>;
export declare type BoundingBox = {
x?: number;
y?: number;
width: number;
height: number;
};
export declare class Gauge {
protected svg: D3SVGSelection;
protected readonly options: GaugeOptions;
private _rootGroup;
private _boundingBox;
private _radius;
private _centrum;
constructor(svg: D3SVGSelection, options: GaugeOptions);
private _setBoundingBox;
render(value: number, boudingBox: BoundingBox): void;
private _initRootGroup;
private _renderValueArc;
}

131
dist/index.d.ts vendored

@ -1,131 +0,0 @@
import { GaugeTimeSerie, GaugeOptions, Stat, PointCoordinate } from './types';
import { ChartwerkPod } from '@chartwerk/core';
import * as d3 from 'd3';
export declare class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> {
_draggableLines: any[];
_draggedThresholdValues: number[];
_thresholdArc: any | null;
_thresholdTextLabels: any[];
constructor(el: HTMLElement, _series?: GaugeTimeSerie[], _options?: GaugeOptions);
renderMetrics(): void;
protected updateOptions(newOptions: GaugeOptions): void;
get _gaugeTransform(): string;
get _gaugeCenterTranform(): string;
get _gaugeCenterCoordinate(): {
x: number;
y: number;
};
get _minWH(): number;
private _renderIcons;
private _renderIcon;
private _getIconPosition;
private _getIconSize;
protected _renderOverlayBackground(): void;
private _renderValue;
private _renderValueArc;
private _renderThresholdArc;
protected _getThresholdArc(): d3.Arc<any, d3.DefaultArcObject>;
get arcScale(): d3.ScaleLinear<number, number>;
protected _renderDraggableLines(): void;
protected _renderDraggableLine(stopValue: number, idx: number): void;
onDrag(idx: number): void;
updateThresholdArcByNewValues(stops: number[]): void;
updateThresholdLabel(value: number, idx: number): void;
updateDraggableLineByAngle(angle: number, idx: number): void;
onDragEnd(idx: number): void;
getAngleFromCoordinates(x: number, y: number): number;
getAngleBetween2Vectors(vector1: {
start: PointCoordinate;
end: PointCoordinate;
}, vector2: {
start: PointCoordinate;
end: PointCoordinate;
}): number;
restrictAngle(angle: number, idx: number): number;
protected _renderLabels(): void;
protected renderLabelBackground(x: number, y: number): void;
protected renderLabelText(x: number, y: number, text: string): d3.Selection<SVGTextElement, unknown, null, undefined>;
private get _d3Pie();
private get _valueArcColors();
private get _mainCircleColor();
private _getStopsRange;
getUpdatedRangeWithMinValue(range: number[]): number[];
private get _valueRange();
private get _sortedStops();
private get _stopsValues();
private get _colors();
private get _valueText();
private get _valueTextFontSize();
private get _stat();
private get _valueArcBackgroundColor();
private get _innerRadius();
private get _outerRadius();
rescaleArcRadius(radius: number): number;
rescaleValueFont(fontsize: number): number;
rescaleSpace(space: number): number;
rescaleWith(width: number): number;
private get _scaleFactor();
private get aggregatedValue();
private get _maxValue();
private get _minValue();
onMouseOver(): void;
onMouseMove(): void;
onMouseOut(): void;
onGaugeMouseOver(): void;
onGaugeMouseMove(): void;
onGaugeMouseOut(): void;
renderSharedCrosshair(): void;
hideSharedCrosshair(): void;
}
export declare const VueChartwerkGaugePodObject: {
render(createElement: any): any;
mixins: {
props: {
id: {
type: StringConstructor;
required: boolean;
};
series: {
type: ArrayConstructor;
required: boolean;
default: () => any[];
};
options: {
type: ObjectConstructor;
required: boolean;
default: () => {};
};
};
watch: {
id(): void;
series(): void;
options(): void;
};
mounted(): void;
destroyed(): void;
methods: {
render(): void;
renderSharedCrosshair(values: {
x?: number;
y?: number;
}): void;
hideSharedCrosshair(): void;
onPanningRescale(event: any): void;
renderChart(): void;
appendEvents(): void;
zoomIn(range: any): void;
zoomOut(centers: any): void;
mouseMove(evt: any): void;
mouseOut(): void;
onLegendClick(idx: any): void;
panningEnd(range: any): void;
panning(range: any): void;
contextMenu(evt: any): void;
sharedCrosshairMove(event: any): void;
};
}[];
methods: {
render(): void;
};
};
export { GaugeOptions, GaugeTimeSerie, Stat };

9
dist/index.js vendored

File diff suppressed because one or more lines are too long

12
dist/pod.d.ts vendored

@ -1,12 +0,0 @@
import { GaugeOptions, GaugeTimeSerie } from './types';
import { ChartwerkPod } from '@chartwerk/core';
export declare class Pod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> {
protected readonly options: GaugeOptions;
constructor(el: HTMLElement, series: GaugeTimeSerie[], options: GaugeOptions);
renderMetrics(): void;
onMouseOver(): void;
onMouseMove(): void;
onMouseOut(): void;
renderSharedCrosshair(): void;
hideSharedCrosshair(): void;
}

50
dist/types.d.ts vendored

@ -1,50 +0,0 @@
import { TimeSerie, Options } from '@chartwerk/core';
export declare enum Stat {
CURRENT = "current",
MIN = "min",
MAX = "max",
TOTAL = "total"
}
export declare type Stop = {
color: string;
value: number | null;
};
export declare type PointCoordinate = {
x: number;
y: number;
};
export declare type ValueFormatter = (value: number) => string;
export declare type GaugeTimeSerie = TimeSerie;
export declare type IconConfig = {
src: string;
position: IconPosition;
size: number;
};
export declare enum IconPosition {
LEFT = "left",
MIDDLE = "middle",
RIGHT = "right"
}
export declare type GaugeOptionsParams = {
innerRadius: number;
outerRadius: number;
maxValue: number;
minValue: number;
stops: {
color: string;
value: number;
}[];
defaultColor: string;
stat: Stat;
valueFormatter: ValueFormatter;
icons: IconConfig[];
valueFontSize: number;
valueArcBackgroundColor: string;
reversed: boolean;
enableThresholdLabels: boolean;
enableExtremumLabels: boolean;
enableThresholdDrag: boolean;
dragCallback: (event: any) => void;
dragEndCallback: (event: any) => void;
};
export declare type GaugeOptions = Options & Partial<GaugeOptionsParams>;

8
dist/utils.d.ts vendored

@ -1,8 +0,0 @@
/**
* Finds the closest item to a given number in an array using binary search
* @argument arr: ascending sorted array
* @argument num: number to find
* @returns index of the closest item to `num`
* @returns -1 if given array is empty
*/
export declare function findClosest(arr: number[], num: number): number;

4638
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
package.json

@ -11,7 +11,7 @@
"author": "CorpGlory", "author": "CorpGlory",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@chartwerk/core": "github:chartwerk/core#a30ca83842247c79969deaaacfc7fb444a60cefb" "@chartwerk/core": "^0.4.1"
}, },
"devDependencies": { "devDependencies": {
"@types/d3": "^5.7.2", "@types/d3": "^5.7.2",

11
src/index.ts

@ -21,7 +21,14 @@ const DEFAULT_ICON_SIZE = 20; //px
const DEFAULT_GAUGE_OPTIONS: GaugeOptions = { const DEFAULT_GAUGE_OPTIONS: GaugeOptions = {
renderLegend: false, renderLegend: false,
renderGrid: false, grid: {
x: {
enabled: false
},
y: {
enabled: false
}
},
zoomEvents: { zoomEvents: {
mouse: { mouse: {
zoom: { zoom: {
@ -606,7 +613,7 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions
} }
private get _maxValue(): number { private get _maxValue(): number {
return this.options.maxValue || this.maxValue; return this.options.maxValue || this.state.getMaxValueY();
} }
private get _minValue(): number { private get _minValue(): number {

7
yarn.lock

@ -2,9 +2,10 @@
# yarn lockfile v1 # yarn lockfile v1
"@chartwerk/core@github:chartwerk/core#a30ca83842247c79969deaaacfc7fb444a60cefb": "@chartwerk/core@^0.4.1":
version "0.1.0" version "0.4.1"
resolved "https://codeload.github.com/chartwerk/core/tar.gz/a30ca83842247c79969deaaacfc7fb444a60cefb" resolved "https://registry.yarnpkg.com/@chartwerk/core/-/core-0.4.1.tgz#c09f72a5c74911d3a760a814bdcec13d7b421fd6"
integrity sha512-t8axHIl5RnmEdQtOAWAQYfyVtc8+XOVz080ooIPbeLuAbC3n4647tgju4p0tOWnhqYNVP7vM1GIptqWYzLwx3w==
"@types/d3-array@^1": "@types/d3-array@^1":
version "1.2.8" version "1.2.8"

Loading…
Cancel
Save