提交 cdbcf42f 编写于 作者: L loutongbing

修改了韦恩图的配置

上级 946dc2a7
......@@ -3773,13 +3773,6 @@ indicator : [
<td> null </td>
<td> 数据值 </td>
</tr>
<tr>
<td> <b>{String}</b> color </td>
<td> 系统配色 </td>
<td>
颜色,用16进制表示,例如:'#999933'
</td>
</tr>
<tr>
<td> <b>{Object}</b> itemStyle </td>
<td> {} </td>
......
......@@ -89,8 +89,8 @@ option = {
}
},
data:[
{value:100, name:'访问',color: '#999933'},
{value:50, name:'咨询',color: '#669999'},
{value:100, name:'访问'},
{value:50, name:'咨询'},
{value:20, name:'公共'}
]
}
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ECharts">
<meta name="author" content="kener.linfeng@gmail.com">
<title>ECharts · Example</title>
<link rel="shortcut icon" href="../asset/ico/favicon.png">
<link href="../asset/css/font-awesome.min.css" rel="stylesheet">
<link href="../asset/css/bootstrap.css" rel="stylesheet">
<link href="../asset/css/carousel.css" rel="stylesheet">
<link href="../asset/css/echartsHome.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="./www/js/echarts.js"></script>
<script src="../asset/js/codemirror.js"></script>
<script src="../asset/js/javascript.js"></script>
<link href="../asset/css/codemirror.css" rel="stylesheet">
<link href="../asset/css/monokai.css" rel="stylesheet">
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
<div class="container-fluid">
<div class="row-fluid example">
<div id="sidebar-code" class="col-md-4">
<div class="well sidebar-nav">
<div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
<textarea id="code" name="code">
option = {
title : {
text: '访问 vs 咨询',
subtext: '配置的例子'
},
tooltip : {
trigger: 'item',
formatter: "{b}: {c}"
},
toolbox: {
show : true,
feature : {
mark : {show: true},
dataView : {show: true, readOnly: false},
restore : {show: true},
saveAsImage : {show: true}
}
},
calculable : false,
series : [
{
name:'韦恩图',
type:'venn',
itemStyle: {
normal: {
label: {
show: true,
textStyle: {
fontFamily: 'Arial, Verdana, sans-serif',
fontSize: 16,
fontStyle: 'italic',
fontWeight: 'bolder'
}
},
labelLine: {
show: false,
length: 10,
lineStyle: {
// color: 各异,
width: 1,
type: 'solid'
}
}
},
emphasis: {
color: '#cc99cc',
borderWidth: 3,
borderColor: '#996699'
}
},
data:[
{
value:100,
name:'访问',
itemStyle: {
normal: {
color: '#99cccc'
},
emphasis: {
color: '#2ec7c0',
borderWidth: 3,
borderColor: '#ffffcc'
}
}
},
{
value:50,
name:'咨询',
itemStyle: {
normal: {
color: '#99ccff'
}
}
},
{
value:20,
name:'公共',
itemStyle: {
normal: {
color: '#9999cc'
},
emphasis: {
color: '#ccffcc'
}
}
}
]
}
]
};
</textarea>
</div><!--/.well -->
</div><!--/span-->
<div id="graphic" class="col-md-8">
<div id="main" class="main"></div>
<div>
<button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
<span class="text-primary">切换主题</span>
<select id="theme-select"></select>
<span id='wrong-message' style="color:red"></span>
</div>
</div><!--/span-->
</div><!--/row-->
</div><!--/.fluid-container-->
<footer id="footer"></footer>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../asset/js/jquery.min.js"></script>
<script type="text/javascript" src="../asset/js/echartsHome.js"></script>
<script src="../asset/js/bootstrap.min.js"></script>
<script src="../asset/js/echartsExample.js"></script>
</body>
</html>
......@@ -95,14 +95,12 @@ define(function (require) {
var y = this.zr.getHeight() / 2;
this._buildItem(
0, 0,
data[0].color || this.zr.getColor(0),
x0,
y,
r0
);
this._buildItem(
0, 1,
data[1].color || this.zr.getColor(1),
x1,
y,
r1
......@@ -132,8 +130,7 @@ define(function (require) {
rightLargeArcFlag = 1;
}
this._buildCoincideItem(
2, 2,
data[2].color || this.zr.getColor(2),
2,
x0 + xLeft,
y - h,
y + h,
......@@ -203,13 +200,13 @@ define(function (require) {
* 构建单个圆及指标
*/
_buildItem : function (
seriesIndex, dataIndex, defaultColor,
seriesIndex, dataIndex,
x, y, r
) {
var series = this.series;
var circle = this.getCircle(
seriesIndex, dataIndex, defaultColor,
dataIndex,
x, y, r
);
ecData.pack(
......@@ -223,7 +220,7 @@ define(function (require) {
if (series[0].itemStyle.normal.label.show) {
// 文本标签
var label = this.getLabel(
seriesIndex, dataIndex, defaultColor,
dataIndex,
x, y, r
);
ecData.pack(
......@@ -237,7 +234,7 @@ define(function (require) {
},
_buildCoincideItem : function (
seriesIndex, dataIndex, defaultColor,
dataIndex,
x, y0, y1, r0, r1, rightLargeArcFlag, leftLargeArcFlag
) {
var series = this.series;
......@@ -254,15 +251,14 @@ define(function (require) {
queryTarget,
'itemStyle.emphasis'
) || {};
var emphasisColor = this.getItemStyleColor(emphasis.color, seriesIndex, dataIndex, data)
|| defaultColor;
var normalColor = normal.color || this.zr.getColor(dataIndex);
var emphasisColor = emphasis.color || this.zr.getColor(dataIndex);
var path = 'M' + x + ',' + y0
+ 'A' + r0 + ',' + r0 + ',0,' + rightLargeArcFlag + ',1,' + x + ',' + y1
+ 'A' + r1 + ',' + r1 + ',0,' + leftLargeArcFlag + ',1,' + x + ',' + y0;
var style = {
color: defaultColor,
color: normalColor,
// path: rx ry x-axis-rotation large-arc-flag sweep-flag x y
path: path
};
......@@ -293,7 +289,7 @@ define(function (require) {
* 构建圆形
*/
getCircle : function (
seriesIndex, dataIndex, defaultColor,
dataIndex,
x, y, r
) {
var serie = this.series[0];
......@@ -309,9 +305,8 @@ define(function (require) {
queryTarget,
'itemStyle.emphasis'
) || {};
var emphasisColor = this.getItemStyleColor(emphasis.color, seriesIndex, dataIndex, data)
|| defaultColor;
var normalColor = normal.color || this.zr.getColor(dataIndex);
var emphasisColor = emphasis.color || this.zr.getColor(dataIndex);
var circle = {
zlevel: this.getZlevelBase(),
......@@ -322,8 +317,8 @@ define(function (require) {
r: r,
brushType: 'fill',
opacity: 1,
color: defaultColor
} ,
color: normalColor
},
highlightStyle: {
color: emphasisColor,
lineWidth: emphasis.borderWidth,
......@@ -343,18 +338,26 @@ define(function (require) {
* 需要显示则会有返回构建好的shape,否则返回undefined
*/
getLabel : function (
seriesIndex, dataIndex, defaultColor,
dataIndex,
x, y, r
) {
var serie = this.series[0];
var itemStyle = serie.itemStyle;
var data = this.data[dataIndex];
var queryTarget = [data, serie];
// 多级控制
var normal = this.deepMerge(
queryTarget,
'itemStyle.normal'
) || {};
var status = 'normal';
// label配置
var labelControl = itemStyle[status].label;
var textStyle = labelControl.textStyle || {};
var text = this.getLabelText(seriesIndex, dataIndex, status);
var text = this.getLabelText(dataIndex, status);
var textFont = this.getFont(textStyle);
var textColor = defaultColor;
var textColor = normal.color || this.zr.getColor(dataIndex);
// 求出label的纵坐标
var textSize = textStyle.fontSize || 12;
......@@ -376,7 +379,7 @@ define(function (require) {
/**
* 根据lable.format计算label text
*/
getLabelText : function (seriesIndex, dataIndex, status) {
getLabelText : function (dataIndex, status) {
var series = this.series;
var serie = series[0];
var data = serie.data[dataIndex];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册