关于echarts常见的配置项运用

包含对标题 图表位置  工具栏  xy轴边框颜色以及刻度颜色   网格样式  拐点颜色的配置  详情见代码 

<!DOCTYPE html>
<html>
<head>
	<title>echarts</title>
	<style type="text/css">
		*{
			margin: 0;
			padding: 0;
		}
		html,body{
			width: 100%;height: 100%;background: #0F1330;
		}
		#charts1{
			width: 600px;
			height: 400px;
			background: #0F214C;
			border: 2px solid #0F51A6;
			margin: 10px 0 0 10px;
		}

	</style>
</head>
<body>
	<div class="echarts">
		<!-- 折线图渐变 -->
		<div id="charts1">
				
		</div>
	</div>


	<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
	<script src="echarts.min.js"></script>

	<script type="text/javascript">
		var echarts1 = echarts.init(document.getElementById('charts1'));
		var option = {
			// 配置项  常用的是text  与 textStyle
    title: {
        text: '折线图颜色渐变',
         textStyle:{
        //文字颜色
        color:'#fff',
        //字体风格,'normal','italic','oblique'
        fontStyle:'normal',
        //字体粗细 'normal','bold','bolder','lighter',100 | 200 | 300 | 400...
        fontWeight:'bold',
        //字体系列
        fontFamily:'sans-serif',
        //字体大小
     fontSize:18,
    	}
    },
    // 提示框组件  item 散点图饼图  axis 柱状图 折线图   no 
    tooltip: {
        trigger: 'axis'
    },
    // 图标位置
    grid: {
        left: '10%',
        right: '6%',
        bottom: '6%',
        containLabel: false
    },
    //工具栏 内置导出图片 数据图  等五个工具
    toolbox: {
        feature: {
            saveAsImage: {}
        }
    },

    xAxis: {
        type: 'category',
        boundaryGap: false,
        data: [8,10,12,14,16,18,20,22,24,2,4,6],
        // 控制边框颜色
         axisLine: {
	            lineStyle: {
	                type: 'solid',
	                color: '#00F8F9',//左边线的颜色
	                width:'2'//坐标线的宽度
	            }
	        },
	       // 刻度
	        axisLabel: {
              textStyle: {
                color: '#fff',//坐标值得具体的颜色
              }
          },


    },
    yAxis: {
        type: 'value',
        axisLine: {
	            lineStyle: {
	                type: 'solid',
	                color: '#00F8F9',//左边线的颜色
	                width:'2'//坐标线的宽度
	            }
	        },
	      axisLabel: {
						color: "#fff" 
					},
					// 网格样式
				splitLine: {
          show: true,
          lineStyle:{
               color: "#333",
               width: 1,
              type: 'solid'
          }
        }

    },
    series: [
        {
            name:'',
            type:'line',
            color:['#00F8F9'],	// 拐点颜色
            // symbol:'circle',	// 实心圆
            symbolSize:4,			// 
            // 设置颜色渐变
            areaStyle: {normal: {
                color: new echarts.graphic.LinearGradient(
                        0, 0, 0, 1,
                        [
                            {offset: 0, color: '#01F9FE'},
                            {offset: 0.5, color: '#04666E'},
                            {offset: 1, color: '#000'}
                        ]
                ),           
              }},
              // 折线的颜色修改
              itemStyle : {
                normal : {
                  lineStyle:{
                    color:'#00F8F9',
                    type:"dashed"       // 虚线  dotted 圆点
                  },
                  label:{               // 显示折点数据
                    show:true,
                  }
                }
              },
            data:[1350, 300, 800, 200, 700, 100, 1,600,1	]
        }
    ]
};
echarts1.setOption(option)


	</script>


</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值