自定义echarts的toolbox事件(dataView表格)

本文介绍了一个使用ECharts实现的表格与图表联动的示例,通过配置toolbox的各项功能,包括显示标记、数据视图、魔法类型切换等,实现了数据的直观展示。文章详细展示了如何设置表格样式及如何在不同类型的图表间进行切换。

原文出处:https://blog.youkuaiyun.com/u012890715/article/details/78857086
 

toolbox: {
                show : true,
                feature : {
                    mark : {show: true},
                    dataView : {
                    	show: true, readOnly: true,
                    	optionToContent : function(opt) {
                    		var table = $("#tableDiv").html();
                    		return table;
                    	}
                    },
                    magicType : {show: true, type: ['line', 'bar']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            }
<div id="tableDiv">
	    	<div id="lineDiv" style='position:absolute;z-index:9999;'></div>
		    <table cellspacing="0" cellpadding="0" style="border-collapse:collapse; width: 100%;margin-top: 20px;">
		      	<tr style="background-color: gainsboro;">
		          <th id="lineTd" style="border:#000000 solid 1px;width:10%;height:76px;" 
		          	points="[110,79,222,42,222,79]">                                 类型<br>
		          			         <br>                          级别<br>     年份</th>
		          <th style="text-align:center;border:#000000 solid 1px;height:45px;font-size: 18px;" colspan="4">咨询类</th>        
		          <th style="text-align:center;border:#000000 solid 1px;height:45px;font-size: 18px;" colspan="4">运维类</th>        
		          <th style="text-align:center;border:#000000 solid 1px;height:45px;font-size: 18px;" colspan="4">开发类</th>        
		          <th style="text-align:center;border:#000000 solid 1px;height:45px;font-size: 18px;">合计</th>        
		        </tr>
		        <tr>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">--</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">A</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">B</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">C</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">小计</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">A</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">B</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">C</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">小计</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">A</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">B</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">C</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">小计</th>
		            <th style="text-align:center;border:#000000 solid 1px;width:89px;height:32px;">--</th>
		        </tr>
		    </table>
	    </div>


 

评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值