|
@@ -1,5 +1,7 @@
|
|
|
<script src="../../dist/vue.global.js"></script>
|
|
<script src="../../dist/vue.global.js"></script>
|
|
|
<script>
|
|
<script>
|
|
|
|
|
+const { ref, reactive, computed, createApp } = Vue
|
|
|
|
|
+
|
|
|
// math helper...
|
|
// math helper...
|
|
|
function valueToPoint (value, index, total) {
|
|
function valueToPoint (value, index, total) {
|
|
|
var x = 0
|
|
var x = 0
|
|
@@ -24,7 +26,7 @@ const AxisLabel = {
|
|
|
},
|
|
},
|
|
|
setup(props) {
|
|
setup(props) {
|
|
|
return {
|
|
return {
|
|
|
- point: Vue.computed(() => valueToPoint(
|
|
|
|
|
|
|
+ point: computed(() => valueToPoint(
|
|
|
+props.stat.value + 10,
|
|
+props.stat.value + 10,
|
|
|
props.index,
|
|
props.index,
|
|
|
props.total
|
|
props.total
|
|
@@ -54,7 +56,7 @@ const Polygraph = {
|
|
|
template: '#polygraph-template',
|
|
template: '#polygraph-template',
|
|
|
setup(props) {
|
|
setup(props) {
|
|
|
return {
|
|
return {
|
|
|
- points: Vue.computed(() => {
|
|
|
|
|
|
|
+ points: computed(() => {
|
|
|
const total = props.stats.length
|
|
const total = props.stats.length
|
|
|
return props.stats.map((stat, i) => {
|
|
return props.stats.map((stat, i) => {
|
|
|
const point = valueToPoint(stat.value, i, total)
|
|
const point = valueToPoint(stat.value, i, total)
|
|
@@ -95,8 +97,8 @@ const App = {
|
|
|
Polygraph
|
|
Polygraph
|
|
|
},
|
|
},
|
|
|
setup() {
|
|
setup() {
|
|
|
- const newLabel = Vue.ref('')
|
|
|
|
|
- const stats = Vue.reactive([
|
|
|
|
|
|
|
+ const newLabel = ref('')
|
|
|
|
|
+ const stats = reactive([
|
|
|
{ label: 'A', value: 100 },
|
|
{ label: 'A', value: 100 },
|
|
|
{ label: 'B', value: 100 },
|
|
{ label: 'B', value: 100 },
|
|
|
{ label: 'C', value: 100 },
|
|
{ label: 'C', value: 100 },
|
|
@@ -132,7 +134,7 @@ const App = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Vue.createApp().mount(App, '#demo')
|
|
|
|
|
|
|
+createApp().mount(App, '#demo')
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
<style>
|