echarts 折线统计图置样式修改

 var myChart = echarts.init(document.getElementById('id'));
    setEchart4();
    /*租赁图*/
     function setEchart4(){
        // 指定图表的配置项和数据
        var option = {
             grid: { //图表绘制与上下左右的距离
                left: '5%',
                right: '5%',
                bottom: '10%',
             },
             tooltip: {
                trigger: 'axis',
                formatter: function(params) {
                    return "日期:" + params[0].name + ":00<br/>" +
                         "资产原值:" + params[0].value + "Km/h<br/>";
                },
                axisPointer: {
                    type: 'line',
                    lineStyle: {
                        color: "#5793f3",
                        width: 2,
                        type: 'dashed'
                    }
                },
                backgroundColor: 'rgba(16,75,136,.5)',
                borderColor: "rgba(50,243,255,1)",
                borderWidth: 1,
            },
            xAxis: {//x轴
                 min:0, // 设置x轴刻度的最小值
                type: 'category',
                boundaryGap: false,
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                axisLine:{//坐标轴线
                        show:true,
                        lineStyle:{
                            color:'rgba(29, 32, 136, 1)'
                        }
                   },
                 axisTick:{//坐标轴线是否向内
                     inside:false,

                     lineStyle:{
                        color:'rgba(0, 160, 233, 1)'
                     }
               },
               axisLabel:{//坐标轴刻度设置
                color:'rgba(40, 40, 40, 1)'
               },

            },
            yAxis: {
                min:0, // 设置y轴刻度的最小值
                type: 'value',
                axisLine:{
                   show:true,
                   lineStyle:{
                   color:'rgba(0, 160, 233, 1)'
                 }
               },
               axisTick:{//坐标轴线是否向内
                 inside:true,
                 lineStyle:{
                    color:'rgba(0, 160, 233, 1)'
                 }

               },
                axisLabel:{//坐标轴刻度设置
                color:'rgba(40, 40, 40, 1)'
               },
                splitLine:{show: false},//去除网格线

            },
            series: [{
                data: [820, 932, 901, 934, 1290, 1330, 1320],
                type: 'line',
                smooth:false,//是否平滑曲线显示。
                symbol: 'circle',//标记的图形。
                symbolSize: 4,//标记的大小
                itemStyle: {//图像标记颜色 修改颜色时symbol、symbolSize需要进行设置
                    normal: {
                        color: 'rgba(0, 192, 255, 1)',
                        borderColor: 'rgba(29,32,136,1)',
                        borderWidth: 1,
                        borderType: 'solid',
                        shadowColor: 'rgba(29,32,136,1)',
                        shadowBlur: 4,
                    },
                 },
                lineStyle:{//折线线条颜色
                    normal:{
                        color:'rgba(29, 32, 136, 1)'
                    }
                },
                areaStyle: {//图表覆盖颜色设置
                 normal: {
                   borderColor: 'rgba(29,32,136,1)',
                     color:{
                          type: 'linear',
                    x: 0,
                    y: 0,
                    x2: 0,
                    y2: 1,
                    colorStops: [{
                        offset: 0, color: 'rgba(180, 0, 255, 1)' // 0% 处的颜色
                    }, {
                        offset: 1, color: 'rgba(0, 192, 255, 1)' // 100% 处的颜色
                    }],
                    global: false // 缺省为 false
                     }

                }
                }
            }]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
     }
//图表根据窗口大小显示
$(window).resize(myChart.resize);

<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.2.1/echarts.min.js" type="text/javascript" charset="utf-8"></script>

结果截图:

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值