提交
This commit is contained in:
@ -41,6 +41,7 @@ let lineChart: any = null;
|
||||
// 土地数据 折线图
|
||||
const designAreaData = ref([]);
|
||||
const transferAreaData = ref([]);
|
||||
const barNames = ref([]);
|
||||
// 饼图数据
|
||||
let pieData = [
|
||||
{ label: 'areaPercentage', name: '场区', value: 0 },
|
||||
@ -66,12 +67,13 @@ const initPieChart = () => {
|
||||
pieChart.setOption(pieOption);
|
||||
};
|
||||
|
||||
// 初始化折线图
|
||||
// 初始柱状图线图
|
||||
const initLineChart = () => {
|
||||
if (!lineChartRef.value) {
|
||||
console.error('未找到折线图容器元素');
|
||||
return;
|
||||
}
|
||||
barOption.xAxis.data = barNames.value;
|
||||
barOption.series[0].data = designAreaData.value;
|
||||
barOption.series[1].data = transferAreaData.value;
|
||||
lineChart = echarts.init(lineChartRef.value, null, {
|
||||
@ -88,6 +90,8 @@ const getScreenLandData = async () => {
|
||||
const res = await getScreenLand(projectIdTwo);
|
||||
const { data, code } = res;
|
||||
if (code === 200) {
|
||||
console.log(data);
|
||||
barNames.value = res.data.map((item: any) => item.landName);
|
||||
designAreaData.value = data.map((item: any) => Number(item.designArea));
|
||||
transferAreaData.value = data.map((item: any) => Number(item.transferArea));
|
||||
initLineChart();
|
||||
|
||||
Reference in New Issue
Block a user