@revolist/vue-charts 4.0.0-rc → 4.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 +10 -3
- package/dist/index.js +9 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -54,13 +54,20 @@ import { shallowRef } from 'vue';
|
|
|
54
54
|
import { RevoChart, type ChartComponentOptions } from '@revolist/vue-charts';
|
|
55
55
|
const options = shallowRef<ChartComponentOptions>({
|
|
56
56
|
chartType: 'line',
|
|
57
|
-
data: [
|
|
57
|
+
data: [
|
|
58
|
+
{ month: 'Jan', revenue: 120 },
|
|
59
|
+
{ month: 'Feb', revenue: 180 },
|
|
60
|
+
],
|
|
58
61
|
mapping: { category: { field: 'month' }, series: [{ field: 'revenue' }] },
|
|
59
62
|
});
|
|
60
63
|
</script>
|
|
61
64
|
<template>
|
|
62
|
-
<RevoChart
|
|
63
|
-
|
|
65
|
+
<RevoChart
|
|
66
|
+
:options="options"
|
|
67
|
+
@ready="(chart) => console.log(chart.model)"
|
|
68
|
+
style="height:400px"
|
|
69
|
+
class="sales-chart"
|
|
70
|
+
/>
|
|
64
71
|
</template>
|
|
65
72
|
```
|
|
66
73
|
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { defineComponent, h, mergeProps, onBeforeUnmount, onMounted, ref, toRaw, watch } from 'vue';
|
|
1
|
+
import { defineComponent, h, mergeProps, onBeforeUnmount, onMounted, ref, toRaw, watch, } from 'vue';
|
|
2
2
|
import { createChartComponentController } from '@revolist/charts/framework';
|
|
3
3
|
export const RevoChart = defineComponent({
|
|
4
4
|
name: 'RevoChart',
|
|
5
5
|
inheritAttrs: false,
|
|
6
6
|
props: {
|
|
7
|
-
options: {
|
|
7
|
+
options: {
|
|
8
|
+
type: Object,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
8
11
|
serverRender: { type: Object },
|
|
9
12
|
},
|
|
10
13
|
emits: { ready: (_chart) => true },
|
|
@@ -13,10 +16,12 @@ export const RevoChart = defineComponent({
|
|
|
13
16
|
const host = ref();
|
|
14
17
|
let controller;
|
|
15
18
|
onMounted(() => {
|
|
16
|
-
controller = createChartComponentController(host.value, chart => emit('ready', chart), !!initial);
|
|
19
|
+
controller = createChartComponentController(host.value, (chart) => emit('ready', chart), !!initial);
|
|
17
20
|
void controller.setOptions(toRaw(props.options));
|
|
18
21
|
});
|
|
19
|
-
watch(() => props.options, options => {
|
|
22
|
+
watch(() => props.options, (options) => {
|
|
23
|
+
void controller?.setOptions(toRaw(options));
|
|
24
|
+
});
|
|
20
25
|
onBeforeUnmount(() => controller?.destroy());
|
|
21
26
|
return () => h('div', mergeProps({ style: { width: '100%', height: `${initial?.height ?? 300}px` } }, attrs, { ref: host, ...(initial ? { innerHTML: initial.svg } : {}) }));
|
|
22
27
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revolist/vue-charts",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Vue components for RevoGrid Charts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Commercial",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@revolist/charts": "4.0.0
|
|
21
|
+
"@revolist/charts": "4.0.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"vue": "^3.5.0"
|