Browse Source

折线图

han_v3
herenshan112 4 months ago
parent
commit
e6f89f80f1
  1. 80
      src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/line.vue

80
src/views/sysworkflow/lowcodepage/appPage/appPageForm/echatesUnit/chart/line.vue

@ -4,6 +4,7 @@
@ 备注: 折线图 @ 备注: 折线图
--> -->
<script lang="ts" setup> <script lang="ts" setup>
import { analyzeChartData } from "@/api/chart/index";
import { echatsViews } from "@/api/DesignForm/types"; import { echatsViews } from "@/api/DesignForm/types";
import * as echarts from "echarts"; import * as echarts from "echarts";
@ -33,40 +34,52 @@ const drawPie = () => {
myChartPie.value = echarts.init( myChartPie.value = echarts.init(
document.getElementById(props.uuid) as HTMLDivElement document.getElementById(props.uuid) as HTMLDivElement
); );
myChartPie.value.setOption({ analyzeChartData({ tableKey: props.tableKey, chartId: props.uuid }).then((data) => {
grid: { console.log("火兔", data);
let optVal = data.data;
optVal.grid = {
left: "2%", left: "2%",
right: "2%", right: "2%",
bottom: "5%", bottom: "15%",
top: "15%", top: "15%",
containLabel: true, containLabel: true,
}, };
xAxis: { myChartPie.value.setOption(optVal);
type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
},
legend: {
data: ["销量", "销量科技"],
},
yAxis: {
type: "value",
},
series: [
{
name: "销量",
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: "line",
smooth: true,
},
{
name: "销量科技",
data: [822, 942, 951, 4, 1290, 1330, 1320],
type: "line",
smooth: true,
},
],
}); });
console.log("画图完毕---->", props); // myChartPie.value.setOption({
// grid: {
// left: "2%",
// right: "2%",
// bottom: "5%",
// top: "15%",
// containLabel: true,
// },
// xAxis: {
// type: "category",
// data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
// },
// legend: {
// data: ["", ""],
// },
// yAxis: {
// type: "value",
// },
// series: [
// {
// name: "",
// data: [820, 932, 901, 934, 1290, 1330, 1320],
// type: "line",
// smooth: true,
// },
// {
// name: "",
// data: [822, 942, 951, 4, 1290, 1330, 1320],
// type: "line",
// smooth: true,
// },
// ],
// });
// console.log("---->", props);
} }
}; };
/** /**
@ -82,7 +95,14 @@ const searBut = (val: string) => {
} }
return false; return false;
}; };
watch(
() => props.data,
(val: any) => {
console.log("画图完毕--改变-->", val);
drawPie();
},
{ deep: true }
);
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
drawPie(); drawPie();

Loading…
Cancel
Save