origami.js
origami.js copied to clipboard
[lineChart] Verify in matrix if is a timestamp and restructure chart
In cases like tsuru dashboard, he actually gets:
{
"max ": [
[1477493880000, 0.030500340632603404],
[1477493940000, 0.04075857819905213],
[1477494000000, 0.014717393483709273],
[1477494060000, 0.029667878787878785],
[1477494120000, 0.01438573566084788],
[1477494180000, 0.01365384223918575],
[1477494240000, 0.03254841309823678],
[1477494300000, 0.0275413],
[1477494360000, 0.07786407960199006],
[1477494420000, 0.016713316953316956],
[1477494480000, 0.014612100000000001],
[1477494540000, 0.03143121212121212],
[1477494600000, 0.016177874396135265],
[1477494660000, 0.016748715365239294],
[1477494720000, 0.02291617529880478],
[1477494780000, 0.012555072463768115],
[1477494840000, 0.014970251256281406],
[1477494900000, 0.014784186046511627],
[1477494960000, 0.015761853658536586],
[1477495020000, 0.01699513381995134],
[1477495080000, 0.030748264058679708],
[1477495140000, 0.015027630922693266],
[1477495200000, 0.027111720698254366],
[1477495260000, 0.011219402985074628],
[1477495320000, 0.02812541353383459],
[1477495380000, 0.0311629197080292],
[1477495440000, 0.02950381443298969],
[1477495500000, 0.01642673417721519],
[1477495560000, 0.017345648854961832],
[1477495620000, 0.01717910891089109],
],
avg: [
[1477493880000, 0.030500340632603404],
[1477493940000, 0.035934743644980616],
[1477494000000, 0.007358696741854636],
[1477494060000, 0.018660303030303027],
[1477494120000, 0.013888010687566798],
[1477494180000, 0.006826921119592875],
[1477494240000, 0.030645235960883095],
[1477494300000, 0.020882202162849875],
[1477494360000, 0.045783910125184554],
[1477494420000, 0.014818087048087049],
[1477494480000, 0.009202084615384616],
[1477494540000, 0.030941069719753928],
[1477494600000, 0.014575949543746646],
[1477494660000, 0.015212804284561395],
[1477494720000, 0.018559660130974872],
[1477494780000, 0.012527713447073931],
[1477494840000, 0.01123532663316583],
[1477494900000, 0.01265842297432905],
[1477494960000, 0.014770059482329517],
[1477495020000, 0.014380085801663327],
[1477495080000, 0.02340578251477675],
[1477495140000, 0.013467885813105426],
[1477495200000, 0.02130251071587535],
[1477495260000, 0.005609701492537314],
[1477495320000, 0.02575494080171335],
[1477495380000, 0.025785389325047346],
[1477495440000, 0.023237517606105235],
[1477495500000, 0.008213367088607594]
],
min: [
[1477493880000, 0.030500340632603404],
[1477493940000, 0.031110909090909092],
[1477494000000, 0],
[1477494060000, 0.013133333333333334],
[1477494120000, 0.013390285714285714],
[1477494180000, 0],
[1477494240000, 0.028742058823529412],
[1477494300000, 0.014223104325699745],
[1477494360000, 0.01370374064837905],
[1477494420000, 0.012922857142857142],
[1477494480000, 0],
[1477494540000, 0.03045092731829574],
[1477494600000, 0.012974024691358025],
[1477494660000, 0.013676893203883494],
[1477494720000, 0.014203144963144962],
[1477494780000, 0.012500354430379747],
[1477494840000, 0.007500402010050251],
[1477494900000, 0.009654710327455919],
[1477494960000, 0.013778265306122448],
[1477495020000, 0.011765037783375315],
[1477495080000, 0.016063300970873787],
[1477495140000, 0.011908140703517587],
[1477495200000, 0.015493300733496331],
[1477495260000, 0],
[1477495320000, 0.021027930174563593],
[1477495380000, 0.020407858942065493],
[1477495440000, 0.01697122077922078],
[1477495500000, 0],
[1477495560000, 0.013399605911330048],
[1477495620000, 0.016777959183673467],
[1477495680000, 0.013905074626865672],
[1477495740000, 0.013392780487804878],
[1477495800000, 0.01237432098765432],
[1477495860000, 0.013311209876543209],
[1477495920000, 0.012793801452784505],
[1477495980000, 0.01323367901234568],
[1477496040000, 0.016626943005181347],
[1477496100000, 0.013865210918114143],
[1477496160000, 0.014770025316455696],
[1477496220000, 0],
]
}
What this actually means? It receives timestamp and data.set in [x,y]. Origamijs doesn't support this data type. The idea is check if is a timestamp and set automatically the labels (calculating variance)
Returning a line chart like:

cc @andrewsmedina