1、修改文件charts/BarBase.as
a. 定义一个barwidth的protected变量
14
15
|
protected
var
on_show:Properties;
protected
var
barwidth:
Number
;
|
b. 往root变量加入barwidth默认值
20
21
22
23
24
25
26
27
28
29
30
|
var
root:Properties =
new
Properties( {
values: [],
colour:
'#3030d0'
,
text:
''
,
// <-- default not display a key
'font-size'
:
12
,
tip:
'#val#<br>#x_label#'
,
alpha:
0.6
,
'on-click'
:
false
,
'axis'
:
'left'
,
barwidth:
10
} );
|
c. 获取并设置barwidth值
44
45
46
47
|
this
.colour =
this
.props.get_colour(
'colour'
);
this
.key =
this
.props.
get
(
'text'
);
this
.font_size =
this
.props.
get
(
'font-size'
);
this
.barwidth =
this
.props.
get
(
'barwidth'
);
|
d. 设置默认样式
116
117
118
119
120
121
122
123
124
|
var
default_style:Properties =
new
Properties({
colour:
this
.props.
get
(
'colour'
),
tip:
this
.props.
get
(
'tip'
),
alpha:
this
.props.
get
(
'alpha'
),
'on-click'
:
this
.props.
get
(
'on-click'
),
axis:
this
.props.
get
(
'axis'
),
'on-show'
:
this
.on_show,
barwidth:
this
.props.
get
(
'barwidth'
)
});
|
2、编辑charts/series/Base.as文件
a. 添加protected 变量 barwidth
21
22
23
|
private
var
on_show_animate:
Boolean
;
protected
var
on_show:Properties;
protected
var
barwidth:
Number
;
|
b. 设置上述属性值
31
32
|
this
.colour = props.get_colour(
'colour'
);
this
.barwidth = props.
get
(
'barwidth'
);
|
c. 通过该属性计算获取宽度
126
|
var
tmp:
Object
= sc.get_bar_coords(
this
.index,
this
.group,
this
.barwidth);
|
3、修改ScreenCoords.as文件
a. 上述已经修改传入变量barwidth,这里要添加一个接收其变量,默认值为0表示使用ofc自带。
327
|
public
function
get_bar_coords( index:
Number
, group:
Number
, barwidth:
Number
=
0
):
Object
{
|
b. 加入以下代码设置宽度
331
332
333
|
var
bar_set_width:
Number
= item_width *
0.8
;
if
( barwidth && bar_set_width > barwidth *
this
.bar_groups )
bar_set_width = barwidth *
this
.bar_groups;
|