realchart 0.9.41 → 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;
@@ -218,6 +225,7 @@ declare abstract class RcControl extends RcObject {
218
225
  height(): number;
219
226
  contentWidth(): number;
220
227
  contentHeight(): number;
228
+ contentRight(): number;
221
229
  clipContainer(): SVGElement;
222
230
  setData(data: string, value: any, container?: boolean): void;
223
231
  clearDefs(): void;
@@ -365,10 +373,15 @@ declare class RcElement extends RcObject {
365
373
  appendDom(dom: Node): Node;
366
374
  insertDom(dom: Node, before: Node): Node;
367
375
  clearDom(): void;
376
+ private _saveStyle;
377
+ private _saveClass;
378
+ saveStyles(): void;
379
+ restoreStyles(): void;
368
380
  internalClearStyles(): void;
369
381
  clearStyles(): boolean;
370
382
  clearStyle(props: string[]): boolean;
371
383
  internalSetStyles(styles: any): void;
384
+ internalImportantStylesOrClass(style: any): void;
372
385
  setStyles(styles: any): boolean;
373
386
  resetStyles(styles: any): boolean;
374
387
  protected _resetClass(): void;
@@ -388,6 +401,7 @@ declare class RcElement extends RcObject {
388
401
  setData(data: string, value?: string): void;
389
402
  unsetData(data: string): void;
390
403
  setBoolData(data: string, value: boolean): void;
404
+ hasData(data: string): boolean;
391
405
  removeLater(delay: number, callback?: (v: RcElement) => void): RcElement;
392
406
  hide(delay: number): RcElement;
393
407
  clipRect(x: number, y: number, width: number, height: number, rd?: number): ClipRectElement;
@@ -663,7 +677,7 @@ declare abstract class Annotation extends ChartItem {
663
677
  _y: number;
664
678
  _w: number;
665
679
  _h: number;
666
- constructor(chart: IChart, inBody: boolean);
680
+ constructor(chart: IChart, name: string, inBody: boolean);
667
681
  abstract _type(): string;
668
682
  front: boolean;
669
683
  name: string;
@@ -807,9 +821,9 @@ interface ILegendSource {
807
821
  legendLabel(): string;
808
822
  }
809
823
 
810
- declare enum TooltipLevel {
811
- AUTO = "auto",
812
- SERIES = "series",
824
+ declare enum TooltipScope {
825
+ HOVER = "hover",
826
+ POINT = "point",
813
827
  GROUP = "group",
814
828
  AXIS = "axis"
815
829
  }
@@ -819,7 +833,7 @@ interface ITooltipContext {
819
833
  }
820
834
  interface ITooltipOwner {
821
835
  chart: IChart;
822
- getTooltipContext(level: TooltipLevel, series: ISeries, point: DataPoint): ITooltipContext;
836
+ getTooltipContext(level: TooltipScope, series: ISeries, point: DataPoint): ITooltipContext;
823
837
  }
824
838
  declare class Tooltip extends ChartItem {
825
839
  owner: ITooltipOwner;
@@ -829,9 +843,10 @@ declare class Tooltip extends ChartItem {
829
843
  private _ctx;
830
844
  private _series;
831
845
  private _point;
846
+ private _siblings;
832
847
  private _domain;
833
848
  constructor(owner: ITooltipOwner);
834
- level: TooltipLevel;
849
+ scope: TooltipScope;
835
850
  html: string;
836
851
  text: string;
837
852
  offset: number;
@@ -843,7 +858,7 @@ declare class Tooltip extends ChartItem {
843
858
  set numberFormat(value: string);
844
859
  get timeFormat(): string;
845
860
  set timeFormat(value: string);
846
- setTarget(series: ISeries, point: DataPoint): ITooltipContext;
861
+ setTarget(series: ISeries, point: DataPoint, siblings: DataPoint[]): ITooltipContext;
847
862
  getTextDomain(): IRichTextDomain;
848
863
  protected _doLoadSimple(source: any): boolean;
849
864
  }
@@ -959,6 +974,7 @@ interface ISeries extends IPlottingItem {
959
974
  colorField: string | number;
960
975
  color: string | number;
961
976
  displayName(): string;
977
+ isMarker(): boolean;
962
978
  initPoints(source: any[]): DataPoint[];
963
979
  getPoints(): DataPointCollection;
964
980
  isVisible(p: DataPoint): boolean;
@@ -985,6 +1001,11 @@ interface IDataPointCallbackArgs {
985
1001
  }
986
1002
  type PointStyleCallback = (args: IDataPointCallbackArgs) => SVGStyleOrClass;
987
1003
  type PointClickCallback = (args: IDataPointCallbackArgs) => boolean;
1004
+ type PointHoverCallback = (args: IDataPointCallbackArgs) => void;
1005
+ declare enum HoverEffect {
1006
+ NONE = "none",
1007
+ DEFAULT = "default"
1008
+ }
988
1009
  declare abstract class Series extends ChartItem implements ISeries, IChartDataListener, ILegendSource, ITooltipContext {
989
1010
  static readonly LEGEND_MARKER = "rct-legend-item-marker";
990
1011
  static _loadSeries(chart: IChart, src: any, defType?: string): Series;
@@ -1063,8 +1084,11 @@ declare abstract class Series extends ChartItem implements ISeries, IChartDataLi
1063
1084
  tooltipText: string;
1064
1085
  tooltipCallback: (args: any) => string;
1065
1086
  loadAnimation: SeriesLoadAnimation;
1087
+ hoverEffect: HoverEffect;
1088
+ hoverStyle: SVGStyleOrClass;
1066
1089
  pointStyleCallback: PointStyleCallback;
1067
1090
  onPointClick: PointClickCallback;
1091
+ onPointHover: PointHoverCallback;
1068
1092
  contains(p: DataPoint): boolean;
1069
1093
  getPoints(): DataPointCollection;
1070
1094
  getLabeledPoints(): DataPoint[];
@@ -1076,6 +1100,7 @@ declare abstract class Series extends ChartItem implements ISeries, IChartDataLi
1076
1100
  hasZ(): boolean;
1077
1101
  defaultYAxisType(): string;
1078
1102
  isClusterable(): boolean;
1103
+ isMarker(): boolean;
1079
1104
  displayName(): string;
1080
1105
  legendMarker(doc: Document, size: number): RcElement;
1081
1106
  legendColor(): string;
@@ -1122,6 +1147,7 @@ declare abstract class Series extends ChartItem implements ISeries, IChartDataLi
1122
1147
  getPointStyle(p: DataPoint): any;
1123
1148
  getPointLabelStyle(p: DataPoint): any;
1124
1149
  pointClicked(p: DataPoint): boolean;
1150
+ pointHovered(p: DataPoint): void;
1125
1151
  getViewRangeAxis(): 'x' | 'y' | 'z';
1126
1152
  isPointLabelsVisible(): boolean;
1127
1153
  isPointLabelVisible(p: DataPoint): boolean;
@@ -1300,7 +1326,6 @@ declare class DataPoint {
1300
1326
  parse(series: ISeries): void;
1301
1327
  getLabelValue(index: number): any;
1302
1328
  swap(): void;
1303
- getTooltipPos(): IPoint;
1304
1329
  updateValues(series: ISeries, values: any): any;
1305
1330
  getTooltip(param: string): any;
1306
1331
  initValues(): void;
@@ -1587,6 +1612,17 @@ declare class Credits extends ChartItem {
1587
1612
  gap: number;
1588
1613
  isFloating(): boolean;
1589
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
+ }
1590
1626
  declare class ChartOptions extends ChartItem {
1591
1627
  theme: string;
1592
1628
  palette: string;
@@ -1597,13 +1633,8 @@ declare class ChartOptions extends ChartItem {
1597
1633
  axisGap: number;
1598
1634
  credits: Credits;
1599
1635
  seriesHovering: boolean;
1600
- }
1601
- declare enum ExportType {
1602
- PNG = "png",
1603
- JPEG = "jpeg",
1604
- SVG = "svg",
1605
- PDF = "pdf",
1606
- PRINT = "print"
1636
+ pointHovering: PointHovering;
1637
+ getXStart(axis: IAxis): number | string;
1607
1638
  }
1608
1639
  interface IExportOptions {
1609
1640
  visible?: boolean;
@@ -1628,25 +1659,22 @@ declare class CrosshairFlag extends ChartItem {
1628
1659
  textStyles: SVGStyleOrClass;
1629
1660
  minWidth: number;
1630
1661
  }
1631
- interface ICrosshairCallbackArgs {
1632
- axis: object;
1633
- pos: number;
1634
- flag: string;
1635
- }
1636
1662
  declare class Crosshair extends ChartItem {
1637
1663
  axis: IAxis;
1638
- readonly flag: CrosshairFlag;
1639
- _args: ICrosshairCallbackArgs;
1664
+ private _args;
1640
1665
  constructor(axis: IAxis);
1666
+ readonly flag: CrosshairFlag;
1641
1667
  type: CrosshairType;
1642
1668
  showAlways: boolean;
1643
1669
  followPointer: boolean;
1644
1670
  numberFormat: string;
1645
1671
  timeFormat: string;
1646
1672
  onChange: any;
1673
+ markerHovering: boolean;
1647
1674
  isBar(): boolean;
1648
1675
  getFlag(length: number, pos: number): string;
1649
1676
  moved(pos: number, flag: string): void;
1677
+ _setAxis(axis: any): void;
1650
1678
  protected _doLoadSimple(source: any): boolean;
1651
1679
  }
1652
1680
 
@@ -1662,6 +1690,7 @@ interface IAxis {
1662
1690
  reversed: boolean;
1663
1691
  _vlen: number;
1664
1692
  _zoom: IAxisZoom;
1693
+ crosshair: Crosshair;
1665
1694
  continuous(): boolean;
1666
1695
  getBaseValue(): number;
1667
1696
  axisMax(): number;
@@ -1763,6 +1792,11 @@ interface IAxisLabelArgs {
1763
1792
  index: number;
1764
1793
  value: number;
1765
1794
  }
1795
+ declare enum AxisLabelOverflow {
1796
+ HIDDEN = "hidden",
1797
+ PULL = "pull",
1798
+ FIT = "fit"
1799
+ }
1766
1800
  declare abstract class AxisLabel extends IconedText {
1767
1801
  axis: Axis;
1768
1802
  _paramTick: IAxisTick;
@@ -1779,6 +1813,9 @@ declare abstract class AxisLabel extends IconedText {
1779
1813
  lastText: string;
1780
1814
  firstStyle: SVGStyleOrClass;
1781
1815
  lastStyle: SVGStyleOrClass;
1816
+ firstOverflow: AxisLabelOverflow;
1817
+ lastOverflow: AxisLabelOverflow;
1818
+ overflowGap: number;
1782
1819
  textCallback: (args: IAxisLabelArgs) => string;
1783
1820
  styleCallback: (args: IAxisLabelArgs) => SVGStyleOrClass;
1784
1821
  iconCallback: (args: IAxisLabelArgs) => string;
@@ -1868,16 +1905,17 @@ declare abstract class Axis extends ChartItem implements IAxis {
1868
1905
  _zooming: boolean;
1869
1906
  _animating(): boolean;
1870
1907
  constructor(chart: IChart, isX: boolean, name?: string);
1908
+ init(): Axis;
1871
1909
  abstract _type(): string;
1872
1910
  readonly name: string;
1873
- readonly title: AxisTitle;
1874
- readonly line: AxisLine;
1875
- readonly sectorLine: AxisSectorLine;
1876
- readonly tick: AxisTick;
1877
- readonly label: AxisLabel;
1878
- readonly grid: AxisGrid;
1911
+ title: AxisTitle;
1912
+ line: AxisLine;
1913
+ sectorLine: AxisSectorLine;
1914
+ tick: AxisTick;
1915
+ label: AxisLabel;
1916
+ grid: AxisGrid;
1879
1917
  readonly guides: AxisGuide[];
1880
- readonly crosshair: Crosshair;
1918
+ readonly crosshair: any;
1881
1919
  readonly scrollBar: AxisScrollBar;
1882
1920
  row: number;
1883
1921
  col: number;
@@ -1916,6 +1954,7 @@ declare abstract class Axis extends ChartItem implements IAxis {
1916
1954
  isBased(): boolean;
1917
1955
  isBaseVisible(): boolean;
1918
1956
  disconnect(): void;
1957
+ getSeries(): ISeries[];
1919
1958
  collectValues(): void;
1920
1959
  collectRanges(): void;
1921
1960
  collectReferentsValues(): void;
@@ -2084,19 +2123,14 @@ declare class RcLegend extends RcChartObject {
2084
2123
  declare class RcBody extends RcChartObject {
2085
2124
  }
2086
2125
 
2087
- declare enum ImageType {
2088
- PNG = "png",
2089
- JPEG = "jpeg"
2090
- }
2091
2126
  declare class RcChartControl {
2092
2127
  private $_p;
2093
2128
  private _objects;
2094
2129
  private _proxy;
2095
- private _exporter;
2096
2130
  private constructor();
2097
2131
  destroy(): void;
2098
- load(config: any, animate?: boolean, callback?: () => void): void;
2099
- render(now?: boolean): void;
2132
+ load(config: any, animate?: boolean, callback?: () => void): RcChartControl;
2133
+ render(): void;
2100
2134
  get xAxis(): RcChartAxis;
2101
2135
  getXAxis(name: string | number): RcChartAxis;
2102
2136
  get yAxis(): RcChartAxis;
@@ -2118,7 +2152,7 @@ declare class RcChartControl {
2118
2152
  setParam(param: string, value: any, redraw?: boolean): void;
2119
2153
  addSeries(source: any, animate?: boolean): RcChartSeries | undefined;
2120
2154
  removeSeries(series: string | RcChartSeries, animate?: boolean): RcChartSeries | undefined;
2121
- exportImage(type?: ImageType): void;
2155
+ export(type?: ExportType): void;
2122
2156
  }
2123
2157
 
2124
2158
  declare class RcChartData {
@@ -2170,4 +2204,4 @@ declare const setAnimatable: typeof Globals.setAnimatable;
2170
2204
  declare const createChart: typeof Globals.createChart;
2171
2205
  declare const createData: typeof Globals.createData;
2172
2206
 
2173
- 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 };