realchart 0.9.42 → 0.9.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,42 +15,59 @@ npm i realchart
15
15
  ## Usage
16
16
 
17
17
  ```ts
18
-
19
18
  const chart = RealChart.createChart(document, 'realchart', config);
20
-
21
19
  ```
22
20
 
23
21
  ```ts
24
22
  // config
25
23
  const config = {
26
24
  options: {},
27
- title: "Axis Breaks",
25
+ title: 'Axis Breaks',
28
26
  xAxis: {
29
- title: "일일 Daily fat",
30
- categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
31
- grid: true
27
+ title: '일일 Daily fat',
28
+ categories: [
29
+ 'Jan',
30
+ 'Feb',
31
+ 'Mar',
32
+ 'Apr',
33
+ 'May',
34
+ 'Jun',
35
+ 'Jul',
36
+ 'Aug',
37
+ 'Sep',
38
+ 'Oct',
39
+ 'Nov',
40
+ 'Dec',
41
+ ],
42
+ grid: true,
32
43
  },
33
44
  yAxis: {
34
- title: "Vertical 수직축 Axis",
35
- break: [{
36
- from: 500,
37
- to: 3000,
38
- inclusive: false,
39
- space: 5
40
- }]
45
+ title: 'Vertical 수직축 Axis',
46
+ break: [
47
+ {
48
+ from: 500,
49
+ to: 3000,
50
+ inclusive: false,
51
+ space: 5,
52
+ },
53
+ ],
41
54
  },
42
- series: [{
43
- name: 'column1',
44
- pointLabel: true,
45
- data: [499, 128, 180, 345, 3050, 3590, 3840, 3630, 3120, 520, 240, 80]
46
- }, {
47
- name: 'column3',
48
- pointLabel: true,
49
- data: [64, 138, 164, 408, 3120, 3540, 3875, 3420, 720, 320, 160, 20]
50
- }]
55
+ series: [
56
+ {
57
+ name: 'column1',
58
+ pointLabel: true,
59
+ data: [499, 128, 180, 345, 3050, 3590, 3840, 3630, 3120, 520, 240, 80],
60
+ },
61
+ {
62
+ name: 'column3',
63
+ pointLabel: true,
64
+ data: [64, 138, 164, 408, 3120, 3540, 3875, 3420, 720, 320, 160, 20],
65
+ },
66
+ ],
51
67
  };
52
68
  const chart = RealChart.createChart(document, 'realchart', config);
53
69
  ```
70
+
54
71
  ### styles
55
72
 
56
73
  - The themes are located in './dist'
@@ -63,9 +80,13 @@ import 'realchart/dist/realchart-style.css';
63
80
 
64
81
  - index.esm.js for ES
65
82
  - index.js for umd
83
+
66
84
  ## Exmaple
67
85
 
86
+ ### fiddle url
87
+
88
+ `https://jsfiddle.net/gh/get/library/pure/realgrid/realchart-demo/tree/master/`
68
89
 
69
90
  ## Asking Questions
70
91
 
71
- > support@realgrid.com
92
+ > support@realgrid.com
package/dist/index.d.ts CHANGED
@@ -1,75 +1,3 @@
1
- declare class DatetimeFormatter {
2
- private static readonly Formatters;
3
- static getFormatter(format: string): DatetimeFormatter;
4
- static get Default(): DatetimeFormatter;
5
- private _format;
6
- private _baseYear;
7
- private _preserveTime;
8
- private _tokens;
9
- private _hasAmPm;
10
- private _formatString;
11
- constructor(format: string);
12
- get format(): string;
13
- get formatString(): string;
14
- set formatString(value: string);
15
- toStr(date: Date, startOfWeek: number): string;
16
- private parseDateFormatTokens;
17
- private parse;
18
- }
19
-
20
- declare class NumberFormatter {
21
- static readonly DEFAULT_FORMAT = "";
22
- private static readonly Formatters;
23
- static getFormatter(format: string): NumberFormatter;
24
- static get Default(): NumberFormatter;
25
- private _format;
26
- private _options;
27
- constructor(format: string);
28
- get format(): string;
29
- toStr(value: number | bigint): string;
30
- private $_parse;
31
- }
32
-
33
- interface ISize {
34
- width: number;
35
- height: number;
36
- }
37
-
38
- interface IRect {
39
- x: number;
40
- y: number;
41
- width: number;
42
- height: number;
43
- }
44
-
45
- declare class Sides {
46
- top: number;
47
- bottom: number;
48
- left: number;
49
- right: number;
50
- static readonly Empty: Readonly<Sides>;
51
- static Temp: Sides;
52
- static create(top: number, bottom?: number, left?: number, right?: number): Sides;
53
- static createFrom(value: string): Sides;
54
- constructor(top?: number, bottom?: number, left?: number, right?: number);
55
- clone(): Sides;
56
- applyPadding(cs: CSSStyleDeclaration): Sides;
57
- applyMargin(cs: CSSStyleDeclaration): Sides;
58
- shrink(r: IRect): IRect;
59
- }
60
-
61
- declare class TextFormatter {
62
- private static readonly Formatters;
63
- static getFormatter(format: string): TextFormatter;
64
- private _format;
65
- private _pattern;
66
- private _replace;
67
- constructor(format: string);
68
- get format(): string;
69
- toStr(text: string): string;
70
- $_parse(fmt: string): void;
71
- }
72
-
73
1
  type Path = string | any[];
74
2
  type RtPercentSize = string | number;
75
3
  interface SVGStyles {
@@ -150,6 +78,85 @@ interface IAnnotationAnimation {
150
78
  type: string;
151
79
  duration?: number;
152
80
  }
81
+ declare enum ExportType {
82
+ PNG = "png",
83
+ JPEG = "jpeg",
84
+ SVG = "svg",
85
+ PDF = "pdf",
86
+ PRINT = "print"
87
+ }
88
+
89
+ declare class DatetimeFormatter {
90
+ private static readonly Formatters;
91
+ static getFormatter(format: string): DatetimeFormatter;
92
+ static get Default(): DatetimeFormatter;
93
+ private _format;
94
+ private _baseYear;
95
+ private _preserveTime;
96
+ private _tokens;
97
+ private _hasAmPm;
98
+ private _formatString;
99
+ constructor(format: string);
100
+ get format(): string;
101
+ get formatString(): string;
102
+ set formatString(value: string);
103
+ toStr(date: Date, startOfWeek: number): string;
104
+ private parseDateFormatTokens;
105
+ private parse;
106
+ }
107
+
108
+ declare class NumberFormatter {
109
+ static readonly DEFAULT_FORMAT = "";
110
+ private static readonly Formatters;
111
+ static getFormatter(format: string): NumberFormatter;
112
+ static get Default(): NumberFormatter;
113
+ private _format;
114
+ private _options;
115
+ constructor(format: string);
116
+ get format(): string;
117
+ toStr(value: number | bigint): string;
118
+ private $_parse;
119
+ }
120
+
121
+ interface ISize {
122
+ width: number;
123
+ height: number;
124
+ }
125
+
126
+ interface IRect {
127
+ x: number;
128
+ y: number;
129
+ width: number;
130
+ height: number;
131
+ }
132
+
133
+ declare class Sides {
134
+ top: number;
135
+ bottom: number;
136
+ left: number;
137
+ right: number;
138
+ static readonly Empty: Readonly<Sides>;
139
+ static Temp: Sides;
140
+ static create(top: number, bottom?: number, left?: number, right?: number): Sides;
141
+ static createFrom(value: string): Sides;
142
+ constructor(top?: number, bottom?: number, left?: number, right?: number);
143
+ clone(): Sides;
144
+ applyPadding(cs: CSSStyleDeclaration): Sides;
145
+ applyMargin(cs: CSSStyleDeclaration): Sides;
146
+ shrink(r: IRect): IRect;
147
+ }
148
+
149
+ declare class TextFormatter {
150
+ private static readonly Formatters;
151
+ static getFormatter(format: string): TextFormatter;
152
+ private _format;
153
+ private _pattern;
154
+ private _replace;
155
+ constructor(format: string);
156
+ get format(): string;
157
+ toStr(text: string): string;
158
+ $_parse(fmt: string): void;
159
+ }
153
160
 
154
161
  declare abstract class RcObject {
155
162
  static destroy(obj: RcObject): null;
@@ -366,10 +373,15 @@ declare class RcElement extends RcObject {
366
373
  appendDom(dom: Node): Node;
367
374
  insertDom(dom: Node, before: Node): Node;
368
375
  clearDom(): void;
376
+ private _saveStyle;
377
+ private _saveClass;
378
+ saveStyles(): void;
379
+ restoreStyles(): void;
369
380
  internalClearStyles(): void;
370
381
  clearStyles(): boolean;
371
382
  clearStyle(props: string[]): boolean;
372
383
  internalSetStyles(styles: any): void;
384
+ internalImportantStylesOrClass(style: any): void;
373
385
  setStyles(styles: any): boolean;
374
386
  resetStyles(styles: any): boolean;
375
387
  protected _resetClass(): void;
@@ -389,6 +401,7 @@ declare class RcElement extends RcObject {
389
401
  setData(data: string, value?: string): void;
390
402
  unsetData(data: string): void;
391
403
  setBoolData(data: string, value: boolean): void;
404
+ hasData(data: string): boolean;
392
405
  removeLater(delay: number, callback?: (v: RcElement) => void): RcElement;
393
406
  hide(delay: number): RcElement;
394
407
  clipRect(x: number, y: number, width: number, height: number, rd?: number): ClipRectElement;
@@ -664,7 +677,7 @@ declare abstract class Annotation extends ChartItem {
664
677
  _y: number;
665
678
  _w: number;
666
679
  _h: number;
667
- constructor(chart: IChart, inBody: boolean);
680
+ constructor(chart: IChart, name: string, inBody: boolean);
668
681
  abstract _type(): string;
669
682
  front: boolean;
670
683
  name: string;
@@ -808,9 +821,9 @@ interface ILegendSource {
808
821
  legendLabel(): string;
809
822
  }
810
823
 
811
- declare enum TooltipLevel {
812
- AUTO = "auto",
813
- SERIES = "series",
824
+ declare enum TooltipScope {
825
+ HOVER = "hover",
826
+ POINT = "point",
814
827
  GROUP = "group",
815
828
  AXIS = "axis"
816
829
  }
@@ -820,7 +833,7 @@ interface ITooltipContext {
820
833
  }
821
834
  interface ITooltipOwner {
822
835
  chart: IChart;
823
- getTooltipContext(level: TooltipLevel, series: ISeries, point: DataPoint): ITooltipContext;
836
+ getTooltipContext(level: TooltipScope, series: ISeries, point: DataPoint): ITooltipContext;
824
837
  }
825
838
  declare class Tooltip extends ChartItem {
826
839
  owner: ITooltipOwner;
@@ -830,9 +843,10 @@ declare class Tooltip extends ChartItem {
830
843
  private _ctx;
831
844
  private _series;
832
845
  private _point;
846
+ private _siblings;
833
847
  private _domain;
834
848
  constructor(owner: ITooltipOwner);
835
- level: TooltipLevel;
849
+ scope: TooltipScope;
836
850
  html: string;
837
851
  text: string;
838
852
  offset: number;
@@ -844,7 +858,7 @@ declare class Tooltip extends ChartItem {
844
858
  set numberFormat(value: string);
845
859
  get timeFormat(): string;
846
860
  set timeFormat(value: string);
847
- setTarget(series: ISeries, point: DataPoint): ITooltipContext;
861
+ setTarget(series: ISeries, point: DataPoint, siblings: DataPoint[]): ITooltipContext;
848
862
  getTextDomain(): IRichTextDomain;
849
863
  protected _doLoadSimple(source: any): boolean;
850
864
  }
@@ -960,6 +974,7 @@ interface ISeries extends IPlottingItem {
960
974
  colorField: string | number;
961
975
  color: string | number;
962
976
  displayName(): string;
977
+ isMarker(): boolean;
963
978
  initPoints(source: any[]): DataPoint[];
964
979
  getPoints(): DataPointCollection;
965
980
  isVisible(p: DataPoint): boolean;
@@ -987,6 +1002,10 @@ interface IDataPointCallbackArgs {
987
1002
  type PointStyleCallback = (args: IDataPointCallbackArgs) => SVGStyleOrClass;
988
1003
  type PointClickCallback = (args: IDataPointCallbackArgs) => boolean;
989
1004
  type PointHoverCallback = (args: IDataPointCallbackArgs) => void;
1005
+ declare enum HoverEffect {
1006
+ NONE = "none",
1007
+ DEFAULT = "default"
1008
+ }
990
1009
  declare abstract class Series extends ChartItem implements ISeries, IChartDataListener, ILegendSource, ITooltipContext {
991
1010
  static readonly LEGEND_MARKER = "rct-legend-item-marker";
992
1011
  static _loadSeries(chart: IChart, src: any, defType?: string): Series;
@@ -1065,6 +1084,8 @@ declare abstract class Series extends ChartItem implements ISeries, IChartDataLi
1065
1084
  tooltipText: string;
1066
1085
  tooltipCallback: (args: any) => string;
1067
1086
  loadAnimation: SeriesLoadAnimation;
1087
+ hoverEffect: HoverEffect;
1088
+ hoverStyle: SVGStyleOrClass;
1068
1089
  pointStyleCallback: PointStyleCallback;
1069
1090
  onPointClick: PointClickCallback;
1070
1091
  onPointHover: PointHoverCallback;
@@ -1079,6 +1100,7 @@ declare abstract class Series extends ChartItem implements ISeries, IChartDataLi
1079
1100
  hasZ(): boolean;
1080
1101
  defaultYAxisType(): string;
1081
1102
  isClusterable(): boolean;
1103
+ isMarker(): boolean;
1082
1104
  displayName(): string;
1083
1105
  legendMarker(doc: Document, size: number): RcElement;
1084
1106
  legendColor(): string;
@@ -1304,7 +1326,6 @@ declare class DataPoint {
1304
1326
  parse(series: ISeries): void;
1305
1327
  getLabelValue(index: number): any;
1306
1328
  swap(): void;
1307
- getTooltipPos(): IPoint;
1308
1329
  updateValues(series: ISeries, values: any): any;
1309
1330
  getTooltip(param: string): any;
1310
1331
  initValues(): void;
@@ -1591,6 +1612,17 @@ declare class Credits extends ChartItem {
1591
1612
  gap: number;
1592
1613
  isFloating(): boolean;
1593
1614
  }
1615
+ declare enum PointHoverScope {
1616
+ AUTO = "auto",
1617
+ POINT = "point",
1618
+ GROUP = "group",
1619
+ AXIS = "axis"
1620
+ }
1621
+ declare class PointHovering extends ChartItem {
1622
+ scope: PointHoverScope;
1623
+ hintDistance: number;
1624
+ getScope(series: ISeries, p: DataPoint): PointHoverScope;
1625
+ }
1594
1626
  declare class ChartOptions extends ChartItem {
1595
1627
  theme: string;
1596
1628
  palette: string;
@@ -1601,13 +1633,8 @@ declare class ChartOptions extends ChartItem {
1601
1633
  axisGap: number;
1602
1634
  credits: Credits;
1603
1635
  seriesHovering: boolean;
1604
- }
1605
- declare enum ExportType {
1606
- PNG = "png",
1607
- JPEG = "jpeg",
1608
- SVG = "svg",
1609
- PDF = "pdf",
1610
- PRINT = "print"
1636
+ pointHovering: PointHovering;
1637
+ getXStart(axis: IAxis): number | string;
1611
1638
  }
1612
1639
  interface IExportOptions {
1613
1640
  visible?: boolean;
@@ -1632,25 +1659,22 @@ declare class CrosshairFlag extends ChartItem {
1632
1659
  textStyles: SVGStyleOrClass;
1633
1660
  minWidth: number;
1634
1661
  }
1635
- interface ICrosshairCallbackArgs {
1636
- axis: object;
1637
- pos: number;
1638
- flag: string;
1639
- }
1640
1662
  declare class Crosshair extends ChartItem {
1641
1663
  axis: IAxis;
1642
- readonly flag: CrosshairFlag;
1643
- _args: ICrosshairCallbackArgs;
1664
+ private _args;
1644
1665
  constructor(axis: IAxis);
1666
+ readonly flag: CrosshairFlag;
1645
1667
  type: CrosshairType;
1646
1668
  showAlways: boolean;
1647
1669
  followPointer: boolean;
1648
1670
  numberFormat: string;
1649
1671
  timeFormat: string;
1650
1672
  onChange: any;
1673
+ markerHovering: boolean;
1651
1674
  isBar(): boolean;
1652
1675
  getFlag(length: number, pos: number): string;
1653
1676
  moved(pos: number, flag: string): void;
1677
+ _setAxis(axis: any): void;
1654
1678
  protected _doLoadSimple(source: any): boolean;
1655
1679
  }
1656
1680
 
@@ -1666,6 +1690,7 @@ interface IAxis {
1666
1690
  reversed: boolean;
1667
1691
  _vlen: number;
1668
1692
  _zoom: IAxisZoom;
1693
+ crosshair: Crosshair;
1669
1694
  continuous(): boolean;
1670
1695
  getBaseValue(): number;
1671
1696
  axisMax(): number;
@@ -1890,7 +1915,7 @@ declare abstract class Axis extends ChartItem implements IAxis {
1890
1915
  label: AxisLabel;
1891
1916
  grid: AxisGrid;
1892
1917
  readonly guides: AxisGuide[];
1893
- readonly crosshair: Crosshair;
1918
+ readonly crosshair: any;
1894
1919
  readonly scrollBar: AxisScrollBar;
1895
1920
  row: number;
1896
1921
  col: number;
@@ -1929,6 +1954,7 @@ declare abstract class Axis extends ChartItem implements IAxis {
1929
1954
  isBased(): boolean;
1930
1955
  isBaseVisible(): boolean;
1931
1956
  disconnect(): void;
1957
+ getSeries(): ISeries[];
1932
1958
  collectValues(): void;
1933
1959
  collectRanges(): void;
1934
1960
  collectReferentsValues(): void;
@@ -2097,19 +2123,14 @@ declare class RcLegend extends RcChartObject {
2097
2123
  declare class RcBody extends RcChartObject {
2098
2124
  }
2099
2125
 
2100
- declare enum ImageType {
2101
- PNG = "png",
2102
- JPEG = "jpeg"
2103
- }
2104
2126
  declare class RcChartControl {
2105
2127
  private $_p;
2106
2128
  private _objects;
2107
2129
  private _proxy;
2108
- private _exporter;
2109
2130
  private constructor();
2110
2131
  destroy(): void;
2111
- load(config: any, animate?: boolean, callback?: () => void): void;
2112
- render(now?: boolean): void;
2132
+ load(config: any, animate?: boolean, callback?: () => void): RcChartControl;
2133
+ render(): void;
2113
2134
  get xAxis(): RcChartAxis;
2114
2135
  getXAxis(name: string | number): RcChartAxis;
2115
2136
  get yAxis(): RcChartAxis;
@@ -2131,7 +2152,7 @@ declare class RcChartControl {
2131
2152
  setParam(param: string, value: any, redraw?: boolean): void;
2132
2153
  addSeries(source: any, animate?: boolean): RcChartSeries | undefined;
2133
2154
  removeSeries(series: string | RcChartSeries, animate?: boolean): RcChartSeries | undefined;
2134
- exportImage(type?: ImageType): void;
2155
+ export(type?: ExportType): void;
2135
2156
  }
2136
2157
 
2137
2158
  declare class RcChartData {
@@ -2183,4 +2204,4 @@ declare const setAnimatable: typeof Globals.setAnimatable;
2183
2204
  declare const createChart: typeof Globals.createChart;
2184
2205
  declare const createData: typeof Globals.createData;
2185
2206
 
2186
- export { RcAnnotation, RcBody, RcChartAxis, RcChartControl, RcChartData, RcChartGauge, RcChartObject, RcChartSeries, RcGaugeGroup, RcLegend, RcNamedObject, RcSeriesGroup, RcSubtitle, RcTitle, createChart, createData, getVersion, setAnimatable, setDebugging, setLogging };
2207
+ export { IRcChartDataOptions, RcAnnotation, RcBody, RcChartAxis, RcChartControl, RcChartData, RcChartGauge, RcChartObject, RcChartSeries, RcGaugeGroup, RcLegend, RcNamedObject, RcSeriesGroup, RcSubtitle, RcTitle, createChart, createData, getVersion, setAnimatable, setDebugging, setLogging };