Graphite,显示数据时的平均算法

Graphite, averaging algorithm while displaying data

我每秒都在保存数据。

这里是碳时间序列的定义:

cat /etc/carbon/storage-schemas.conf

[requests]
pattern = ^requests\.
retentions = 1s:7d

出于测试目的,我向 Graphite 服务器发送了 step 函数的值:

 setInterval(function() { 
   graphite.put('step', Math.round(Math.random()) );
 }, 1000);

该函数以随机方式生成 1 或 0,并将其放在 requests.beryllium.step 目标上。

这是显示 1 分钟的石墨图:

/render?width=400&from=-2minutes&until=-1minute&height=250&target=requests.beryllium.step&_uniq=0.06224050732088515&title=requests.beryllium.step

图表上有预期的 60 个数据点。我通过获取 json 数据进行了检查:

/render?width=400&from=-2minutes&until=-1minute&height=250&target=requests.beryllium.step&_uniq=0.06224050732088515&title=requests.beryllium.step&format=json

结果(数组中的 60 个点,选中):

[{"target": "requests.beryllium.step", "datapoints": [[1.0, 1472502764], [0.0, 1472502765], [1.0, 1472502766], [0.0, 1472502767], [1.0, 1472502768], [0.0, 1472502769], [1.0, 1472502770], [0.0, 1472502771], [1.0, 1472502772], [1.0, 1472502773], [0.0, 1472502774], [1.0, 1472502775], [0.0, 1472502776], [1.0, 1472502777], [1.0, 1472502778], [0.0, 1472502779], [1.0, 1472502780], [0.0, 1472502781], [1.0, 1472502782], [1.0, 1472502783], [0.0, 1472502784], [1.0, 1472502785], [0.0, 1472502786], [1.0, 1472502787], [0.0, 1472502788], [0.0, 1472502789], [1.0, 1472502790], [1.0, 1472502791], [0.0, 1472502792], [1.0, 1472502793], [0.0, 1472502794], [1.0, 1472502795], [0.0, 1472502796], [1.0, 1472502797], [0.0, 1472502798], [1.0, 1472502799], [1.0, 1472502800], [0.0, 1472502801], [0.0, 1472502802], [0.0, 1472502803], [1.0, 1472502804], [1.0, 1472502805], [1.0, 1472502806], [1.0, 1472502807], [1.0, 1472502808], [0.0, 1472502809], [0.0, 1472502810], [1.0, 1472502811], [1.0, 1472502812], [1.0, 1472502813], [0.0, 1472502814], [1.0, 1472502815], [1.0, 1472502816], [0.0, 1472502817], [0.0, 1472502818], [0.0, 1472502819], [0.0, 1472502820], [0.0, 1472502821], [0.0, 1472502822], [1.0, 1472502823]]}]

所有数据点都是零或一,这也是我们在图表上看到的。至此,一切正常。

现在,我用 15 分钟画了一张图:

/render?width=400&from=-16minutes&until=-1minute&height=250&target=requests.beryllium.step&_uniq=0.06224050732088515&title=requests.beryllium.step&format=png

在图表上我们可以看到不是 1 或 0 的点。让我们检查点数组中的内容:

/render?width=400&from=-16minutes&until=-1minute&height=250&target=requests.beryllium.step&_uniq=0.06224050732088515&title=requests.beryllium.step&format=json

结果:

[{"target": "requests.beryllium.step", "datapoints": [[1.0, 1472502324], [0.0, 1472502325], [0.0, 1472502326], [0.0, 1472502327], [1.0, 1472502328], [1.0, 1472502329], [1.0, 1472502330], [0.0, 1472502331], [1.0, 1472502332], [1.0, 1472502333], [0.0, 1472502334], [1.0, 1472502335], [0.0, 1472502336], [0.0, 1472502337], [0.0, 1472502338], [0.0, 1472502339], [0.0, 1472502340], [1.0, 1472502341], [1.0, 1472502342], [1.0, 1472502343], [1.0, 1472502344], [0.0, 1472502345], [1.0, 1472502346], [1.0, 1472502347], [1.0, 1472502348], [1.0, 1472502349], [1.0, 1472502350], [0.0, 1472502351], [0.0, 1472502352], [1.0, 1472502353], [1.0, 1472502354], [0.0, 1472502355], [1.0, 1472502356], [1.0, 1472502357], [0.0, 1472502358], [0.0, 1472502359], [1.0, 1472502360], [1.0, 1472502361], [1.0, 1472502362], [1.0, 1472502363], [1.0, 1472502364], [0.0, 1472502365], [0.0, 1472502366], [1.0, 1472502367], [0.0, 1472502368], [0.0, 1472502369], [0.0, 1472502370], [0.0, 1472502371], [1.0, 1472502372], [1.0, 1472502373], [0.0, 1472502374], [1.0, 1472502375], [1.0, 1472502376], [0.0, 1472502377], [0.0, 1472502378], [1.0, 1472502379], [0.0, 1472502380], [0.0, 1472502381], [1.0, 1472502382], [1.0, 1472502383], [1.0, 1472502384], [1.0, 1472502385], [0.0, 1472502386], [0.0, 1472502387], [1.0, 1472502388], [1.0, 1472502389], [0.0, 1472502390], [1.0, 1472502391], [0.0, 1472502392], [1.0, 1472502393], [0.0, 1472502394], [1.0, 1472502395], [1.0, 1472502396], [1.0, 1472502397], [0.0, 1472502398], [1.0, 1472502399], [1.0, 1472502400], [0.0, 1472502401], [0.0, 1472502402], [0.0, 1472502403], [1.0, 1472502404], [1.0, 1472502405], [0.0, 1472502406], [1.0, 1472502407], [0.0, 1472502408], [1.0, 1472502409], [1.0, 1472502410], [0.0, 1472502411], [0.0, 1472502412], [0.0, 1472502413], [null, 1472502414], [0.0, 1472502415], [0.0, 1472502416], [1.0, 1472502417], [1.0, 1472502418], [1.0, 1472502419], [1.0, 1472502420], [0.0, 1472502421], [1.0, 1472502422], [1.0, 1472502423], [0.0, 1472502424], [1.0, 1472502425], [0.0, 1472502426], [1.0, 1472502427], [0.0, 1472502428], [0.0, 1472502429], [1.0, 1472502430], [1.0, 1472502431], [0.0, 1472502432], [1.0, 1472502433], [1.0, 1472502434], [0.0, 1472502435], [1.0, 1472502436], [0.0, 1472502437], [0.0, 1472502438], [1.0, 1472502439], [0.0, 1472502440], [1.0, 1472502441], [0.0, 1472502442], [1.0, 1472502443], [1.0, 1472502444], [0.0, 1472502445], [1.0, 1472502446], [0.0, 1472502447], [1.0, 1472502448], [0.0, 1472502449], [1.0, 1472502450], [0.0, 1472502451], [0.0, 1472502452], [0.0, 1472502453], [0.0, 1472502454], [0.0, 1472502455], [0.0, 1472502456], [0.0, 1472502457], [0.0, 1472502458], [1.0, 1472502459], [0.0, 1472502460], [1.0, 1472502461], [0.0, 1472502462], [1.0, 1472502463], [0.0, 1472502464], [0.0, 1472502465], [1.0, 1472502466], [0.0, 1472502467], [0.0, 1472502468], [0.0, 1472502469], [0.0, 1472502470], [0.0, 1472502471], [0.0, 1472502472], [0.0, 1472502473], [1.0, 1472502474], [1.0, 1472502475], [0.0, 1472502476], [1.0, 1472502477], [1.0, 1472502478], [1.0, 1472502479], [1.0, 1472502480], [0.0, 1472502481], [1.0, 1472502482], [0.0, 1472502483], [1.0, 1472502484], [1.0, 1472502485], [1.0, 1472502486], [1.0, 1472502487], [0.0, 1472502488], [0.0, 1472502489], [1.0, 1472502490], [1.0, 1472502491], [1.0, 1472502492], [0.0, 1472502493], [0.0, 1472502494], [1.0, 1472502495], [1.0, 1472502496], [0.0, 1472502497], [1.0, 1472502498], [1.0, 1472502499], [0.0, 1472502500], [1.0, 1472502501], [1.0, 1472502502], [0.0, 1472502503], [0.0, 1472502504], [1.0, 1472502505], [1.0, 1472502506], [1.0, 1472502507], [1.0, 1472502508], [1.0, 1472502509], [1.0, 1472502510], [1.0, 1472502511], [1.0, 1472502512], [1.0, 1472502513], [1.0, 1472502514], [0.0, 1472502515], [1.0, 1472502516], [1.0, 1472502517], [0.0, 1472502518], [0.0, 1472502519], [1.0, 1472502520], [1.0, 1472502521], [0.0, 1472502522], [1.0, 1472502523], [0.0, 1472502524], [1.0, 1472502525], [0.0, 1472502526], [1.0, 1472502527], [0.0, 1472502528], [0.0, 1472502529], [0.0, 1472502530], [0.0, 1472502531], [1.0, 1472502532], [0.0, 1472502533], [0.0, 1472502534], [0.0, 1472502535], [1.0, 1472502536], [0.0, 1472502537], [0.0, 1472502538], [1.0, 1472502539], [0.0, 1472502540], [0.0, 1472502541], [0.0, 1472502542], [1.0, 1472502543], [0.0, 1472502544], [0.0, 1472502545], [1.0, 1472502546], [1.0, 1472502547], [0.0, 1472502548], [1.0, 1472502549], [0.0, 1472502550], [1.0, 1472502551], [1.0, 1472502552], [0.0, 1472502553], [0.0, 1472502554], [1.0, 1472502555], [0.0, 1472502556], [1.0, 1472502557], [1.0, 1472502558], [0.0, 1472502559], [0.0, 1472502560], [1.0, 1472502561], [1.0, 1472502562], [1.0, 1472502563], [0.0, 1472502564], [0.0, 1472502565], [1.0, 1472502566], [1.0, 1472502567], [1.0, 1472502568], [1.0, 1472502569], [1.0, 1472502570], [0.0, 1472502571], [1.0, 1472502572], [0.0, 1472502573], [1.0, 1472502574], [1.0, 1472502575], [0.0, 1472502576], [0.0, 1472502577], [0.0, 1472502578], [0.0, 1472502579], [1.0, 1472502580], [0.0, 1472502581], [0.0, 1472502582], [0.0, 1472502583], [1.0, 1472502584], [0.0, 1472502585], [1.0, 1472502586], [0.0, 1472502587], [1.0, 1472502588], [1.0, 1472502589], [1.0, 1472502590], [0.0, 1472502591], [0.0, 1472502592], [0.0, 1472502593], [1.0, 1472502594], [0.0, 1472502595], [1.0, 1472502596], [1.0, 1472502597], [1.0, 1472502598], [0.0, 1472502599], [0.0, 1472502600], [0.0, 1472502601], [1.0, 1472502602], [0.0, 1472502603], [0.0, 1472502604], [0.0, 1472502605], [1.0, 1472502606], [1.0, 1472502607], [1.0, 1472502608], [0.0, 1472502609], [1.0, 1472502610], [1.0, 1472502611], [1.0, 1472502612], [0.0, 1472502613], [0.0, 1472502614], [0.0, 1472502615], [1.0, 1472502616], [1.0, 1472502617], [1.0, 1472502618], [0.0, 1472502619], [1.0, 1472502620], [0.0, 1472502621], [1.0, 1472502622], [0.0, 1472502623], [0.0, 1472502624], [0.0, 1472502625], [0.0, 1472502626], [0.0, 1472502627], [1.0, 1472502628], [1.0, 1472502629], [0.0, 1472502630], [0.0, 1472502631], [0.0, 1472502632], [1.0, 1472502633], [1.0, 1472502634], [0.0, 1472502635], [1.0, 1472502636], [1.0, 1472502637], [0.0, 1472502638], [1.0, 1472502639], [1.0, 1472502640], [0.0, 1472502641], [1.0, 1472502642], [1.0, 1472502643], [1.0, 1472502644], [0.0, 1472502645], [1.0, 1472502646], [1.0, 1472502647], [0.0, 1472502648], [0.0, 1472502649], [1.0, 1472502650], [1.0, 1472502651], [1.0, 1472502652], [1.0, 1472502653], [1.0, 1472502654], [1.0, 1472502655], [1.0, 1472502656], [0.0, 1472502657], [1.0, 1472502658], [1.0, 1472502659], [0.0, 1472502660], [0.0, 1472502661], [0.0, 1472502662], [0.0, 1472502663], [1.0, 1472502664], [1.0, 1472502665], [1.0, 1472502666], [1.0, 1472502667], [1.0, 1472502668], [1.0, 1472502669], [1.0, 1472502670], [0.0, 1472502671], [1.0, 1472502672], [0.0, 1472502673], [0.0, 1472502674], [0.0, 1472502675], [1.0, 1472502676], [0.0, 1472502677], [1.0, 1472502678], [1.0, 1472502679], [0.0, 1472502680], [0.0, 1472502681], [1.0, 1472502682], [0.0, 1472502683], [1.0, 1472502684], [0.0, 1472502685], [0.0, 1472502686], [0.0, 1472502687], [1.0, 1472502688], [0.0, 1472502689], [1.0, 1472502690], [0.0, 1472502691], [0.0, 1472502692], [1.0, 1472502693], [1.0, 1472502694], [0.0, 1472502695], [1.0, 1472502696], [0.0, 1472502697], [1.0, 1472502698], [0.0, 1472502699], [1.0, 1472502700], [1.0, 1472502701], [0.0, 1472502702], [0.0, 1472502703], [1.0, 1472502704], [1.0, 1472502705], [1.0, 1472502706], [0.0, 1472502707], [0.0, 1472502708], [0.0, 1472502709], [1.0, 1472502710], [0.0, 1472502711], [1.0, 1472502712], [1.0, 1472502713], [1.0, 1472502714], [1.0, 1472502715], [0.0, 1472502716], [1.0, 1472502717], [1.0, 1472502718], [0.0, 1472502719], [1.0, 1472502720], [0.0, 1472502721], [1.0, 1472502722], [1.0, 1472502723], [1.0, 1472502724], [0.0, 1472502725], [0.0, 1472502726], [0.0, 1472502727], [1.0, 1472502728], [0.0, 1472502729], [1.0, 1472502730], [0.0, 1472502731], [0.0, 1472502732], [1.0, 1472502733], [1.0, 1472502734], [0.0, 1472502735], [1.0, 1472502736], [1.0, 1472502737], [0.0, 1472502738], [0.0, 1472502739], [0.0, 1472502740], [0.0, 1472502741], [1.0, 1472502742], [0.0, 1472502743], [0.0, 1472502744], [0.0, 1472502745], [0.0, 1472502746], [0.0, 1472502747], [1.0, 1472502748], [0.0, 1472502749], [0.0, 1472502750], [1.0, 1472502751], [1.0, 1472502752], [0.0, 1472502753], [0.0, 1472502754], [0.0, 1472502755], [0.0, 1472502756], [1.0, 1472502757], [1.0, 1472502758], [1.0, 1472502759], [0.0, 1472502760], [0.0, 1472502761], [1.0, 1472502762], [1.0, 1472502763], [1.0, 1472502764], [0.0, 1472502765], [1.0, 1472502766], [0.0, 1472502767], [1.0, 1472502768], [0.0, 1472502769], [1.0, 1472502770], [0.0, 1472502771], [1.0, 1472502772], [1.0, 1472502773], [0.0, 1472502774], [1.0, 1472502775], [0.0, 1472502776], [1.0, 1472502777], [1.0, 1472502778], [0.0, 1472502779], [1.0, 1472502780], [0.0, 1472502781], [1.0, 1472502782], [1.0, 1472502783], [0.0, 1472502784], [1.0, 1472502785], [0.0, 1472502786], [1.0, 1472502787], [0.0, 1472502788], [0.0, 1472502789], [1.0, 1472502790], [1.0, 1472502791], [0.0, 1472502792], [1.0, 1472502793], [0.0, 1472502794], [1.0, 1472502795], [0.0, 1472502796], [1.0, 1472502797], [0.0, 1472502798], [1.0, 1472502799], [1.0, 1472502800], [0.0, 1472502801], [0.0, 1472502802], [0.0, 1472502803], [1.0, 1472502804], [1.0, 1472502805], [1.0, 1472502806], [1.0, 1472502807], [1.0, 1472502808], [0.0, 1472502809], [0.0, 1472502810], [1.0, 1472502811], [1.0, 1472502812], [1.0, 1472502813], [0.0, 1472502814], [1.0, 1472502815], [1.0, 1472502816], [0.0, 1472502817], [0.0, 1472502818], [0.0, 1472502819], [0.0, 1472502820], [0.0, 1472502821], [0.0, 1472502822], [1.0, 1472502823], [1.0, 1472502824], [1.0, 1472502825], [0.0, 1472502826], [0.0, 1472502827], [1.0, 1472502828], [0.0, 1472502829], [1.0, 1472502830], [0.0, 1472502831], [0.0, 1472502832], [0.0, 1472502833], [1.0, 1472502834], [0.0, 1472502835], [1.0, 1472502836], [1.0, 1472502837], [1.0, 1472502838], [1.0, 1472502839], [1.0, 1472502840], [0.0, 1472502841], [1.0, 1472502842], [1.0, 1472502843], [0.0, 1472502844], [1.0, 1472502845], [1.0, 1472502846], [0.0, 1472502847], [1.0, 1472502848], [1.0, 1472502849], [0.0, 1472502850], [1.0, 1472502851], [0.0, 1472502852], [1.0, 1472502853], [0.0, 1472502854], [0.0, 1472502855], [0.0, 1472502856], [1.0, 1472502857], [1.0, 1472502858], [0.0, 1472502859], [0.0, 1472502860], [0.0, 1472502861], [0.0, 1472502862], [1.0, 1472502863], [1.0, 1472502864], [0.0, 1472502865], [1.0, 1472502866], [0.0, 1472502867], [1.0, 1472502868], [0.0, 1472502869], [0.0, 1472502870], [1.0, 1472502871], [1.0, 1472502872], [0.0, 1472502873], [0.0, 1472502874], [0.0, 1472502875], [1.0, 1472502876], [1.0, 1472502877], [1.0, 1472502878], [1.0, 1472502879], [0.0, 1472502880], [0.0, 1472502881], [0.0, 1472502882], [0.0, 1472502883], [0.0, 1472502884], [0.0, 1472502885], [1.0, 1472502886], [1.0, 1472502887], [1.0, 1472502888], [1.0, 1472502889], [1.0, 1472502890], [0.0, 1472502891], [0.0, 1472502892], [1.0, 1472502893], [1.0, 1472502894], [0.0, 1472502895], [1.0, 1472502896], [1.0, 1472502897], [0.0, 1472502898], [0.0, 1472502899], [1.0, 1472502900], [0.0, 1472502901], [0.0, 1472502902], [0.0, 1472502903], [0.0, 1472502904], [1.0, 1472502905], [0.0, 1472502906], [0.0, 1472502907], [1.0, 1472502908], [0.0, 1472502909], [1.0, 1472502910], [0.0, 1472502911], [0.0, 1472502912], [0.0, 1472502913], [1.0, 1472502914], [0.0, 1472502915], [1.0, 1472502916], [1.0, 1472502917], [0.0, 1472502918], [1.0, 1472502919], [0.0, 1472502920], [0.0, 1472502921], [1.0, 1472502922], [1.0, 1472502923], [1.0, 1472502924], [1.0, 1472502925], [1.0, 1472502926], [0.0, 1472502927], [0.0, 1472502928], [1.0, 1472502929], [1.0, 1472502930], [0.0, 1472502931], [1.0, 1472502932], [1.0, 1472502933], [1.0, 1472502934], [1.0, 1472502935], [0.0, 1472502936], [0.0, 1472502937], [1.0, 1472502938], [0.0, 1472502939], [0.0, 1472502940], [0.0, 1472502941], [1.0, 1472502942], [1.0, 1472502943], [0.0, 1472502944], [1.0, 1472502945], [0.0, 1472502946], [1.0, 1472502947], [0.0, 1472502948], [0.0, 1472502949], [0.0, 1472502950], [1.0, 1472502951], [1.0, 1472502952], [1.0, 1472502953], [0.0, 1472502954], [0.0, 1472502955], [1.0, 1472502956], [0.0, 1472502957], [0.0, 1472502958], [1.0, 1472502959], [0.0, 1472502960], [1.0, 1472502961], [0.0, 1472502962], [1.0, 1472502963], [1.0, 1472502964], [0.0, 1472502965], [0.0, 1472502966], [0.0, 1472502967], [0.0, 1472502968], [0.0, 1472502969], [0.0, 1472502970], [0.0, 1472502971], [0.0, 1472502972], [1.0, 1472502973], [1.0, 1472502974], [1.0, 1472502975], [1.0, 1472502976], [0.0, 1472502977], [0.0, 1472502978], [0.0, 1472502979], [0.0, 1472502980], [1.0, 1472502981], [1.0, 1472502982], [0.0, 1472502983], [0.0, 1472502984], [1.0, 1472502985], [0.0, 1472502986], [0.0, 1472502987], [1.0, 1472502988], [0.0, 1472502989], [1.0, 1472502990], [1.0, 1472502991], [1.0, 1472502992], [1.0, 1472502993], [0.0, 1472502994], [0.0, 1472502995], [1.0, 1472502996], [1.0, 1472502997], [1.0, 1472502998], [1.0, 1472502999], [0.0, 1472503000], [1.0, 1472503001], [1.0, 1472503002], [0.0, 1472503003], [1.0, 1472503004], [0.0, 1472503005], [0.0, 1472503006], [1.0, 1472503007], [1.0, 1472503008], [0.0, 1472503009], [0.0, 1472503010], [0.0, 1472503011], [0.0, 1472503012], [0.0, 1472503013], [1.0, 1472503014], [1.0, 1472503015], [1.0, 1472503016], [0.0, 1472503017], [0.0, 1472503018], [1.0, 1472503019], [0.0, 1472503020], [0.0, 1472503021], [0.0, 1472503022], [1.0, 1472503023], [1.0, 1472503024], [0.0, 1472503025], [0.0, 1472503026], [0.0, 1472503027], [0.0, 1472503028], [0.0, 1472503029], [1.0, 1472503030], [0.0, 1472503031], [0.0, 1472503032], [0.0, 1472503033], [0.0, 1472503034], [0.0, 1472503035], [1.0, 1472503036], [1.0, 1472503037], [1.0, 1472503038], [1.0, 1472503039], [0.0, 1472503040], [1.0, 1472503041], [0.0, 1472503042], [0.0, 1472503043], [1.0, 1472503044], [1.0, 1472503045], [1.0, 1472503046], [1.0, 1472503047], [0.0, 1472503048], [0.0, 1472503049], [1.0, 1472503050], [0.0, 1472503051], [1.0, 1472503052], [0.0, 1472503053], [1.0, 1472503054], [0.0, 1472503055], [1.0, 1472503056], [0.0, 1472503057], [1.0, 1472503058], [1.0, 1472503059], [0.0, 1472503060], [1.0, 1472503061], [1.0, 1472503062], [0.0, 1472503063], [0.0, 1472503064], [1.0, 1472503065], [0.0, 1472503066], [1.0, 1472503067], [1.0, 1472503068], [1.0, 1472503069], [0.0, 1472503070], [0.0, 1472503071], [0.0, 1472503072], [0.0, 1472503073], [1.0, 1472503074], [1.0, 1472503075], [1.0, 1472503076], [0.0, 1472503077], [1.0, 1472503078], [1.0, 1472503079], [1.0, 1472503080], [0.0, 1472503081], [0.0, 1472503082], [1.0, 1472503083], [1.0, 1472503084], [0.0, 1472503085], [1.0, 1472503086], [0.0, 1472503087], [0.0, 1472503088], [1.0, 1472503089], [1.0, 1472503090], [0.0, 1472503091], [1.0, 1472503092], [0.0, 1472503093], [1.0, 1472503094], [0.0, 1472503095], [1.0, 1472503096], [0.0, 1472503097], [1.0, 1472503098], [1.0, 1472503099], [0.0, 1472503100], [1.0, 1472503101], [0.0, 1472503102], [0.0, 1472503103], [1.0, 1472503104], [0.0, 1472503105], [1.0, 1472503106], [0.0, 1472503107], [1.0, 1472503108], [0.0, 1472503109], [1.0, 1472503110], [0.0, 1472503111], [0.0, 1472503112], [1.0, 1472503113], [0.0, 1472503114], [0.0, 1472503115], [1.0, 1472503116], [0.0, 1472503117], [0.0, 1472503118], [1.0, 1472503119], [1.0, 1472503120], [0.0, 1472503121], [1.0, 1472503122], [1.0, 1472503123], [0.0, 1472503124], [0.0, 1472503125], [1.0, 1472503126], [1.0, 1472503127], [0.0, 1472503128], [0.0, 1472503129], [1.0, 1472503130], [1.0, 1472503131], [0.0, 1472503132], [1.0, 1472503133], [0.0, 1472503134], [1.0, 1472503135], [1.0, 1472503136], [1.0, 1472503137], [1.0, 1472503138], [0.0, 1472503139], [1.0, 1472503140], [0.0, 1472503141], [0.0, 1472503142], [0.0, 1472503143], [0.0, 1472503144], [0.0, 1472503145], [1.0, 1472503146], [0.0, 1472503147], [1.0, 1472503148], [1.0, 1472503149], [0.0, 1472503150], [1.0, 1472503151], [0.0, 1472503152], [0.0, 1472503153], [0.0, 1472503154], [0.0, 1472503155], [1.0, 1472503156], [1.0, 1472503157], [1.0, 1472503158], [0.0, 1472503159], [1.0, 1472503160], [1.0, 1472503161], [1.0, 1472503162], [1.0, 1472503163], [1.0, 1472503164], [0.0, 1472503165], [1.0, 1472503166], [0.0, 1472503167], [0.0, 1472503168], [1.0, 1472503169], [0.0, 1472503170], [0.0, 1472503171], [0.0, 1472503172], [1.0, 1472503173], [0.0, 1472503174], [1.0, 1472503175], [1.0, 1472503176], [1.0, 1472503177], [1.0, 1472503178], [0.0, 1472503179], [1.0, 1472503180], [1.0, 1472503181], [0.0, 1472503182], [0.0, 1472503183], [1.0, 1472503184], [1.0, 1472503185], [0.0, 1472503186], [1.0, 1472503187], [0.0, 1472503188], [1.0, 1472503189], [1.0, 1472503190], [1.0, 1472503191], [0.0, 1472503192], [0.0, 1472503193], [0.0, 1472503194], [1.0, 1472503195], [0.0, 1472503196], [0.0, 1472503197], [0.0, 1472503198], [0.0, 1472503199], [0.0, 1472503200], [1.0, 1472503201], [0.0, 1472503202], [0.0, 1472503203], [1.0, 1472503204], [0.0, 1472503205], [1.0, 1472503206], [0.0, 1472503207], [1.0, 1472503208], [0.0, 1472503209], [0.0, 1472503210], [0.0, 1472503211], [0.0, 1472503212], [0.0, 1472503213], [0.0, 1472503214], [0.0, 1472503215], [1.0, 1472503216], [0.0, 1472503217], [1.0, 1472503218], [0.0, 1472503219], [0.0, 1472503220], [0.0, 1472503221], [1.0, 1472503222], [1.0, 1472503223]]}]

共有900分(15*60)。同样,我们可以看到数据点是零或只有一个。

因此,有一些平均算法在图形上显示数据,显示的点不是零或一。

我很想知道当我将时间 window 从 1 分钟更改为更宽的范围时,石墨会通过什么计算来绘制图形。

source code之后,这里是负责计算每个像素点数的部分(最好的情况是1对1):

  def consolidateDataPoints(self):
    numberOfPixels = self.graphWidth = self.area['xmax'] - self.area['xmin'] - (self.lineWidth + 1)
    for series in self.data:
      numberOfDataPoints = self.timeRange/series.step
      minXStep = float( self.params.get('minXStep',1.0) )
      divisor = self.timeRange / series.step
      bestXStep = numberOfPixels / divisor
      if bestXStep < minXStep:
        drawableDataPoints = int( numberOfPixels / minXStep )
        pointsPerPixel = math.ceil( float(numberOfDataPoints) / float(drawableDataPoints) )
        series.consolidate(pointsPerPixel)
        series.xStep = (numberOfPixels * pointsPerPixel) / numberOfDataPoints
      else:
        series.xStep = bestXStep

您可能会注意到 - 将 minXStep=NUMBER 添加到查询字符串可以扩展合并 window。 default consolidation method 是平均值。