|
@@ -0,0 +1,106 @@
|
|
|
+import { type PropType } from 'vue';
|
|
|
+import { EChartsOption } from 'echarts';
|
|
|
+
|
|
|
+export const basicLineProps = {
|
|
|
+ width: {
|
|
|
+ type: Number as PropType<number>,
|
|
|
+ default: 400,
|
|
|
+ },
|
|
|
+ height: {
|
|
|
+ type: Number as PropType<number>,
|
|
|
+ default: 260,
|
|
|
+ },
|
|
|
+ // 标题
|
|
|
+ title: {
|
|
|
+ type: Object as PropType<EChartsOption['title']>,
|
|
|
+ },
|
|
|
+ // 图例
|
|
|
+ legend: {
|
|
|
+ type: Object as PropType<EChartsOption['legend']>
|
|
|
+ },
|
|
|
+ // 背景
|
|
|
+ backgroundColor: {
|
|
|
+ type: String as PropType<string>,
|
|
|
+ },
|
|
|
+ // 边框
|
|
|
+ grid: {
|
|
|
+ type: Object as PropType<EChartsOption['grid']>,
|
|
|
+ },
|
|
|
+ // 提示框
|
|
|
+ tooltip: {
|
|
|
+ type: Object as PropType<EChartsOption['tooltip']>,
|
|
|
+ },
|
|
|
+ // x轴数据
|
|
|
+ xAxis: {
|
|
|
+ type: Object as PropType<EChartsOption['xAxis']>,
|
|
|
+ },
|
|
|
+ // y轴数据
|
|
|
+ yAxis: {
|
|
|
+ type: Object as PropType<EChartsOption['yAxis']>,
|
|
|
+ },
|
|
|
+ // 折线
|
|
|
+ series: {
|
|
|
+ type: Array as PropType<EChartsOption['series']>,
|
|
|
+ },
|
|
|
+ // 数据集
|
|
|
+ dataset: {
|
|
|
+ type: Object as PropType<EChartsOption['dataset']>,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+export const defaultPropsValue: EChartsOption = {
|
|
|
+ width: 400,
|
|
|
+ height: 260,
|
|
|
+ title: {
|
|
|
+ text: '柱状图标题',
|
|
|
+ left: 'center',
|
|
|
+ top: 8,
|
|
|
+ textStyle: {
|
|
|
+ color: '#fff',
|
|
|
+ fontSize: 16
|
|
|
+ }
|
|
|
+ },
|
|
|
+ legend: {
|
|
|
+ textStyle: {
|
|
|
+ color: '#fff',
|
|
|
+ },
|
|
|
+ top: 32
|
|
|
+ },
|
|
|
+ grid: {
|
|
|
+ bottom: 34,
|
|
|
+ right: 20,
|
|
|
+ top: 60
|
|
|
+ },
|
|
|
+ backgroundColor: 'rgba(0,0,0,0.1)',
|
|
|
+ tooltip: {},
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ axisLabel: {
|
|
|
+ color: '#9fadbf'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {
|
|
|
+ axisLabel: {
|
|
|
+ color: '#9fadbf'
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ lineStyle: {
|
|
|
+ type: 'dashed',
|
|
|
+ color: '#36485f'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ { type: 'bar', itemStyle: { color: '#1890ff' }},
|
|
|
+ { type: 'bar', itemStyle: { color: '#2fc25b' }}
|
|
|
+ ],
|
|
|
+ dataset: {
|
|
|
+ dimensions: ['serie', '系列1', '系列2'],
|
|
|
+ source: [
|
|
|
+ { serie: '轴标签A', '系列1': 43.3, '系列2': 85.8 },
|
|
|
+ { serie: '轴标签B', '系列1': 43.3, '系列2': 85.8 },
|
|
|
+ { serie: '轴标签C', '系列1': 43.3, '系列2': 85.8 },
|
|
|
+ { serie: '轴标签D', '系列1': 43.3, '系列2': 85.8 },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+}
|