| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- import * as echarts from "echarts";
- const commonxAxis = {
- axisLabel: { color: '#9F9F9F' },
- axisLine: { lineStyle: { color: 'rgba(185, 185, 185, 0.12)' } },
- }
- const commonyAxis = {
- splitLine: { lineStyle: { color: 'rgba(185, 185, 185, 0.12)' } },
- axisLabel: {
- color: "#9F9F9F",
- },
- }
- export const pieOption = {
- tooltip: {
- trigger: 'item',
- textStyle: {
- color: "#1D2129",
- fontSize: 11,
- },
- formatter: function (params) {
- const data = params.data;
- const total = 3774;
- const percent = (data.value / total * 100).toFixed(2);
- return `${params.marker}${data.name} ${percent}% ${data.value}亩`;
- }
- },
- title: {
- text: '总种植面积(亩)',
- subtext: '1000',
- x: '49%',
- y: '39%',
- textAlign: 'center',
- textStyle: {
- fontSize: 11,
- fontWeight: 'normal',
- color: '#FFFFFF'
- },
- subtextStyle: {
- fontSize: 13,
- fontWeight: 'normal',
- color: '#FFFFFF'
- }
- },
- color: ['#2199F8', '#14C9C9', '#FFCC4B', '#8F46F4', '#FF7878', '#9FDB1D'],
- series: [
- {
- name: '种植作物',
- type: 'pie',
- radius: ['56%', '86%'],
- label: {
- show: false,
- position: 'center'
- },
- labelLine: {
- show: false
- },
- data: [
- { value: 1048, name: '水稻' },
- { value: 735, name: '小麦' },
- { value: 580, name: '猫草' },
- { value: 484, name: '中草药' },
- { value: 300, name: '蔬菜' },
- { value: 300, name: '荔枝' },
- ]
- }
- ]
- };
- export const barOption = {
- grid: {
- top: 20,
- left: 10,
- right: 10,
- bottom: 10,
- containLabel: true,
- },
- xAxis: {
- type: 'category',
- ...commonxAxis,
- data: ['从化区', '增城区', '花都区', '番禺区', '南沙区', '从化区', '荔湾区']
- },
- yAxis: {
- type: 'value',
- ...commonyAxis,
- axisLabel: {
- formatter: "{value}%",
- color: "#9F9F9F",
- },
- },
- series: [
- {
- data: [50, 20, 15, 58, 7, 28, 13],
- type: 'bar',
- barWidth: 10,
- itemStyle: {
- borderRadius: [8, 8, 0, 0],
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: '#FFD489',
- },
- {
- offset: 1,
- color: '#996324',
- },
- ]),
- },
- }
- ]
- }
- export const lineOption = {
- tooltip: {
- trigger: 'axis'
- },
- grid: {
- top: 20,
- left: 10,
- right: 10,
- bottom: 10,
- containLabel: true,
- },
- xAxis: {
- ...commonxAxis,
- type: 'category',
- boundaryGap: false,
- data: ['2023-6', '2023-12', '2024-6', '2024-12', '2025-6', '2025-12']
- },
- yAxis: {
- ...commonyAxis,
- type: 'value'
- },
- series: [
- {
- name: '粮食',
- type: 'line',
- smooth: true,
- showSymbol: false,
- itemStyle: {
- color: '#178B00'
- },
- lineStyle: {
- color: '#178B00'
- },
- data: [250, 232, 221, 294, 310, 380]
- },
- {
- name: '果类',
- type: 'line',
- smooth: true,
- showSymbol: false,
- itemStyle: {
- color: '#2199F8'
- },
- lineStyle: {
- color: '#2199F8'
- },
- data: [220, 182, 191, 234, 290, 330]
- },
- {
- name: '蔬菜',
- type: 'line',
- smooth: true,
- showSymbol: false,
- itemStyle: {
- color: '#FAA53D'
- },
- lineStyle: {
- color: '#FAA53D'
- },
- data: [120, 132, 101, 134, 90, 230]
- },
- ]
- };
|