@operato/chart 7.0.36 → 7.0.39

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/src/editors/configurer.d.ts +4 -2
  3. package/dist/src/editors/configurer.js +24 -13
  4. package/dist/src/editors/configurer.js.map +1 -1
  5. package/dist/src/editors/input-chart-abstract.d.ts +0 -26
  6. package/dist/src/editors/input-chart-abstract.js +1 -607
  7. package/dist/src/editors/input-chart-abstract.js.map +1 -1
  8. package/dist/src/editors/input-chart-styles.js +27 -0
  9. package/dist/src/editors/input-chart-styles.js.map +1 -1
  10. package/dist/src/editors/ox-input-chart-hbar.d.ts +1 -1
  11. package/dist/src/editors/ox-input-chart-hbar.js +2 -69
  12. package/dist/src/editors/ox-input-chart-hbar.js.map +1 -1
  13. package/dist/src/editors/ox-input-chart-mixed.d.ts +1 -0
  14. package/dist/src/editors/ox-input-chart-mixed.js +2 -2
  15. package/dist/src/editors/ox-input-chart-mixed.js.map +1 -1
  16. package/dist/src/editors/ox-input-chart-pie.d.ts +1 -0
  17. package/dist/src/editors/ox-input-chart-pie.js +3 -1
  18. package/dist/src/editors/ox-input-chart-pie.js.map +1 -1
  19. package/dist/src/editors/ox-input-chart-radar.d.ts +1 -0
  20. package/dist/src/editors/ox-input-chart-radar.js +2 -2
  21. package/dist/src/editors/ox-input-chart-radar.js.map +1 -1
  22. package/dist/src/editors/ox-input-chart-timeseries.d.ts +2 -0
  23. package/dist/src/editors/ox-input-chart-timeseries.js +9 -3
  24. package/dist/src/editors/ox-input-chart-timeseries.js.map +1 -1
  25. package/dist/src/editors/ox-property-editor-chart.js.map +1 -1
  26. package/dist/src/editors/templates/annotations.d.ts +23 -0
  27. package/dist/src/editors/templates/annotations.js +270 -0
  28. package/dist/src/editors/templates/annotations.js.map +1 -0
  29. package/dist/src/editors/templates/display-value.d.ts +12 -0
  30. package/dist/src/editors/templates/display-value.js +105 -0
  31. package/dist/src/editors/templates/display-value.js.map +1 -0
  32. package/dist/src/editors/templates/series.d.ts +31 -0
  33. package/dist/src/editors/templates/series.js +277 -0
  34. package/dist/src/editors/templates/series.js.map +1 -0
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +4 -4
  37. package/src/editors/configurer.ts +25 -14
  38. package/src/editors/input-chart-abstract.ts +1 -655
  39. package/src/editors/input-chart-styles.ts +27 -0
  40. package/src/editors/ox-input-chart-hbar.ts +3 -73
  41. package/src/editors/ox-input-chart-mixed.ts +2 -2
  42. package/src/editors/ox-input-chart-pie.ts +3 -2
  43. package/src/editors/ox-input-chart-radar.ts +3 -2
  44. package/src/editors/ox-input-chart-timeseries.ts +10 -3
  45. package/src/editors/ox-property-editor-chart.ts +1 -1
  46. package/src/editors/templates/annotations.ts +287 -0
  47. package/src/editors/templates/display-value.ts +110 -0
  48. package/src/editors/templates/series.ts +304 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [7.0.39](https://github.com/hatiolab/operato/compare/v7.0.38...v7.0.39) (2024-08-01)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * make zero sizable annotations model ([b039b5f](https://github.com/hatiolab/operato/commit/b039b5f48d56588bb16c4ea84bbfd3537ee94170))
12
+ * make zero sizable annotations model ([8f00360](https://github.com/hatiolab/operato/commit/8f003609f49faa3e21a062ae05bde28d7d40f874))
13
+ * refactoring chart editor ([689cfa1](https://github.com/hatiolab/operato/commit/689cfa1b9f8bb37de60ee9066108c6ed918bdfca))
14
+
15
+
16
+
17
+ ### [7.0.37](https://github.com/hatiolab/operato/compare/v7.0.36...v7.0.37) (2024-07-31)
18
+
19
+ **Note:** Version bump only for package @operato/chart
20
+
21
+
22
+
23
+
24
+
6
25
  ### [7.0.36](https://github.com/hatiolab/operato/compare/v7.0.35...v7.0.36) (2024-07-31)
7
26
 
8
27
 
@@ -4,7 +4,7 @@ export declare class Configurer {
4
4
  currentAnnotationIndex: number;
5
5
  initializer: () => OperatoChart.ChartConfig;
6
6
  constructor(value: OperatoChart.ChartConfig | null, initializer: () => OperatoChart.ChartConfig);
7
- updateValue(value: OperatoChart.ChartConfig): void;
7
+ updateValue(value?: OperatoChart.ChartConfig): void;
8
8
  setCurrentSeriesIndex(currentSeriesIndex: number): void;
9
9
  setCurrentAnnotationIndex(currentAnnotationIndex: number): void;
10
10
  get series(): OperatoChart.Dataset;
@@ -59,6 +59,8 @@ export declare class Configurer {
59
59
  get annotations(): OperatoChart.Annotation[];
60
60
  set annotations(annotations: OperatoChart.Annotation[]);
61
61
  get currentAnnotation(): OperatoChart.Annotation;
62
- addAnnotation(annotation: OperatoChart.Annotation): void;
62
+ addSeries(series?: OperatoChart.Dataset): void;
63
+ removeSeries(index: number): void;
64
+ addAnnotation(annotation?: OperatoChart.Annotation): void;
63
65
  removeAnnotation(index: number): void;
64
66
  }
@@ -1,12 +1,12 @@
1
1
  export class Configurer {
2
2
  constructor(value, initializer) {
3
3
  this.currentSeriesIndex = 0;
4
- this.currentAnnotationIndex = 0;
4
+ this.currentAnnotationIndex = -1;
5
5
  this.initializer = initializer;
6
6
  this.value = value || initializer.call(this);
7
7
  }
8
8
  updateValue(value) {
9
- this.value = value;
9
+ this.value = value || { ...this.value };
10
10
  }
11
11
  setCurrentSeriesIndex(currentSeriesIndex) {
12
12
  this.currentSeriesIndex = currentSeriesIndex;
@@ -14,7 +14,12 @@ export class Configurer {
14
14
  }
15
15
  setCurrentAnnotationIndex(currentAnnotationIndex) {
16
16
  this.currentAnnotationIndex = currentAnnotationIndex;
17
- this.annotation = this.annotations[this.currentAnnotationIndex];
17
+ if (currentAnnotationIndex >= 0 && currentAnnotationIndex < this.annotations.length) {
18
+ this.annotation = this.annotations[currentAnnotationIndex];
19
+ }
20
+ else {
21
+ this.currentAnnotationIndex = -1;
22
+ }
18
23
  }
19
24
  get series() {
20
25
  return this.datasets[this.currentSeriesIndex] || {};
@@ -166,7 +171,7 @@ export class Configurer {
166
171
  return this.series.color || oldVersionColor;
167
172
  }
168
173
  set color(color) {
169
- this.series.color = color; // Array.isArray(color) ? color[0] : color
174
+ this.series.color = color;
170
175
  delete this.series.backgroundColor;
171
176
  delete this.series.borderColor;
172
177
  }
@@ -248,18 +253,24 @@ export class Configurer {
248
253
  get currentAnnotation() {
249
254
  return this.annotations[this.currentAnnotationIndex];
250
255
  }
251
- addAnnotation(annotation) {
252
- if (!this.config.options) {
253
- this.config.options = {};
254
- }
255
- if (!this.config.options.annotations) {
256
- this.config.options.annotations = [];
256
+ addSeries(series = {}) {
257
+ this.datasets.push(series);
258
+ this.setCurrentSeriesIndex(this.datasets.length - 1);
259
+ }
260
+ removeSeries(index) {
261
+ if (index >= 0 && index < this.datasets.length) {
262
+ this.datasets.splice(index, 1);
263
+ this.setCurrentSeriesIndex(Math.min(this.currentSeriesIndex, this.datasets.length - 1));
257
264
  }
258
- this.config.options.annotations.push(annotation);
265
+ }
266
+ addAnnotation(annotation = { type: 'line', x1: 0, y1: 0 }) {
267
+ this.annotations.push(annotation);
268
+ this.setCurrentAnnotationIndex(this.annotations.length - 1);
259
269
  }
260
270
  removeAnnotation(index) {
261
- if (this.config.options && this.config.options.annotations) {
262
- this.config.options.annotations.splice(index, 1);
271
+ if (index >= 0 && index < this.annotations.length) {
272
+ this.annotations.splice(index, 1);
273
+ this.setCurrentAnnotationIndex(Math.min(this.currentAnnotationIndex, this.annotations.length - 1));
263
274
  }
264
275
  }
265
276
  }
@@ -1 +1 @@
1
- {"version":3,"file":"configurer.js","sourceRoot":"","sources":["../../../src/editors/configurer.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAU;IAMrB,YAAY,KAAsC,EAAE,WAA2C;QAJxF,uBAAkB,GAAW,CAAC,CAAA;QAC9B,2BAAsB,GAAW,CAAC,CAAA;QAIvC,IAAI,CAAC,WAAW,GAAG,WAAW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CAAA;QAC1B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAA;QACtC,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,WAAW,CAAA;IAC/C,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAA;IACtD,CAAC;IAED,aAAa,CAAC,UAAmC;QAC/C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,EAAE,CAAA;QAC1B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACrC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,EAAE,CAAA;QACtC,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACnD,CAAC;IAED,gBAAgB,CAAC,KAAa;QAC5B,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC3D,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;QAClD,CAAC;IACH,CAAC;CACF","sourcesContent":["export class Configurer {\n public value: OperatoChart.ChartConfig\n public currentSeriesIndex: number = 0\n public currentAnnotationIndex: number = 0\n public initializer: () => OperatoChart.ChartConfig\n\n constructor(value: OperatoChart.ChartConfig | null, initializer: () => OperatoChart.ChartConfig) {\n this.initializer = initializer\n this.value = value || initializer.call(this)\n }\n\n updateValue(value: OperatoChart.ChartConfig) {\n this.value = value\n }\n\n setCurrentSeriesIndex(currentSeriesIndex: number) {\n this.currentSeriesIndex = currentSeriesIndex\n this.series = this.datasets[this.currentSeriesIndex]!\n }\n\n setCurrentAnnotationIndex(currentAnnotationIndex: number) {\n this.currentAnnotationIndex = currentAnnotationIndex\n this.annotation = this.annotations[this.currentAnnotationIndex]!\n }\n\n get series() {\n return this.datasets[this.currentSeriesIndex]! || {}\n }\n\n set series(series) {\n if (!this.data) {\n this.config.data = { datasets: [series] }\n } else {\n this.datasets[this.currentSeriesIndex] = series\n }\n }\n\n get annotation() {\n return this.annotations[this.currentAnnotationIndex]! || {}\n }\n\n set annotation(annotation) {\n if (!this.annotations) {\n this.annotations = [annotation]\n } else {\n this.annotations[this.currentAnnotationIndex] = annotation\n }\n }\n\n get config() {\n if (!this.value) {\n this.value = this.initializer.call(this)\n }\n return this.value\n }\n\n get data() {\n return this.config.data\n }\n\n set data(data) {\n this.config.data = data\n }\n\n get datasets() {\n if (!this.data.datasets) {\n this.data.datasets = []\n }\n return this.data.datasets\n }\n\n set datasets(datasets) {\n this.data.datasets = datasets\n }\n\n set dataKey(key) {\n if (this.series) {\n this.series!.dataKey = key\n }\n }\n\n get dataKey() {\n return this.series.dataKey\n }\n\n get legend() {\n !this.config.options && (this.config.options = {})\n return this.config.options.legend\n }\n\n set legend(legend) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.legend = legend\n }\n\n get theme() {\n return this.config.options && this.config.options.theme\n }\n\n set theme(theme) {\n !this.config.options && (this.config.options = {})\n this.config.options.theme = theme\n }\n\n get tooltip() {\n return !this.config.options || this.config.options.tooltip !== false\n }\n\n set tooltip(tooltip) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.tooltip = tooltip\n }\n\n get animation() {\n return !this.config.options || this.config.options.animation !== false\n }\n\n set animation(animation) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.animation = animation\n }\n\n get scales() {\n if (!this.config.options) {\n this.config.options = {}\n }\n return this.config.options.scales\n }\n\n set scales(scales) {\n !this.config.options && (this.config.options = {})\n this.config.options.scales = scales\n }\n\n get display() {\n return this.legend && this.legend.display\n }\n\n set display(display) {\n if (!this.legend) {\n this.legend = {}\n }\n this.legend.display = display\n }\n\n get position() {\n if (!this.legend) {\n this.legend = {}\n }\n return this.legend.position\n }\n\n set position(position) {\n if (!this.legend) {\n this.legend = {}\n }\n this.legend.position = position\n }\n\n get stacked() {\n if (!this.config.options) {\n this.config.options = {}\n }\n return this.config.options.stacked\n }\n\n set stacked(stacked) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.stacked = stacked\n }\n\n get labelDataKey() {\n return this.data && this.data.labelDataKey\n }\n\n set labelDataKey(labelDataKey) {\n this.data.labelDataKey = labelDataKey\n }\n\n set options(options) {\n this.config.options = options\n }\n\n get options() {\n return this.config.options\n }\n\n get color() {\n var oldVersionColor = this.series.backgroundColor\n if (this.series.type == 'line') oldVersionColor = this.series.borderColor\n if (this.series.type == 'radar') oldVersionColor = this.series.borderColor\n return this.series.color || oldVersionColor\n }\n\n set color(color) {\n this.series.color = color // Array.isArray(color) ? color[0] : color\n delete this.series.backgroundColor\n delete this.series.borderColor\n }\n\n get xAxes0() {\n return this.scales!.xAxes![0]\n }\n\n set xAxes0(xAxes0) {\n this.scales!.xAxes![0] = xAxes0\n }\n\n get yAxes0() {\n return this.scales!.yAxes![0]\n }\n\n set yAxes0(yAxes0) {\n this.scales!.yAxes![0] = yAxes0\n }\n\n get yAxes1() {\n return this.scales!.yAxes![1]\n }\n\n set yAxes1(yAxes1) {\n if (!this.scales!.yAxes![1]) {\n this.scales!.yAxes![1] = {}\n }\n this.scales!.yAxes![1] = yAxes1\n }\n\n get multiAxis() {\n return this.config.options!.multiAxis\n }\n\n set multiAxis(multiAxis) {\n if (!multiAxis) {\n this.scales!.yAxes = [this.yAxes0]\n } else if (!this.yAxes1) {\n this.yAxes1 = {}\n }\n\n this.config.options!.multiAxis = multiAxis\n }\n\n get valuePrefix() {\n return this.series.valuePrefix\n }\n\n set valuePrefix(valuePrefix: string | undefined) {\n this.series.valuePrefix = valuePrefix\n }\n\n get valueSuffix() {\n return this.series.valueSuffix\n }\n\n set valueSuffix(valueSuffix: string | undefined) {\n this.series.valueSuffix = valueSuffix\n }\n\n get valueFormat() {\n return this.series.valueFormat\n }\n\n set valueFormat(valueFormat: string | undefined) {\n this.series.valueFormat = valueFormat\n }\n\n get displayValue() {\n return this.series.displayValue\n }\n\n set displayValue(displayValue) {\n this.series.displayValue = displayValue\n }\n\n get annotations(): OperatoChart.Annotation[] {\n if (!this.config.options) {\n this.config.options = {}\n }\n if (!this.config.options.annotations) {\n this.config.options.annotations = []\n }\n\n return this.config.options.annotations!\n }\n\n set annotations(annotations) {\n if (!this.config.options) {\n this.config.options = {}\n }\n if (!this.config.options.annotations) {\n this.config.options.annotations = []\n }\n this.config.options.annotations = annotations\n }\n\n get currentAnnotation() {\n return this.annotations[this.currentAnnotationIndex]\n }\n\n addAnnotation(annotation: OperatoChart.Annotation) {\n if (!this.config.options) {\n this.config.options = {}\n }\n if (!this.config.options.annotations) {\n this.config.options.annotations = []\n }\n\n this.config.options.annotations!.push(annotation)\n }\n\n removeAnnotation(index: number) {\n if (this.config.options && this.config.options.annotations) {\n this.config.options.annotations.splice(index, 1)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"configurer.js","sourceRoot":"","sources":["../../../src/editors/configurer.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,UAAU;IAMrB,YAAY,KAAsC,EAAE,WAA2C;QAJxF,uBAAkB,GAAW,CAAC,CAAA;QAC9B,2BAAsB,GAAW,CAAC,CAAC,CAAA;QAIxC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC9C,CAAC;IAED,WAAW,CAAC,KAAgC;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,E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CAAC,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;YAClD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;YACjC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAA;QACpG,CAAC;IACH,CAAC;CACF","sourcesContent":["export class Configurer {\n public value: OperatoChart.ChartConfig\n public currentSeriesIndex: number = 0\n public currentAnnotationIndex: number = -1\n public initializer: () => OperatoChart.ChartConfig\n\n constructor(value: OperatoChart.ChartConfig | null, initializer: () => OperatoChart.ChartConfig) {\n this.initializer = initializer\n this.value = value || initializer.call(this)\n }\n\n updateValue(value?: OperatoChart.ChartConfig) {\n this.value = value || { ...this.value }\n }\n\n setCurrentSeriesIndex(currentSeriesIndex: number) {\n this.currentSeriesIndex = currentSeriesIndex\n this.series = this.datasets[this.currentSeriesIndex]!\n }\n\n setCurrentAnnotationIndex(currentAnnotationIndex: number) {\n this.currentAnnotationIndex = currentAnnotationIndex\n if (currentAnnotationIndex >= 0 && currentAnnotationIndex < this.annotations.length) {\n this.annotation = this.annotations[currentAnnotationIndex]\n } else {\n this.currentAnnotationIndex = -1\n }\n }\n\n get series() {\n return this.datasets[this.currentSeriesIndex]! || {}\n }\n\n set series(series) {\n if (!this.data) {\n this.config.data = { datasets: [series] }\n } else {\n this.datasets[this.currentSeriesIndex] = series\n }\n }\n\n get annotation() {\n return this.annotations[this.currentAnnotationIndex]! || {}\n }\n\n set annotation(annotation) {\n if (!this.annotations) {\n this.annotations = [annotation]\n } else {\n this.annotations[this.currentAnnotationIndex] = annotation\n }\n }\n\n get config() {\n if (!this.value) {\n this.value = this.initializer.call(this)\n }\n return this.value\n }\n\n get data() {\n return this.config.data\n }\n\n set data(data) {\n this.config.data = data\n }\n\n get datasets() {\n if (!this.data.datasets) {\n this.data.datasets = []\n }\n return this.data.datasets\n }\n\n set datasets(datasets) {\n this.data.datasets = datasets\n }\n\n set dataKey(key) {\n if (this.series) {\n this.series!.dataKey = key\n }\n }\n\n get dataKey() {\n return this.series.dataKey\n }\n\n get legend() {\n !this.config.options && (this.config.options = {})\n return this.config.options.legend\n }\n\n set legend(legend) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.legend = legend\n }\n\n get theme() {\n return this.config.options && this.config.options.theme\n }\n\n set theme(theme) {\n !this.config.options && (this.config.options = {})\n this.config.options.theme = theme\n }\n\n get tooltip() {\n return !this.config.options || this.config.options.tooltip !== false\n }\n\n set tooltip(tooltip) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.tooltip = tooltip\n }\n\n get animation() {\n return !this.config.options || this.config.options.animation !== false\n }\n\n set animation(animation) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.animation = animation\n }\n\n get scales() {\n if (!this.config.options) {\n this.config.options = {}\n }\n return this.config.options.scales\n }\n\n set scales(scales) {\n !this.config.options && (this.config.options = {})\n this.config.options.scales = scales\n }\n\n get display() {\n return this.legend && this.legend.display\n }\n\n set display(display) {\n if (!this.legend) {\n this.legend = {}\n }\n this.legend.display = display\n }\n\n get position() {\n if (!this.legend) {\n this.legend = {}\n }\n return this.legend.position\n }\n\n set position(position) {\n if (!this.legend) {\n this.legend = {}\n }\n this.legend.position = position\n }\n\n get stacked() {\n if (!this.config.options) {\n this.config.options = {}\n }\n return this.config.options.stacked\n }\n\n set stacked(stacked) {\n if (!this.config.options) {\n this.config.options = {}\n }\n this.config.options.stacked = stacked\n }\n\n get labelDataKey() {\n return this.data && this.data.labelDataKey\n }\n\n set labelDataKey(labelDataKey) {\n this.data.labelDataKey = labelDataKey\n }\n\n set options(options) {\n this.config.options = options\n }\n\n get options() {\n return this.config.options\n }\n\n get color() {\n var oldVersionColor = this.series.backgroundColor\n if (this.series.type == 'line') oldVersionColor = this.series.borderColor\n if (this.series.type == 'radar') oldVersionColor = this.series.borderColor\n return this.series.color || oldVersionColor\n }\n\n set color(color) {\n this.series.color = color\n delete this.series.backgroundColor\n delete this.series.borderColor\n }\n\n get xAxes0() {\n return this.scales!.xAxes![0]\n }\n\n set xAxes0(xAxes0) {\n this.scales!.xAxes![0] = xAxes0\n }\n\n get yAxes0() {\n return this.scales!.yAxes![0]\n }\n\n set yAxes0(yAxes0) {\n this.scales!.yAxes![0] = yAxes0\n }\n\n get yAxes1() {\n return this.scales!.yAxes![1]\n }\n\n set yAxes1(yAxes1) {\n if (!this.scales!.yAxes![1]) {\n this.scales!.yAxes![1] = {}\n }\n this.scales!.yAxes![1] = yAxes1\n }\n\n get multiAxis() {\n return this.config.options!.multiAxis\n }\n\n set multiAxis(multiAxis) {\n if (!multiAxis) {\n this.scales!.yAxes = [this.yAxes0]\n } else if (!this.yAxes1) {\n this.yAxes1 = {}\n }\n\n this.config.options!.multiAxis = multiAxis\n }\n\n get valuePrefix() {\n return this.series.valuePrefix\n }\n\n set valuePrefix(valuePrefix: string | undefined) {\n this.series.valuePrefix = valuePrefix\n }\n\n get valueSuffix() {\n return this.series.valueSuffix\n }\n\n set valueSuffix(valueSuffix: string | undefined) {\n this.series.valueSuffix = valueSuffix\n }\n\n get valueFormat() {\n return this.series.valueFormat\n }\n\n set valueFormat(valueFormat: string | undefined) {\n this.series.valueFormat = valueFormat\n }\n\n get displayValue() {\n return this.series.displayValue\n }\n\n set displayValue(displayValue) {\n this.series.displayValue = displayValue\n }\n\n get annotations(): OperatoChart.Annotation[] {\n if (!this.config.options) {\n this.config.options = {}\n }\n if (!this.config.options.annotations) {\n this.config.options.annotations = []\n }\n\n return this.config.options.annotations!\n }\n\n set annotations(annotations) {\n if (!this.config.options) {\n this.config.options = {}\n }\n if (!this.config.options.annotations) {\n this.config.options.annotations = []\n }\n this.config.options.annotations = annotations\n }\n\n get currentAnnotation() {\n return this.annotations[this.currentAnnotationIndex]\n }\n\n addSeries(series: OperatoChart.Dataset = {}) {\n this.datasets.push(series)\n this.setCurrentSeriesIndex(this.datasets.length - 1)\n }\n\n removeSeries(index: number) {\n if (index >= 0 && index < this.datasets.length) {\n this.datasets.splice(index, 1)\n this.setCurrentSeriesIndex(Math.min(this.currentSeriesIndex, this.datasets.length - 1))\n }\n }\n\n addAnnotation(annotation: OperatoChart.Annotation = { type: 'line', x1: 0, y1: 0 }) {\n this.annotations.push(annotation)\n this.setCurrentAnnotationIndex(this.annotations.length - 1)\n }\n\n removeAnnotation(index: number) {\n if (index >= 0 && index < this.annotations.length) {\n this.annotations.splice(index, 1)\n this.setCurrentAnnotationIndex(Math.min(this.currentAnnotationIndex, this.annotations.length - 1))\n }\n }\n}\n"]}
@@ -1,47 +1,21 @@
1
1
  import '@operato/i18n/ox-i18n.js';
2
2
  import { PropertyValues } from 'lit';
3
- import { TinyColor } from '@ctrl/tinycolor';
4
- import { MdIcon } from '@material/web/icon/icon.js';
5
3
  import { Configurer } from './configurer';
6
4
  import { OxFormField } from '@operato/input';
7
5
  export declare class InputChartAbstract extends OxFormField {
8
6
  static styles: import("lit").CSSResult[];
9
7
  value: OperatoChart.ChartConfig | null;
10
8
  chartType: OperatoChart.ChartType;
11
- annotationsTabs: HTMLElement;
12
- annotationsTabNavLeftButton: MdIcon;
13
- annotationsTabNavRightButton: MdIcon;
14
- seriesTabs: HTMLElement;
15
- seriesTabNavLeftButton: MdIcon;
16
- seriesTabNavRightButton: MdIcon;
17
9
  private _configurer?;
18
10
  get configurer(): Configurer;
19
11
  updated(changes: PropertyValues<this>): void;
20
12
  render(): import("lit-html").TemplateResult<1>;
21
13
  connectedCallback(): void;
22
- protected firstUpdated(_changedProperties: PropertyValues): void;
23
- get seriesTabContainer(): HTMLElement | null | undefined;
24
- get annotationsTabContainer(): HTMLElement | null | undefined;
25
- displayValueTemplate(): import("lit-html").TemplateResult<1>;
26
14
  subTemplate(): import("lit-html").TemplateResult<1>;
27
15
  getDefaultDatasets(): OperatoChart.Dataset[];
28
16
  getDefaultDataset(seriesType: 'bar' | 'horizontalBar' | 'line' | 'radar' | 'pie'): OperatoChart.Dataset;
29
17
  getDefaultChartConfig(type: OperatoChart.ChartType, datasets?: OperatoChart.Dataset[]): OperatoChart.ChartConfig;
30
18
  getDefaultAxisOptions(): OperatoChart.AxisOptions;
31
19
  onValuesChanged(e: Event): void;
32
- onTapAddSeriesTab(e: Event): void;
33
- onTapRemoveCurrentSeriesTab(index: number): void;
34
- onTapAddAnnotation(e: Event): void;
35
- onTapRemoveCurrentAnnotation(index: number): void;
36
- _getSeriesModel({ chartType, datasetsLength, lastSeriesColor }: {
37
- chartType: string;
38
- datasetsLength: number;
39
- lastSeriesColor: TinyColor;
40
- }): any;
41
20
  _getElementValue(element: HTMLElement): any;
42
- annotationsTabTemplate(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/keyed").Keyed>;
43
- multiSeriesTabTemplate(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/keyed").Keyed>;
44
- _onTabScroll(e: Event, type: 'series' | 'annotations'): void;
45
- _onTabScrollNavLeft(e: Event, type: 'series' | 'annotations'): void;
46
- _onTabScrollNavRight(e: Event, type: 'series' | 'annotations'): void;
47
21
  }