//全局随机数重写
const random = Math.random;
Math.random = (a = 0, b = 1, c = 6) => {
	return (random() * (b - a) + a).toFixed(c) - 0;
};
export default {
    mName : "TitleEcharts",
    edit : "Echarts",
    keys : {
        title: "标题",
        config: {
            legend: {
                data: {
                    _name: "图例列表",
                    name: "对应数据名称"
                }
            },
            series: {
                data: {
                    name: "名称",
                    value: "数据",
                    color: "颜色"
                }
            }
        }
    },
    option : {
        grid: {x: '6%', y: '5%', width: '90%', height: '70%'},
        legend: {
            icon:"roundRect",
            left: "5%",
            bottom: "5%",
            itemHeight: 8,
            itemWidth: 16,
            itemGap: 10,
            textStyle: {
                fontSize: 12,
                color: '{c}'
            }
        },
        xAxis: {
            boundaryGap: false,
            axisLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            axisLabel: {
                color: "rgba(50, 86, 111, 1)",
                fontSize: 10
            },
            data: new Array(10).fill().map((x,i)=>{
                return {
                    value:i
                };
            })
        },
        yAxis: {
            show: true,
            scale: true,
            minInterval: 0.1,
            axisLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            axisLabel: {
                color: "rgba(50, 86, 111, 1)",
                fontSize: 10
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(50, 86, 111, 0.2)'
                }
            }
        },
        tooltip: {
            trigger: 'axis',
            enterable: true,
            renderMode: "richText",
            confine: false,
            axisPointer: {
                lineStyle: {
                    width: 1,
                    color: {
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [
                            {
                                offset: 0,
                                color: '#1a76e6' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: 'rgba(29,236,198,0)' // 100% 处的颜色
                            }
                        ]
                    }
                }
            }
        },
        series: [
            {
                type: 'line',
                smooth: true,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        width: 1
                    }
                },
                areaStyle: {
                    normal: {
                        color: {
                            type: 'linear',
                            x2: 0,
                            y2: 1,
                            colorStops: [
                                {
                                    offset: 1,
                                    color: 'rgba(122, 253, 101, 0)' // 0% 处的颜色
                                }, {
                                    offset: 0,
                                    color: 'rgba(75, 252, 0, 0.4)' // 100% 处的颜色
                                }
                            ]
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgba(74, 255, 0, 0.6)'
                    }
                },
                data: new Array(10).fill().map(x=>{
                    return Math.random(0,20,1);
                })
            },
            {
                type: 'line',
                smooth: true,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        width: 1
                    }
                },
                areaStyle: {
                    normal: {
                        color: {
                            type: 'linear',
                            x2: 0,
                            y2: 1,
                            colorStops: [
                                {
                                    offset: 1,
                                    color: 'rgba(252, 253, 101, 0)' // 0% 处的颜色
                                }, {
                                    offset: 0,
                                    color: 'rgba(252, 253, 101, 0.4)' // 100% 处的颜色
                                }
                            ]
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgba(252, 253, 101, 0.6)'
                    }
                },
                data: new Array(10).fill().map(x=>{
                    return {
                        value:Math.random(0,30,1)
                    };
                })
            },
            {
                type: 'line',
                smooth: true,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        width: 1
                    }
                },
                areaStyle: {
                    normal: {
                        color: {
                            type: 'linear',
                            x2: 0,
                            y2: 1,
                            colorStops: [
                                {
                                    offset: 1,
                                    color: 'rgba(8, 106, 189, 0)' // 0% 处的颜色
                                }, {
                                    offset: 0,
                                    color: 'rgba(8, 106, 189, .4)' // 100% 处的颜色
                                }
                            ]
                        }
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgba(8, 106, 189, .6)'
                    }
                },
                data: new Array(10).fill().map(x=>{
                    return {
                        value:Math.random(0,30,1)
                    };
                })
            }
        ]
    },
    data : {
        title: '2018年生产销售数据',
        config: {
            legend: {
                data: [
                    {
                        name: '野谷米'
                    }, {
                        name: '盛世竹香'
                    }, {
                        name: '玉珍香'
                    }
                ]
            }
        }
    }
}