realchart 0.9.42 → 1.0.0

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;
@@ -702,11 +715,6 @@ declare class ZoomButton extends ChartItem {
702
715
  constructor(body: Body);
703
716
  isVisible(): boolean;
704
717
  }
705
- declare class BodySplit extends ChartItem {
706
- body: Body;
707
- constructor(body: Body);
708
- size: number;
709
- }
710
718
  interface IPolar {
711
719
  start: number;
712
720
  total: number;
@@ -726,7 +734,6 @@ declare class Body extends ChartItem {
726
734
  private _cx;
727
735
  private _cy;
728
736
  constructor(chart: IChart);
729
- split: BodySplit;
730
737
  get radius(): RtPercentSize;
731
738
  set radius(value: RtPercentSize);
732
739
  innerRadius: RtPercentSize;
@@ -738,6 +745,7 @@ declare class Body extends ChartItem {
738
745
  image: BackgroundImage;
739
746
  zoomType: ZoomType;
740
747
  zoomButton: ZoomButton;
748
+ base(): Body;
741
749
  canZoom(): boolean;
742
750
  calcRadius(width: number, height: number): number;
743
751
  setPolar(width: number, height: number): Body;
@@ -808,9 +816,9 @@ interface ILegendSource {
808
816
  legendLabel(): string;
809
817
  }
810
818
 
811
- declare enum TooltipLevel {
812
- AUTO = "auto",
813
- SERIES = "series",
819
+ declare enum TooltipScope {
820
+ HOVER = "hover",
821
+ POINT = "point",
814
822
  GROUP = "group",
815
823
  AXIS = "axis"
816
824
  }
@@ -820,7 +828,7 @@ interface ITooltipContext {
820
828
  }
821
829
  interface ITooltipOwner {
822
830
  chart: IChart;
823
- getTooltipContext(level: TooltipLevel, series: ISeries, point: DataPoint): ITooltipContext;
831
+ getTooltipContext(level: TooltipScope, series: ISeries, point: DataPoint): ITooltipContext;
824
832
  }
825
833
  declare class Tooltip extends ChartItem {
826
834
  owner: ITooltipOwner;
@@ -830,9 +838,10 @@ declare class Tooltip extends ChartItem {
830
838
  private _ctx;
831
839
  private _series;
832
840
  private _point;
841
+ private _siblings;
833
842
  private _domain;
834
843
  constructor(owner: ITooltipOwner);
835
- level: TooltipLevel;
844
+ scope: TooltipScope;
836
845
  html: string;
837
846
  text: string;
838
847
  offset: number;
@@ -840,11 +849,12 @@ declare class Tooltip extends ChartItem {
840
849
  minWidth: number;
841
850
  minHeight: number;
842
851
  followPointer: boolean;
852
+ nanText: string;
843
853
  get numberFormat(): string;
844
854
  set numberFormat(value: string);
845
855
  get timeFormat(): string;
846
856
  set timeFormat(value: string);
847
- setTarget(series: ISeries, point: DataPoint): ITooltipContext;
857
+ setTarget(series: ISeries, point: DataPoint, siblings: DataPoint[]): ITooltipContext;
848
858
  getTextDomain(): IRichTextDomain;
849
859
  protected _doLoadSimple(source: any): boolean;
850
860
  }
@@ -895,7 +905,7 @@ interface IPlottingItem {
895
905
  getVisiblePoints(): DataPoint[];
896
906
  getLegendSources(list: ILegendSource[]): void;
897
907
  needAxes(): boolean;
898
- isEmpty(visibleOnly: any): boolean;
908
+ isEmpty(visibleOnly: boolean): boolean;
899
909
  canCategorized(): boolean;
900
910
  defaultYAxisType(): string;
901
911
  isClusterable(): boolean;
@@ -960,6 +970,7 @@ interface ISeries extends IPlottingItem {
960
970
  colorField: string | number;
961
971
  color: string | number;
962
972
  displayName(): string;
973
+ isMarker(): boolean;
963
974
  initPoints(source: any[]): DataPoint[];
964
975
  getPoints(): DataPointCollection;
965
976
  isVisible(p: DataPoint): boolean;
@@ -987,6 +998,10 @@ interface IDataPointCallbackArgs {
987
998
  type PointStyleCallback = (args: IDataPointCallbackArgs) => SVGStyleOrClass;
988
999
  type PointClickCallback = (args: IDataPointCallbackArgs) => boolean;
989
1000
  type PointHoverCallback = (args: IDataPointCallbackArgs) => void;
1001
+ declare enum HoverEffect {
1002
+ NONE = "none",
1003
+ DEFAULT = "default"
1004
+ }
990
1005
  declare abstract class Series extends ChartItem implements ISeries, IChartDataListener, ILegendSource, ITooltipContext {
991
1006
  static readonly LEGEND_MARKER = "rct-legend-item-marker";
992
1007
  static _loadSeries(chart: IChart, src: any, defType?: string): Series;
@@ -1065,6 +1080,8 @@ declare abstract class Series extends ChartItem implements ISeries, IChartDataLi
1065
1080
  tooltipText: string;
1066
1081
  tooltipCallback: (args: any) => string;
1067
1082
  loadAnimation: SeriesLoadAnimation;
1083
+ hoverEffect: HoverEffect;
1084
+ hoverStyle: SVGStyleOrClass;
1068
1085
  pointStyleCallback: PointStyleCallback;
1069
1086
  onPointClick: PointClickCallback;
1070
1087
  onPointHover: PointHoverCallback;
@@ -1079,6 +1096,7 @@ declare abstract class Series extends ChartItem implements ISeries, IChartDataLi
1079
1096
  hasZ(): boolean;
1080
1097
  defaultYAxisType(): string;
1081
1098
  isClusterable(): boolean;
1099
+ isMarker(): boolean;
1082
1100
  displayName(): string;
1083
1101
  legendMarker(doc: Document, size: number): RcElement;
1084
1102
  legendColor(): string;
@@ -1304,7 +1322,6 @@ declare class DataPoint {
1304
1322
  parse(series: ISeries): void;
1305
1323
  getLabelValue(index: number): any;
1306
1324
  swap(): void;
1307
- getTooltipPos(): IPoint;
1308
1325
  updateValues(series: ISeries, values: any): any;
1309
1326
  getTooltip(param: string): any;
1310
1327
  initValues(): void;
@@ -1468,6 +1485,7 @@ declare abstract class GaugeLabel extends FormattableText {
1468
1485
  declare class PaneBody extends Body {
1469
1486
  pane: Pane;
1470
1487
  constructor(pane: Pane);
1488
+ base(): Body;
1471
1489
  }
1472
1490
  declare class Pane extends ChartItem {
1473
1491
  row: number;
@@ -1533,7 +1551,7 @@ interface IChart {
1533
1551
  _xPaneAxes: PaneXAxisMatrix;
1534
1552
  _yPaneAxes: PaneYAxisMatrix;
1535
1553
  options: ChartOptions;
1536
- exportOptions: IExportOptions;
1554
+ export: IExport;
1537
1555
  first: IPlottingItem;
1538
1556
  firstSeries: Series;
1539
1557
  xAxis: IAxis;
@@ -1591,6 +1609,18 @@ declare class Credits extends ChartItem {
1591
1609
  gap: number;
1592
1610
  isFloating(): boolean;
1593
1611
  }
1612
+ declare enum PointHoverScope {
1613
+ AUTO = "auto",
1614
+ POINT = "point",
1615
+ GROUP = "group",
1616
+ AXIS = "axis"
1617
+ }
1618
+ declare class PointHovering extends ChartItem {
1619
+ scope: PointHoverScope;
1620
+ hintDistance: number;
1621
+ getHintDistance(): number;
1622
+ getScope(series: ISeries, p: DataPoint): PointHoverScope;
1623
+ }
1594
1624
  declare class ChartOptions extends ChartItem {
1595
1625
  theme: string;
1596
1626
  palette: string;
@@ -1601,18 +1631,14 @@ declare class ChartOptions extends ChartItem {
1601
1631
  axisGap: number;
1602
1632
  credits: Credits;
1603
1633
  seriesHovering: boolean;
1634
+ pointHovering: PointHovering;
1635
+ getXStart(axis: IAxis): number | string;
1604
1636
  }
1605
- declare enum ExportType {
1606
- PNG = "png",
1607
- JPEG = "jpeg",
1608
- SVG = "svg",
1609
- PDF = "pdf",
1610
- PRINT = "print"
1611
- }
1612
- interface IExportOptions {
1637
+ interface IExport {
1613
1638
  visible?: boolean;
1614
- menus?: ExportType[];
1615
1639
  fileName?: string;
1640
+ useLibrary?: boolean;
1641
+ menus?: ExportType[];
1616
1642
  width?: number;
1617
1643
  scale?: number;
1618
1644
  url?: string;
@@ -1632,25 +1658,22 @@ declare class CrosshairFlag extends ChartItem {
1632
1658
  textStyles: SVGStyleOrClass;
1633
1659
  minWidth: number;
1634
1660
  }
1635
- interface ICrosshairCallbackArgs {
1636
- axis: object;
1637
- pos: number;
1638
- flag: string;
1639
- }
1640
1661
  declare class Crosshair extends ChartItem {
1641
1662
  axis: IAxis;
1642
- readonly flag: CrosshairFlag;
1643
- _args: ICrosshairCallbackArgs;
1663
+ private _args;
1644
1664
  constructor(axis: IAxis);
1665
+ readonly flag: CrosshairFlag;
1645
1666
  type: CrosshairType;
1646
1667
  showAlways: boolean;
1647
1668
  followPointer: boolean;
1648
1669
  numberFormat: string;
1649
1670
  timeFormat: string;
1650
1671
  onChange: any;
1672
+ markerHovering: boolean;
1651
1673
  isBar(): boolean;
1652
1674
  getFlag(length: number, pos: number): string;
1653
1675
  moved(pos: number, flag: string): void;
1676
+ _setAxis(axis: any): void;
1654
1677
  protected _doLoadSimple(source: any): boolean;
1655
1678
  }
1656
1679
 
@@ -1666,6 +1689,7 @@ interface IAxis {
1666
1689
  reversed: boolean;
1667
1690
  _vlen: number;
1668
1691
  _zoom: IAxisZoom;
1692
+ crosshair: Crosshair;
1669
1693
  continuous(): boolean;
1670
1694
  getBaseValue(): number;
1671
1695
  axisMax(): number;
@@ -1890,7 +1914,7 @@ declare abstract class Axis extends ChartItem implements IAxis {
1890
1914
  label: AxisLabel;
1891
1915
  grid: AxisGrid;
1892
1916
  readonly guides: AxisGuide[];
1893
- readonly crosshair: Crosshair;
1917
+ readonly crosshair: any;
1894
1918
  readonly scrollBar: AxisScrollBar;
1895
1919
  row: number;
1896
1920
  col: number;
@@ -1929,6 +1953,7 @@ declare abstract class Axis extends ChartItem implements IAxis {
1929
1953
  isBased(): boolean;
1930
1954
  isBaseVisible(): boolean;
1931
1955
  disconnect(): void;
1956
+ getSeries(): ISeries[];
1932
1957
  collectValues(): void;
1933
1958
  collectRanges(): void;
1934
1959
  collectReferentsValues(): void;
@@ -2097,19 +2122,14 @@ declare class RcLegend extends RcChartObject {
2097
2122
  declare class RcBody extends RcChartObject {
2098
2123
  }
2099
2124
 
2100
- declare enum ImageType {
2101
- PNG = "png",
2102
- JPEG = "jpeg"
2103
- }
2104
2125
  declare class RcChartControl {
2105
2126
  private $_p;
2106
2127
  private _objects;
2107
2128
  private _proxy;
2108
- private _exporter;
2109
2129
  private constructor();
2110
2130
  destroy(): void;
2111
- load(config: any, animate?: boolean, callback?: () => void): void;
2112
- render(now?: boolean): void;
2131
+ load(config: any, animate?: boolean, callback?: () => void): RcChartControl;
2132
+ render(): void;
2113
2133
  get xAxis(): RcChartAxis;
2114
2134
  getXAxis(name: string | number): RcChartAxis;
2115
2135
  get yAxis(): RcChartAxis;
@@ -2131,7 +2151,11 @@ declare class RcChartControl {
2131
2151
  setParam(param: string, value: any, redraw?: boolean): void;
2132
2152
  addSeries(source: any, animate?: boolean): RcChartSeries | undefined;
2133
2153
  removeSeries(series: string | RcChartSeries, animate?: boolean): RcChartSeries | undefined;
2134
- exportImage(type?: ImageType): void;
2154
+ export(options: IRcExportOptions): void;
2155
+ }
2156
+ interface IRcExportOptions {
2157
+ type?: ExportType;
2158
+ fileName?: string;
2135
2159
  }
2136
2160
 
2137
2161
  declare class RcChartData {
@@ -2183,4 +2207,4 @@ declare const setAnimatable: typeof Globals.setAnimatable;
2183
2207
  declare const createChart: typeof Globals.createChart;
2184
2208
  declare const createData: typeof Globals.createData;
2185
2209
 
2186
- export { RcAnnotation, RcBody, RcChartAxis, RcChartControl, RcChartData, RcChartGauge, RcChartObject, RcChartSeries, RcGaugeGroup, RcLegend, RcNamedObject, RcSeriesGroup, RcSubtitle, RcTitle, createChart, createData, getVersion, setAnimatable, setDebugging, setLogging };
2210
+ export { IRcChartDataOptions, IRcExportOptions, RcAnnotation, RcBody, RcChartAxis, RcChartControl, RcChartData, RcChartGauge, RcChartObject, RcChartSeries, RcGaugeGroup, RcLegend, RcNamedObject, RcSeriesGroup, RcSubtitle, RcTitle, createChart, createData, getVersion, setAnimatable, setDebugging, setLogging };