@operato/chart 7.0.15 → 7.0.17
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/CHANGELOG.md +18 -0
- package/dist/src/chartjs/ox-chart-js.d.ts +0 -1
- package/dist/src/chartjs/ox-chart-js.js +12 -1
- package/dist/src/chartjs/ox-chart-js.js.map +1 -1
- package/dist/src/editors/input-chart-abstract.d.ts +2 -2
- package/dist/src/editors/input-chart-abstract.js +282 -259
- package/dist/src/editors/input-chart-abstract.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/chartjs/ox-chart-js.ts +14 -1
- package/src/editors/input-chart-abstract.ts +343 -313
- package/src/types.d.ts +3 -0
- package/translations/en.json +3 -0
- package/translations/ja.json +3 -0
- package/translations/ko.json +3 -0
- package/translations/ms.json +3 -0
- package/translations/zh.json +3 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/chart",
|
|
3
3
|
"description": "Webcomponents for chart following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh@hatiolab.com",
|
|
5
|
-
"version": "7.0.
|
|
5
|
+
"version": "7.0.17",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"module": "dist/src/index.js",
|
|
8
8
|
"types": "src/types.d.ts",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"prettier --write"
|
|
120
120
|
]
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "ba33fff47b903e6d4339e5b61a223dafeee5ab8b"
|
|
123
123
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'chartjs-plugin-datalabels'
|
|
1
|
+
import ChartDataLabels from 'chartjs-plugin-datalabels'
|
|
2
2
|
|
|
3
3
|
import { LitElement, html, css } from 'lit'
|
|
4
4
|
import { property, query, state, customElement } from 'lit/decorators.js'
|
|
@@ -6,6 +6,8 @@ import { Chart, ChartConfiguration } from 'chart.js/auto'
|
|
|
6
6
|
import { format as formatText } from '@operato/utils/format.js'
|
|
7
7
|
import { convertConfigure } from './config-converter'
|
|
8
8
|
|
|
9
|
+
Chart.register(ChartDataLabels)
|
|
10
|
+
|
|
9
11
|
@customElement('ox-chart-js')
|
|
10
12
|
export class OxChartJs extends LitElement {
|
|
11
13
|
@property({ type: Object }) config: OperatoChart.ChartConfig | null = null
|
|
@@ -49,6 +51,8 @@ export class OxChartJs extends LitElement {
|
|
|
49
51
|
if (changedProperties.has('config') && this.config) {
|
|
50
52
|
this.chartjsConfig = convertConfigure(this.config, {}) as any
|
|
51
53
|
|
|
54
|
+
this.attachPluginOptions(this.chartjsConfig!.options as any)
|
|
55
|
+
|
|
52
56
|
this.chart && this.chart.destroy()
|
|
53
57
|
this.chart = new Chart(this.canvas, this.chartjsConfig!)
|
|
54
58
|
|
|
@@ -133,6 +137,15 @@ export class OxChartJs extends LitElement {
|
|
|
133
137
|
anchor: function (context: any) {
|
|
134
138
|
return context.dataset.dataLabelAnchor || 'center'
|
|
135
139
|
},
|
|
140
|
+
offset: function (context: any) {
|
|
141
|
+
return context.dataset.dataLabelOffset || 0
|
|
142
|
+
},
|
|
143
|
+
align: function (context: any) {
|
|
144
|
+
return context.dataset.dataLabelAnchor || 'center'
|
|
145
|
+
},
|
|
146
|
+
rotation: function (context: any) {
|
|
147
|
+
return context.dataset.dataLabelRotation || 0
|
|
148
|
+
},
|
|
136
149
|
color: function (context: any) {
|
|
137
150
|
return context.dataset?.defaultFontColor || '#000'
|
|
138
151
|
},
|