Compare commits
No commits in common. "612fde7a010b2f2841d4b50c6b7438a6efbd3792" and "0c1b5119d8e85edd70ec25ba3b7b4037a203dc43" have entirely different histories.
612fde7a01
...
0c1b5119d8
|
|
@ -45,21 +45,17 @@
|
|||
|
||||
const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>)
|
||||
|
||||
async function getData(init = true) {
|
||||
async function getData() {
|
||||
const resData = await getRiceShrimpIndustry({
|
||||
year: visualizationStore.getYear,
|
||||
})
|
||||
Data.x_axis = resData.x_axis
|
||||
Data.series = resData.series
|
||||
if (init) {
|
||||
chartsInit()
|
||||
} else {
|
||||
chartLineAmi()
|
||||
}
|
||||
}
|
||||
|
||||
chartsInit()
|
||||
}
|
||||
let legendData = [] as any
|
||||
function formatChartData() {
|
||||
const chartsInit = () => {
|
||||
const obj = {
|
||||
legendData: [] as any,
|
||||
series: [] as any,
|
||||
|
|
@ -67,12 +63,12 @@
|
|||
|
||||
Data.series.forEach(({ name, data }, index) => {
|
||||
const color = chartLineColors[index % chartLineColors.length]
|
||||
obj.legendData.push(name + '')
|
||||
obj.legendData.push(name)
|
||||
obj.series.push({
|
||||
name: name,
|
||||
data: data,
|
||||
type: 'line',
|
||||
smooth: false,
|
||||
type: 'line',
|
||||
// symbol: 'none',
|
||||
itemStyle: {
|
||||
color: color.itemColor,
|
||||
|
|
@ -82,11 +78,8 @@
|
|||
},
|
||||
})
|
||||
})
|
||||
|
||||
legendData = obj.legendData
|
||||
return obj
|
||||
}
|
||||
const chartsInit = () => {
|
||||
const obj = formatChartData()
|
||||
|
||||
setOptions({
|
||||
grid: { left: '2%', right: '4%', top: '10%', bottom: '2%', containLabel: true },
|
||||
|
|
@ -149,40 +142,35 @@
|
|||
function chartAmi() {
|
||||
let index = 0
|
||||
const timerNumber = 3000
|
||||
let sleep = 1
|
||||
timer && clearInterval(timer)
|
||||
let currentIndex = 0
|
||||
let sleep = 0
|
||||
const fo = 2
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % 4
|
||||
sleep = index % (4 * fo)
|
||||
const currentIndex = index % 4
|
||||
sleep = index % (4 * 2)
|
||||
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'showTip',
|
||||
seriesIndex: 0,
|
||||
dataIndex: currentIndex,
|
||||
})
|
||||
if (sleep + 1 >= 4 * fo) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'hideTip',
|
||||
})
|
||||
}, timerNumber)
|
||||
getData(false)
|
||||
if (sleep == 7) {
|
||||
chartLineAmi()
|
||||
}
|
||||
|
||||
index++
|
||||
}, timerNumber)
|
||||
}
|
||||
|
||||
function chartLineAmi() {
|
||||
const obj = formatChartData()
|
||||
let index = 0
|
||||
let currentIndex = 0
|
||||
const timerNumber = 3000
|
||||
timer && clearInterval(timer)
|
||||
let legendIndex = legendData.length
|
||||
let sleep = 6000 / 3000
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % legendData.length
|
||||
if (currentIndex == 0) {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'hideTip',
|
||||
})
|
||||
if (legendIndex == legendData.length) {
|
||||
legendData.forEach((_, index) => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendUnSelect',
|
||||
|
|
@ -190,21 +178,17 @@
|
|||
})
|
||||
})
|
||||
}
|
||||
getInstance()?.setOption({
|
||||
series: [obj.series[currentIndex]],
|
||||
})
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[currentIndex],
|
||||
})
|
||||
if (currentIndex == legendData.length - 1) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
chartAmi()
|
||||
}, timerNumber)
|
||||
if (legendIndex >= 0) {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[legendIndex - 1],
|
||||
})
|
||||
}
|
||||
|
||||
index++
|
||||
if (legendIndex <= 0) {
|
||||
if (sleep <= 0) getData()
|
||||
sleep--
|
||||
}
|
||||
legendIndex--
|
||||
}, timerNumber)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,15 +51,14 @@
|
|||
chartsInit()
|
||||
}
|
||||
|
||||
// const reducer = (acc, cur) => (cur > acc ? cur : acc)
|
||||
// function largestOfFour(arr) {
|
||||
// return arr.map(({ data }) => data.reduce(reducer))
|
||||
// }
|
||||
const reducer = (acc, cur) => (cur > acc ? cur : acc)
|
||||
function largestOfFour(arr) {
|
||||
return arr.map(({ data }) => data.reduce(reducer))
|
||||
}
|
||||
|
||||
const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>)
|
||||
let legendData = [] as any
|
||||
|
||||
function formatChartData() {
|
||||
const chartsInit = () => {
|
||||
const obj = {
|
||||
legendData: [] as any,
|
||||
series: [] as any,
|
||||
|
|
@ -82,13 +81,10 @@
|
|||
},
|
||||
})
|
||||
})
|
||||
legendData = obj.legendData
|
||||
return obj
|
||||
}
|
||||
|
||||
const chartsInit = () => {
|
||||
const obj = formatChartData()
|
||||
// const max = Math.max(...largestOfFour(Data.series)) ?? 100
|
||||
const max = Math.max(...largestOfFour(Data.series)) ?? 100
|
||||
|
||||
legendData = obj.legendData
|
||||
|
||||
setOptions({
|
||||
grid: { left: '4%', right: '4%', top: '10%', bottom: '2%', containLabel: true },
|
||||
|
|
@ -156,42 +152,29 @@
|
|||
let timer: any = null
|
||||
|
||||
function chartAmi() {
|
||||
let index = 0
|
||||
let index = 1
|
||||
const timerNumber = 3000
|
||||
timer && clearInterval(timer)
|
||||
let currentIndex = 0
|
||||
let sleep = 0
|
||||
const fo = 2
|
||||
let sleep = 1
|
||||
let type = 'showTip'
|
||||
let legendIndex = legendData.length
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % 4
|
||||
sleep = index % (4 * fo)
|
||||
if (legendData.length == 0) return
|
||||
const currentIndex = (index - 1) % 4
|
||||
|
||||
sleep = index % (4 * 2)
|
||||
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'showTip',
|
||||
type: type,
|
||||
seriesIndex: 0,
|
||||
dataIndex: currentIndex,
|
||||
})
|
||||
if (sleep + 1 >= 4 * fo) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'hideTip',
|
||||
})
|
||||
}, timerNumber)
|
||||
getData(false)
|
||||
}
|
||||
index++
|
||||
}, timerNumber)
|
||||
}
|
||||
// console.log('currentIndex', currentIndex)
|
||||
// console.log('legendIndex', legendIndex)
|
||||
// console.log('sleep', sleep)
|
||||
// console.log('index', index)
|
||||
|
||||
function chartLineAmi() {
|
||||
const obj = formatChartData()
|
||||
let index = 0
|
||||
let currentIndex = 0
|
||||
const timerNumber = 3000
|
||||
timer && clearInterval(timer)
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % legendData.length
|
||||
if (currentIndex == 0) {
|
||||
if (type == 'hideTip' && currentIndex == 0) {
|
||||
legendData.forEach((_, index) => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendUnSelect',
|
||||
|
|
@ -199,33 +182,28 @@
|
|||
})
|
||||
})
|
||||
}
|
||||
getInstance()?.setOption({
|
||||
series: [obj.series[currentIndex]],
|
||||
})
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[currentIndex],
|
||||
})
|
||||
if (currentIndex == legendData.length - 1) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
chartAmi()
|
||||
}, timerNumber)
|
||||
if (type == 'hideTip') {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[legendIndex - 1],
|
||||
})
|
||||
if (legendIndex == 0) getData()
|
||||
legendIndex--
|
||||
}
|
||||
|
||||
if (sleep == 0) {
|
||||
type = 'hideTip'
|
||||
}
|
||||
|
||||
index++
|
||||
}, timerNumber)
|
||||
}
|
||||
|
||||
async function getData(init = true) {
|
||||
async function getData() {
|
||||
const resData = await getRiceShrimpPrice()
|
||||
Data.x_axis = resData.x_axis
|
||||
Data.series = resData.series
|
||||
if (init) {
|
||||
chartsInit()
|
||||
} else {
|
||||
chartLineAmi()
|
||||
}
|
||||
chartsInit()
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
|
|
|||
|
|
@ -31,23 +31,19 @@
|
|||
|
||||
const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>)
|
||||
|
||||
async function getData(init = true) {
|
||||
async function getData() {
|
||||
const resData = await getRiceShrimpFlow({
|
||||
year: visualizationStore.getYear,
|
||||
})
|
||||
Data.x_axis = resData.x_axis
|
||||
Data.series = resData.series
|
||||
|
||||
if (init) {
|
||||
chartsInit()
|
||||
} else {
|
||||
chartLineAmi()
|
||||
}
|
||||
chartsInit()
|
||||
}
|
||||
|
||||
let legendData = [] as any
|
||||
|
||||
function formatChartData() {
|
||||
const chartsInit = () => {
|
||||
const obj = {
|
||||
legendData: [] as any,
|
||||
series: [] as any,
|
||||
|
|
@ -55,13 +51,15 @@
|
|||
|
||||
Data.series.forEach(({ name, data }, index) => {
|
||||
const color = chartLineColors[index % chartLineColors.length]
|
||||
obj.legendData.push(name + '')
|
||||
|
||||
obj.legendData.push(name)
|
||||
obj.series.push({
|
||||
name: name,
|
||||
data: data,
|
||||
type: 'line',
|
||||
data: data.map((e) => (e ? Number((e / 2000).toFixed(2)) : e)),
|
||||
smooth: false,
|
||||
type: 'line',
|
||||
// symbol: 'none',
|
||||
stack: 'Total',
|
||||
itemStyle: {
|
||||
color: color.itemColor,
|
||||
},
|
||||
|
|
@ -70,12 +68,8 @@
|
|||
},
|
||||
})
|
||||
})
|
||||
legendData = obj.legendData
|
||||
return obj
|
||||
}
|
||||
|
||||
const chartsInit = () => {
|
||||
const obj = formatChartData()
|
||||
legendData = obj.legendData
|
||||
setOptions({
|
||||
grid: { left: '2%', right: '2%', top: '10%', bottom: '2%', containLabel: true },
|
||||
legend: {
|
||||
|
|
@ -135,44 +129,39 @@
|
|||
}
|
||||
|
||||
let timer: any = null
|
||||
|
||||
function chartAmi() {
|
||||
let index = 0
|
||||
const timerNumber = 3000
|
||||
let sleep = 1
|
||||
timer && clearInterval(timer)
|
||||
let currentIndex = 0
|
||||
let sleep = 0
|
||||
const fo = 2
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % 4
|
||||
sleep = index % (4 * fo)
|
||||
const currentIndex = index % 4
|
||||
sleep = index % (4 * 2)
|
||||
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'showTip',
|
||||
seriesIndex: 0,
|
||||
dataIndex: currentIndex,
|
||||
})
|
||||
if (sleep + 1 >= 4 * fo) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'hideTip',
|
||||
})
|
||||
}, timerNumber)
|
||||
getData(false)
|
||||
|
||||
if (sleep == 7) {
|
||||
chartLineAmi()
|
||||
}
|
||||
|
||||
index++
|
||||
}, timerNumber)
|
||||
}
|
||||
|
||||
function chartLineAmi() {
|
||||
const obj = formatChartData()
|
||||
let index = 0
|
||||
let currentIndex = 0
|
||||
const timerNumber = 3000
|
||||
timer && clearInterval(timer)
|
||||
let legendIndex = legendData.length
|
||||
let sleep = 6000 / 3000
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % legendData.length
|
||||
if (currentIndex == 0) {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'hideTip',
|
||||
})
|
||||
if (legendIndex == legendData.length) {
|
||||
legendData.forEach((_, index) => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendUnSelect',
|
||||
|
|
@ -180,21 +169,17 @@
|
|||
})
|
||||
})
|
||||
}
|
||||
getInstance()?.setOption({
|
||||
series: [obj.series[currentIndex]],
|
||||
})
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[currentIndex],
|
||||
})
|
||||
if (currentIndex == legendData.length - 1) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
chartAmi()
|
||||
}, timerNumber)
|
||||
if (legendIndex >= 0) {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[legendIndex - 1],
|
||||
})
|
||||
}
|
||||
|
||||
index++
|
||||
if (legendIndex <= 0) {
|
||||
if (sleep <= 0) getData()
|
||||
sleep--
|
||||
}
|
||||
legendIndex--
|
||||
}, timerNumber)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,23 +62,19 @@
|
|||
|
||||
const { setOptions, getInstance } = useECharts(chartRef as Ref<HTMLDivElement>)
|
||||
|
||||
async function getData(init = true) {
|
||||
async function getData() {
|
||||
const resData = await getMateriel({
|
||||
year: visualizationStore.getYear,
|
||||
type: currentTab.value,
|
||||
})
|
||||
Data.x_axis = resData.x_axis
|
||||
Data.series = resData.series
|
||||
if (init) {
|
||||
chartsInit()
|
||||
} else {
|
||||
chartLineAmi()
|
||||
}
|
||||
chartsInit()
|
||||
}
|
||||
|
||||
let legendData = [] as any
|
||||
|
||||
function formatChartData() {
|
||||
const chartsInit = () => {
|
||||
const obj = {
|
||||
legendData: [] as any,
|
||||
series: [] as any,
|
||||
|
|
@ -116,11 +112,7 @@
|
|||
})
|
||||
|
||||
legendData = obj.legendData
|
||||
return obj
|
||||
}
|
||||
|
||||
const chartsInit = () => {
|
||||
const obj = formatChartData()
|
||||
setOptions({
|
||||
grid: { left: '2%', right: '2%', top: '50px', bottom: '2%', containLabel: true },
|
||||
legend: {
|
||||
|
|
@ -200,40 +192,36 @@
|
|||
function chartAmi() {
|
||||
let index = 0
|
||||
const timerNumber = 3000
|
||||
let sleep = 1
|
||||
timer && clearInterval(timer)
|
||||
let currentIndex = 0
|
||||
let sleep = 0
|
||||
const fo = 2
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % 4
|
||||
sleep = index % (4 * fo)
|
||||
const currentIndex = index % 4
|
||||
sleep = index % (4 * 2)
|
||||
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'showTip',
|
||||
seriesIndex: 0,
|
||||
dataIndex: currentIndex,
|
||||
})
|
||||
if (sleep + 1 >= 4 * fo) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'hideTip',
|
||||
})
|
||||
}, timerNumber)
|
||||
getData(false)
|
||||
|
||||
if (sleep == 7) {
|
||||
chartLineAmi()
|
||||
}
|
||||
|
||||
index++
|
||||
}, timerNumber)
|
||||
}
|
||||
|
||||
function chartLineAmi() {
|
||||
const obj = formatChartData()
|
||||
let index = 0
|
||||
let currentIndex = 0
|
||||
const timerNumber = 3000
|
||||
timer && clearInterval(timer)
|
||||
let legendIndex = legendData.length
|
||||
let sleep = 6000 / 3000
|
||||
timer = setInterval(() => {
|
||||
currentIndex = index % legendData.length
|
||||
if (currentIndex == 0) {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'hideTip',
|
||||
})
|
||||
if (legendIndex == legendData.length) {
|
||||
legendData.forEach((_, index) => {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendUnSelect',
|
||||
|
|
@ -241,21 +229,17 @@
|
|||
})
|
||||
})
|
||||
}
|
||||
getInstance()?.setOption({
|
||||
series: [obj.series[currentIndex]],
|
||||
})
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[currentIndex],
|
||||
})
|
||||
if (currentIndex == legendData.length - 1) {
|
||||
timer && clearInterval(timer)
|
||||
setTimeout(() => {
|
||||
chartAmi()
|
||||
}, timerNumber)
|
||||
if (legendIndex >= 0) {
|
||||
getInstance()?.dispatchAction({
|
||||
type: 'legendSelect',
|
||||
name: legendData[legendIndex - 1],
|
||||
})
|
||||
}
|
||||
|
||||
index++
|
||||
if (legendIndex <= 0) {
|
||||
if (sleep <= 0) getData()
|
||||
sleep--
|
||||
}
|
||||
legendIndex--
|
||||
}, timerNumber)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue