-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
249 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<template> | ||
<div> | ||
<h3>动态柱状图</h3> | ||
<div ref="chartRef" class="chartRef"></div> | ||
</div> | ||
</template> | ||
<script lang="ts"></script> | ||
<script lang="ts" setup> | ||
import { onMounted, ref, Ref } from 'vue'; | ||
import { useECharts, createEChartsOption } from '@/hooks/web/useECharts'; | ||
import { useIntervalFn } from '@vueuse/core'; | ||
const chartRef = ref<HTMLDivElement | null>(null); | ||
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); | ||
const data: number[] = []; | ||
for (let i = 0; i < 5; ++i) { | ||
data.push(Math.round(Math.random() * 200)); | ||
} | ||
const options: createEChartsOption = { | ||
xAxis: { | ||
max: 'dataMax', | ||
}, | ||
yAxis: { | ||
type: 'category', | ||
data: ['A', 'B', 'C', 'D', 'E'], | ||
inverse: true, | ||
animationDuration: 300, | ||
animationDurationUpdate: 300, | ||
max: 3, // only the largest 3 bars will be displayed | ||
}, | ||
grid: { | ||
left: '1%', | ||
right: '10%', | ||
top: '5%', | ||
bottom: 0, | ||
containLabel: true, | ||
}, | ||
series: [ | ||
{ | ||
realtimeSort: true, | ||
type: 'bar', | ||
data: data, | ||
label: { | ||
show: true, | ||
position: 'right', | ||
valueAnimation: true, | ||
}, | ||
itemStyle: { | ||
color: '#409eff', | ||
}, | ||
}, | ||
], | ||
legend: { | ||
show: true, | ||
}, | ||
animationDuration: 3000, | ||
animationDurationUpdate: 3000, | ||
animationEasing: 'linear', | ||
animationEasingUpdate: 'linear', | ||
}; | ||
onMounted(() => { | ||
setOptions(options); | ||
useIntervalFn( | ||
() => { | ||
run(); | ||
}, | ||
3000, | ||
{ immediate: true }, | ||
); | ||
}); | ||
function run() { | ||
for (var i = 0; i < data.length; ++i) { | ||
if (Math.random() > 0.9) { | ||
data[i] += Math.round(Math.random() * 2000); | ||
} else { | ||
data[i] += Math.round(Math.random() * 200); | ||
} | ||
} | ||
setOptions(options, false); | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.chartRef { | ||
width: 100%; | ||
height: 380px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<div class="page-container"> | ||
<BarRace></BarRace> | ||
</div> | ||
</template> | ||
<script lang="ts"></script> | ||
<script lang="ts" setup> | ||
import BarRace from './components/BarRace.vue'; | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.page-container { | ||
padding: 20px; | ||
background-color: #{$main-bg-color}; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<template> | ||
<div> | ||
<h3>动态折线图</h3> | ||
<div ref="chartRef" class="chartRef"></div> | ||
</div> | ||
</template> | ||
<script lang="ts"></script> | ||
<script lang="ts" setup> | ||
import { onMounted, ref, Ref } from 'vue'; | ||
import { useECharts, createEChartsOption } from '@/hooks/web/useECharts'; | ||
import { useIntervalFn } from '@vueuse/core'; | ||
const chartRef = ref<HTMLDivElement | null>(null); | ||
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); | ||
const data: number[] = []; | ||
for (let i = 0; i < 5; ++i) { | ||
data.push(Math.round(Math.random() * 200)); | ||
} | ||
const options: createEChartsOption = { | ||
xAxis: { | ||
max: 'dataMax', | ||
}, | ||
yAxis: { | ||
type: 'category', | ||
data: ['A', 'B', 'C', 'D', 'E'], | ||
inverse: true, | ||
animationDuration: 300, | ||
animationDurationUpdate: 300, | ||
max: 3, // only the largest 3 bars will be displayed | ||
}, | ||
grid: { | ||
left: '1%', | ||
right: '10%', | ||
top: '5%', | ||
bottom: 0, | ||
containLabel: true, | ||
}, | ||
series: [ | ||
{ | ||
realtimeSort: true, | ||
type: 'bar', | ||
data: data, | ||
label: { | ||
show: true, | ||
position: 'right', | ||
valueAnimation: true, | ||
}, | ||
itemStyle: { | ||
color: '#409eff', | ||
}, | ||
}, | ||
], | ||
legend: { | ||
show: true, | ||
}, | ||
animationDuration: 3000, | ||
animationDurationUpdate: 3000, | ||
animationEasing: 'linear', | ||
animationEasingUpdate: 'linear', | ||
}; | ||
onMounted(() => { | ||
setOptions(options); | ||
useIntervalFn( | ||
() => { | ||
run(); | ||
}, | ||
3000, | ||
{ immediate: true }, | ||
); | ||
}); | ||
function run() { | ||
for (var i = 0; i < data.length; ++i) { | ||
if (Math.random() > 0.9) { | ||
data[i] += Math.round(Math.random() * 2000); | ||
} else { | ||
data[i] += Math.round(Math.random() * 200); | ||
} | ||
} | ||
setOptions(options, false); | ||
} | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.chartRef { | ||
width: 100%; | ||
height: 380px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<div class="page-container"> | ||
<LineRace></LineRace> | ||
</div> | ||
</template> | ||
<script lang="ts"></script> | ||
<script lang="ts" setup> | ||
import LineRace from './components/LineRace.vue'; | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.page-container { | ||
padding: 20px; | ||
background-color: #{$main-bg-color}; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters