|
@@ -0,0 +1,85 @@
|
|
|
+import { type PropType } from 'vue';
|
|
|
+import { EChartsOption, color } 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 = {
|
|
|
+ width: 400,
|
|
|
+ height: 260,
|
|
|
+ legend: {
|
|
|
+ },
|
|
|
+ tooltip: {},
|
|
|
+ xAxis: {
|
|
|
+ type: 'category',
|
|
|
+ itemStyle: {
|
|
|
+ color: '#fff'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ yAxis: {},
|
|
|
+ series: [
|
|
|
+ { type: 'line', itemStyle: { color: '#1890ff' }},
|
|
|
+ { type: 'line', itemStyle: { color: '#2fc25b' }}
|
|
|
+ ],
|
|
|
+ dataset: {
|
|
|
+ dimensions: ['month', 'city', 'city2'],
|
|
|
+ source: [
|
|
|
+ { month: '一月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '二月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '三月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '四月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '五月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '六月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '七月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '八月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '九月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '十月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '十一月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ { month: '十二月', city: Math.floor(Math.random() * 100), city2: Math.floor(Math.random() * 100) },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+}
|