生成我认为您想要的内容的简短答案是将您的数据从宽变为长,然后生成摘要图表。下面的例子:
*Making fake data that looks like yours.
input program.
loop #i = 1 to 1000.
compute caseid = #i.
compute A = TRUNC(RV.UNIFORM(1,4)).
compute B = TRUNC(RV.UNIFORM(1,4)).
compute C = TRUNC(RV.UNIFORM(1,4)).
end case.
end loop.
end file.
end input program.
dataset name Sim.
value labels A B C
1 'Chrome'
2 'Firefox'
3 'IE'.
*Reshape Wide to long.
VARSTOCASES
/MAKE Browser from A B C
/INDEX Period.
*Now make the summary chart.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=Period COUNT()[name="COUNT"] Browser
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: Period=col(source(s), name("Period"), unit.category())
DATA: COUNT=col(source(s), name("COUNT"))
DATA: Browser=col(source(s), name("Browser"), unit.category())
GUIDE: axis(dim(1), label("Period"))
GUIDE: axis(dim(2), label("Count"))
GUIDE: legend(aesthetic(aesthetic.color.interior), label("Browser"))
SCALE: cat(dim(1))
SCALE: linear(dim(2))
SCALE: cat(aesthetic(aesthetic.color.interior), include("1.00", "2.00","3.00"))
ELEMENT: line(position(Period*COUNT), color.interior(Browser), missing.wings())
END GPL.
这产生了这个图表:
如果您有重复的测量数据(即同一个人浏览多个时间段),您可以在数据中拥有更多的结构,可以绘制图表。一种方法您可以考虑以初始状态为条件的面积图。下面是一个示例,通过一些事后编辑图表产生了这个:
do if Period = 1.
compute initial_browser = Browser.
else if Period > 1.
compute initial_browser = lag(Browser).
end if.
value labels initial_browser
1 'Chrome'
2 'Firefox'
3 'IE'.
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=Period COUNT()[name=
"COUNT"] initial_browser Browser
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
SOURCE: s=userSource(id("graphdataset"))
DATA: Period=col(source(s), name("Period"), unit.category())
DATA: COUNT=col(source(s), name("COUNT"))
DATA: initial_browser=col(source(s), name("initial_browser"),unit.category())
DATA: Browser=col(source(s), name("Browser"), unit.category())
GUIDE: axis(dim(1), label("Period"))
GUIDE: axis(dim(2), label("Count"))
GUIDE: axis(dim(4), label("Initial Browser"), opposite())
GUIDE: legend(aesthetic(aesthetic.color.interior), label("Browser"))
SCALE: cat(dim(1))
SCALE: linear(dim(2), include(0))
SCALE: cat(dim(4))
SCALE: cat(aesthetic(aesthetic.color.interior), include("1.00", "2.00",
"3.00"))
ELEMENT: area.stack(position(Period*COUNT*1*initial_browser),
color.interior(Browser), missing.wings())
END GPL.
如果是这种情况,还有很多其他的图表可能性。