您的位置:首页 > 其它

南丁格尔玫瑰图在游戏运营分析报表中的应用

2013-11-29 19:36 169 查看
取统计时间区间内一天24个小时时间段的平均在线人数来作图。

数据如下:



程序如下:

%let name=game;
FILENAME file "Y:\";

data demo;
input ID time $ value col$ @@;
col="CX"||col;
value=value/100;
cards;
5 0h~1h 6377 16A629 5 0h~1h 3623 C0C0C0
4 1h~2h 2024 16A629 4 1h~2h 7976 C0C0C0
3 2h~3h 300 16A629 3 2h~3h 9700 C0C0C0
2 3h~4h 899 16A629 2 3h~4h 9101 C0C0C0
1 4h~5h 636 16A629 1 4h~5h 9364 C0C0C0
24 5h~6h 561 16A629 24 5h~6h 9439 C0C0C0
23 6h~7h 3919 16A629 23 6h~7h 6081 C0C0C0
22 7h~8h 4022 16A629 22 7h~8h 5978 C0C0C0
21 8h~9h 6531 16A629 21 8h~9h 3469 C0C0C0
20 9h~10h 6043 16A629 20 9h~10h 3957 C0C0C0
19 10h~11h 7669 16A629 19 10h~11h 2331 C0C0C0
18 11h~12h 7834 16A629 18 11h~12h 2166 C0C0C0
17 12h~13h 492 16A629 17 12h~13h 9508 C0C0C0
16 13h~14h 3228 16A629 16 13h~14h 6772 C0C0C0
15 14h~15h 1177 16A629 15 14h~15h 8823 C0C0C0
14 15h~16h 3407 16A629 14 15h~16h 6593 C0C0C0
13 16h~17h 5647 16A629 13 16h~17h 4353 C0C0C0
12 17h~18h 1860 16A629 12 17h~18h 8140 C0C0C0
11 18h~19h 8955 16A629 11 18h~19h 1045 C0C0C0
10 19h~20h 9371 16A629 10 19h~20h 629 C0C0C0
9 20h~21h 8243 16A629 9 20h~21h 1757 C0C0C0
8 21h~22h 8336 16A629 8 21h~22h 1664 C0C0C0
7 22h~23h 8865 16A629 7 22h~23h 1135 C0C0C0
6 23h~24h 9478 16A629 6 23h~24h 522 C0C0C0
;
run;

proc sort data=demo;by id;run;

/*构造控制绘图参数 PIE函数的半径rad,起始角和角度ang */
data demo2;
set demo nobs=max;
by id;
retain rad ang 0;
if first.id then do;
rad=1;
ang+1;
output;
end;
else do;
rad+1;
output;
end;
if _N_=max then do;
call symput("piece", ang);
end;
run;

/*设置最大饼环的半径为整个图的百分比*/
%let radius=25;

data pies;
set demo2;
by id;
length style function color $ 12;
xsys='3'; ysys='3'; hsys='3';
x=50; y=50; /* 定位圆心 */
function = 'PIE';
style = 'SOLID';
if first.id then do ;
sizev = value;
end;
else do ;
sizev + value;
end;
size=(&radius.*((sizev+40)/100)); /*最大半径为 &radius% */
angle = 10;
angle =angle + ((ang-1) / &piece.)*360;
rotate = (1/ &piece.)*360;
color=col;
output;
run;

proc sort data=pies out=pies;
by id decending sizev;
run;

/* 中心空白圆 */
data hole1;
set demo2;
length style function color $ 12;
xsys='3'; ysys='3'; hsys='3';
x=50;
y=50;
function='PIE';
style='SOLID';
angle=0;
line=1;
rotate=360;
size=(&radius.*((39)/100));
color='CX2F3338';
output;
run;

data hole2;
set demo2;
length style function color $ 12;
xsys='3'; ysys='3'; hsys='3';
x=50;
y=50;
function='PIE';
style='SOLID';
angle=0;
line=1;
rotate=360;
size=(&radius.*((36)/100));
color='CX415D8E';
output;
run;

/* 天 使 圈 */
data circle1;
set demo2;
length style function color $ 12;
xsys='3'; ysys='3'; hsys='3';
x=50;
y=50;
function='PIE';
style='SOLID';
angle=0;
line=1;
rotate=360;
size=(&radius.*((148)/100));
color='CX2E2E2E';
output;
run;

data circle2;
set demo2;
length style function color $ 12;
xsys='3'; ysys='3'; hsys='3';
x=50;
y=50;
function='PIE';
style='SOLID';
angle=0;
line=1;
rotate=360;
size=(&radius.*((145)/100));
color='CX232323';
output;
run;

/* 饼周围的外线 */
data outlines;
set pies hole1;
style='EMPTY';
color="CX6C6C6C";
line=3;
run;

/* 标注每个 PIE */
data slices;
set pies;
by id;
if first.id then output;
run;

data slices(drop=_value_);
set slices;
length text $20;
/* 定位到PIE的正上方的角度 */
function='piexy';
angle=angle+rotate*.5;
/* 定位到PIE的正上方的位置距离 */
size=5;
output;
/* 转换坐标 */
function='cntl2txt';
output;
/* 在定义好的地方进行标注 */
function='label';
_value_=(sizev-value)*100;
text=cats(time,"(",_value_,")");
angle=0; rotate=0; color='CX776122';
style='"arial/bo"'; size=1.5; x=.; y=.; position='5';
output;
run;

/* 标注中心 地方 */
data center;
length style function color $ 12;
length text $20;
xsys='3'; ysys='3'; hsys='3';
x=50;
y=50;
function='LABEL';
color='CXF1F9FF';
text='Jonee';
position='B';
style='"arial/bo"'; size=3.5;
output;
run;

/*data anno; set circle1 circle2 center pies outlines hole1 hole2 slices; run;*/

data anno;
set circle1 circle2 center pies outlines hole1 hole2 slices;
run;

ods listing close ;

ods html path=file body="&name..htm" ;
goptions reset=all noborder
xpixels=4000 xmax=3in ypixels=4000 ymax=3in
device=JPEG300 gsfname=file cback=CXF1F1F1;

proc ganno annotate=anno name="&name";
run;
quit;

ods html close;
ods listing;


输出结果:



通过确定一天24个小时时间段内哪个时间段的在线人数较少,就可以在最大限度避免影响玩家游戏体验的情况下进行服务器升级、合服之类的工作。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: