提交 cc83b5b1 编写于 作者: L lang

Force 节点symbol支持图片

上级 d2808391
......@@ -102,7 +102,6 @@ option = {
linkStyle : {}
}
},
useWorker: false,
minRadius : 15,
maxRadius : 25,
gravity: 1.1,
......@@ -114,15 +113,13 @@ option = {
nodes:[
{
category:0, name: '乔布斯', value : 10,
symbol: 'star',
symbolSize: 40,
symbol: 'image://http://www.cnii.com.cn/hg/zt/2012315zt/content/attachement/jpg/site2/20120217/00137274b1a410a8340f07.jpg',
symbolSize: 30,
draggable: true,
itemStyle: {
normal: {
label: {
textStyle: {
color: 'white'
}
show: false
}
}
}
......@@ -149,7 +146,7 @@ option = {
{source : '克拉拉-乔布斯', target : '乔布斯', weight : 1},
{source : '劳伦-鲍威尔', target : '乔布斯', weight : 2},
{source : '史蒂夫-沃兹尼艾克', target : '乔布斯', weight : 3},
{source : '奥巴马', target : '乔布斯', weight : 6},
{source : '奥巴马', target : '乔布斯', weight : 3},
{source : '比尔-盖茨', target : '乔布斯', weight : 6},
{source : '乔纳森-艾夫', target : '乔布斯', weight : 1},
{source : '蒂姆-库克', target : '乔布斯', weight : 1},
......
......@@ -15,6 +15,7 @@ define(function (require) {
// 图形依赖
var LineShape = require('zrender/shape/Line');
var ImageShape = require('zrender/shape/Image');
var IconShape = require('../util/shape/Icon');
var ecConfig = require('../config');
......@@ -451,6 +452,17 @@ define(function (require) {
shape.style.width = shape.style.height
= (this.deepQuery(queryTarget, 'symbolSize') || 0) * 2;
if (shape.style.iconType.match('image')) {
shape.style.image = shape.style.iconType.replace(
new RegExp('^image:\\/\\/'), ''
);
shape = new ImageShape({
style: shape.style,
highlightStyle: shape.highlightStyle,
clickable: shape.clickable
});
}
// 节点样式
for (var k = 0; k < shapeNormalStyle.length; k++) {
if (shapeNormalStyle[k]) {
......@@ -462,7 +474,7 @@ define(function (require) {
if (shapeEmphasisStyle[k]) {
zrUtil.merge(shape.highlightStyle, shapeEmphasisStyle[k], true);
}
}
}
// 节点标签样式
if (this.deepQuery(queryTarget, 'itemStyle.normal.label.show')) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册