{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# JavaScript API to BeakerX Plot Widgets\n", "\n", "In addition to being available in Jupyter with BeakerX as demonstrated below, you can also access with widgets as a [JS library on npm](https://www.npmjs.com/package/beakerx) which you can [embed on any page](http://ipywidgets.readthedocs.io/en/latest/embedding.html), like [nbviewer does](http://nbviewer.jupyter.org/github/twosigma/beakerx/blob/bc12afb1a19e9c237131d17c22e92edfa44028b1/doc/contents/nbviewer/NbviewerCategoryPlot.ipynb)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "var plot = new beakerx.Plot({\n", " title: 'Title',\n", " xLabel: \"Horizontal\", \n", " yLabel: \"Vertical\",\n", " initWidth: 800,\n", " initHeight: 500\n", "})\n", "plot.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "// Run to define example data for demos\n", "beakerx.rates = [{\"time\":\"1990-01-31T00:00:00.000Z\",\"m3\":7.898095238095237,\"m6\":7.956190476190476,\"y1\":7.920952380952381,\"y2\":8.085238095238097,\"y3\":8.13238095238095,\"y5\":8.11952380952381,\"y7\":8.196190476190477,\"y10\":8.206666666666667,\"y30\":8.25857142857143},{\"time\":\"1990-02-28T00:00:00.000Z\",\"m3\":8.002105263157894,\"m6\":8.121052631578948,\"y1\":8.111052631578946,\"y2\":8.370526315789473,\"y3\":8.386842105263158,\"y5\":8.424736842105263,\"y7\":8.47578947368421,\"y10\":8.473157894736843,\"y30\":8.503684210526314},{\"time\":\"1990-03-31T00:00:00.000Z\",\"m3\":8.17,\"m6\":8.280000000000001,\"y1\":8.350000000000001,\"y2\":8.626818181818182,\"y3\":8.627272727272727,\"y5\":8.600454545454546,\"y7\":8.648181818181818,\"y10\":8.588636363636365,\"y30\":8.563181818181818},{\"time\":\"1990-04-30T00:00:00.000Z\",\"m3\":8.0405,\"m6\":8.27,\"y1\":8.4045,\"y2\":8.723999999999998,\"y3\":8.782499999999999,\"y5\":8.768,\"y7\":8.812999999999999,\"y10\":8.7855,\"y30\":8.755999999999997},{\"time\":\"1990-05-31T00:00:00.000Z\",\"m3\":8.006818181818183,\"m6\":8.190909090909093,\"y1\":8.316363636363635,\"y2\":8.642272727272728,\"y3\":8.692272727272726,\"y5\":8.73590909090909,\"y7\":8.783636363636367,\"y10\":8.758181818181818,\"y30\":8.731363636363637},{\"time\":\"1990-06-30T00:00:00.000Z\",\"m3\":7.986666666666668,\"m6\":8.045238095238094,\"y1\":8.096190476190475,\"y2\":8.35095238095238,\"y3\":8.39809523809524,\"y5\":8.43047619047619,\"y7\":8.517619047619048,\"y10\":8.480000000000002,\"y30\":8.457619047619048},{\"time\":\"1990-07-31T00:00:00.000Z\",\"m3\":7.8747619047619075,\"m6\":7.923333333333333,\"y1\":7.940952380952382,\"y2\":8.157142857142858,\"y3\":8.264761904761908,\"y5\":8.33095238095238,\"y7\":8.455238095238096,\"y10\":8.471428571428573,\"y30\":8.498095238095239},{\"time\":\"1990-08-31T00:00:00.000Z\",\"m3\":7.694347826086955,\"m6\":7.766086956521738,\"y1\":7.7791304347826085,\"y2\":8.061304347826086,\"y3\":8.218695652173912,\"y5\":8.436521739130434,\"y7\":8.643913043478262,\"y10\":8.752608695652174,\"y30\":8.863478260869565},{\"time\":\"1990-09-30T00:00:00.000Z\",\"m3\":7.597894736842105,\"m6\":7.69842105263158,\"y1\":7.7631578947368425,\"y2\":8.079473684210527,\"y3\":8.26736842105263,\"y5\":8.513684210526316,\"y7\":8.786842105263156,\"y10\":8.893157894736841,\"y30\":9.028947368421054},{\"time\":\"1990-10-31T00:00:00.000Z\",\"m3\":7.4,\"m6\":7.5295454545454525,\"y1\":7.551363636363636,\"y2\":7.877727272727273,\"y3\":8.068636363636363,\"y5\":8.327727272727273,\"y7\":8.593636363636362,\"y10\":8.719545454545454,\"y30\":8.857727272727272},{\"time\":\"1990-11-30T00:00:00.000Z\",\"m3\":7.2905,\"m6\":7.3850000000000025,\"y1\":7.3134999999999994,\"y2\":7.599500000000001,\"y3\":7.736999999999999,\"y5\":8.0225,\"y7\":8.276499999999999,\"y10\":8.392,\"y30\":8.540500000000002},{\"time\":\"1990-12-31T00:00:00.000Z\",\"m3\":6.9495000000000005,\"m6\":7.026499999999999,\"y1\":7.0504999999999995,\"y2\":7.314,\"y3\":7.465999999999999,\"y5\":7.7265,\"y7\":8.000499999999999,\"y10\":8.075,\"y30\":8.237},{\"time\":\"1991-01-31T00:00:00.000Z\",\"m3\":6.4104761904761896,\"m6\":6.575714285714286,\"y1\":6.644285714285714,\"y2\":7.125238095238095,\"y3\":7.3776190476190475,\"y5\":7.699999999999998,\"y7\":7.97047619047619,\"y10\":8.091904761904763,\"y30\":8.26952380952381},{\"time\":\"1991-02-28T00:00:00.000Z\",\"m3\":6.116315789473683,\"m6\":6.194736842105264,\"y1\":6.266842105263158,\"y2\":6.866842105263159,\"y3\":7.07736842105263,\"y5\":7.472631578947366,\"y7\":7.73263157894737,\"y10\":7.854736842105262,\"y30\":8.034210526315789},{\"time\":\"1991-03-31T00:00:00.000Z\",\"m3\":6.0935,\"m6\":6.1985,\"y1\":6.396,\"y2\":7.103,\"y3\":7.353500000000001,\"y5\":7.772,\"y7\":8.002500000000001,\"y10\":8.110000000000001,\"y30\":8.288},{\"time\":\"1991-04-30T00:00:00.000Z\",\"m3\":5.825454545454547,\"m6\":5.9768181818181825,\"y1\":6.235909090909092,\"y2\":6.948181818181819,\"y3\":7.2318181818181815,\"y5\":7.700909090909089,\"y7\":7.922727272727273,\"y10\":8.039090909090909,\"y30\":8.209545454545452},{\"time\":\"1991-05-31T00:00:00.000Z\",\"m3\":5.633636363636363,\"m6\":5.873181818181819,\"y1\":6.130454545454546,\"y2\":6.783636363636364,\"y3\":7.11681818181818,\"y5\":7.701363636363635,\"y7\":7.942272727272726,\"y10\":8.067727272727272,\"y30\":8.267272727272728},{\"time\":\"1991-06-30T00:00:00.000Z\",\"m3\":5.7509999999999994,\"m6\":6.023999999999999,\"y1\":6.358499999999999,\"y2\":6.956,\"y3\":7.391500000000002,\"y5\":7.936999999999999,\"y7\":8.171000000000001,\"y10\":8.284000000000002,\"y30\":8.471999999999998},{\"time\":\"1991-07-31T00:00:00.000Z\",\"m3\":5.750909090909092,\"m6\":5.974545454545455,\"y1\":6.305454545454544,\"y2\":6.917727272727273,\"y3\":7.375909090909093,\"y5\":7.911363636363637,\"y7\":8.146818181818183,\"y10\":8.272727272727272,\"y30\":8.452272727272726},{\"time\":\"1991-08-31T00:00:00.000Z\",\"m3\":5.497727272727273,\"m6\":5.633636363636364,\"y1\":5.778181818181817,\"y2\":6.4331818181818194,\"y3\":6.797272727272728,\"y5\":7.425,\"y7\":7.74,\"y10\":7.8999999999999995,\"y30\":8.143636363636364},{\"time\":\"1991-09-30T00:00:00.000Z\",\"m3\":5.373500000000001,\"m6\":5.479000000000001,\"y1\":5.5725,\"y2\":6.181499999999999,\"y3\":6.5,\"y5\":7.135999999999998,\"y7\":7.4765,\"y10\":7.650000000000001,\"y30\":7.948},{\"time\":\"1991-10-31T00:00:00.000Z\",\"m3\":5.144090909090909,\"m6\":5.259090909090909,\"y1\":5.333636363636363,\"y2\":5.912272727272728,\"y3\":6.229090909090909,\"y5\":6.871363636363637,\"y7\":7.246363636363637,\"y10\":7.527272727272727,\"y30\":7.9304545454545465},{\"time\":\"1991-11-30T00:00:00.000Z\",\"m3\":4.689473684210525,\"m6\":4.801052631578948,\"y1\":4.889473684210526,\"y2\":5.558947368421052,\"y3\":5.903684210526316,\"y5\":6.617894736842106,\"y7\":7.058947368421053,\"y10\":7.417368421052631,\"y30\":7.92157894736842},{\"time\":\"1991-12-31T00:00:00.000Z\",\"m3\":4.184285714285713,\"m6\":4.261428571428572,\"y1\":4.378095238095239,\"y2\":5.025714285714285,\"y3\":5.392857142857143,\"y5\":6.186190476190476,\"y7\":6.685238095238096,\"y10\":7.088571428571428,\"y30\":7.701904761904762},{\"time\":\"1992-01-31T00:00:00.000Z\",\"m3\":3.906190476190477,\"m6\":4.009999999999999,\"y1\":4.150952380952381,\"y2\":4.958095238095238,\"y3\":5.395714285714287,\"y5\":6.242857142857143,\"y7\":6.704761904761904,\"y10\":7.032380952380953,\"y30\":7.581904761904763},{\"time\":\"1992-02-29T00:00:00.000Z\",\"m3\":3.9500000000000006,\"m6\":4.076315789473684,\"y1\":4.287368421052631,\"y2\":5.212105263157894,\"y3\":5.719999999999999,\"y5\":6.577894736842105,\"y7\":6.962105263157895,\"y10\":7.337894736842106,\"y30\":7.8547368421052655},{\"time\":\"1992-03-31T00:00:00.000Z\",\"m3\":4.138636363636364,\"m6\":4.330909090909091,\"y1\":4.634545454545454,\"y2\":5.6850000000000005,\"y3\":6.1831818181818194,\"y5\":6.945454545454544,\"y7\":7.257272727272727,\"y10\":7.542272727272726,\"y30\":7.969545454545454},{\"time\":\"1992-04-30T00:00:00.000Z\",\"m3\":3.8390476190476193,\"m6\":4.002857142857142,\"y1\":4.299047619047619,\"y2\":5.344285714285713,\"y3\":5.925238095238096,\"y5\":6.784285714285714,\"y7\":7.15285714285714,\"y10\":7.480476190476191,\"y30\":7.962380952380952},{\"time\":\"1992-05-31T00:00:00.000Z\",\"m3\":3.7190000000000003,\"m6\":3.8815,\"y1\":4.189499999999999,\"y2\":5.2254999999999985,\"y3\":5.8135,\"y5\":6.6925,\"y7\":7.0615,\"y10\":7.392000000000001,\"y30\":7.891},{\"time\":\"1992-06-30T00:00:00.000Z\",\"m3\":3.745,\"m6\":3.894999999999999,\"y1\":4.165909090909091,\"y2\":5.048181818181817,\"y3\":5.597272727272727,\"y5\":6.482727272727273,\"y7\":6.904545454545455,\"y10\":7.26181818181818,\"y30\":7.841818181818181},{\"time\":\"1992-07-31T00:00:00.000Z\",\"m3\":3.2795454545454534,\"m6\":3.3831818181818183,\"y1\":3.5959090909090907,\"y2\":4.3554545454545455,\"y3\":4.906363636363635,\"y5\":5.836818181818182,\"y7\":6.357272727272728,\"y10\":6.844545454545455,\"y30\":7.5981818181818195},{\"time\":\"1992-08-31T00:00:00.000Z\",\"m3\":3.1990476190476187,\"m6\":3.310952380952381,\"y1\":3.471904761904762,\"y2\":4.192857142857143,\"y3\":4.724761904761905,\"y5\":5.596190476190476,\"y7\":6.121904761904762,\"y10\":6.585714285714286,\"y30\":7.390476190476188},{\"time\":\"1992-09-30T00:00:00.000Z\",\"m3\":2.968571428571428,\"m6\":3.041904761904762,\"y1\":3.1842857142857146,\"y2\":3.8942857142857137,\"y3\":4.415238095238096,\"y5\":5.38,\"y7\":5.96095238095238,\"y10\":6.415238095238097,\"y30\":7.340952380952382},{\"time\":\"1992-10-31T00:00:00.000Z\",\"m3\":2.932857142857143,\"m6\":3.127619047619047,\"y1\":3.3023809523809526,\"y2\":4.082857142857142,\"y3\":4.638095238095239,\"y5\":5.600476190476191,\"y7\":6.154761904761905,\"y10\":6.589047619047619,\"y30\":7.531904761904761},{\"time\":\"1992-11-30T00:00:00.000Z\",\"m3\":3.2057894736842103,\"m6\":3.439473684210526,\"y1\":3.682105263157895,\"y2\":4.579473684210527,\"y3\":5.140526315789474,\"y5\":6.037894736842105,\"y7\":6.49,\"y10\":6.873157894736842,\"y30\":7.606842105263159},{\"time\":\"1992-12-31T00:00:00.000Z\",\"m3\":3.291363636363637,\"m6\":3.4686363636363633,\"y1\":3.711363636363636,\"y2\":4.673636363636363,\"y3\":5.213636363636363,\"y5\":6.07590909090909,\"y7\":6.456818181818181,\"y10\":6.769999999999999,\"y30\":7.436363636363637},{\"time\":\"1993-01-31T00:00:00.000Z\",\"m3\":3.0710526315789473,\"m6\":3.237894736842105,\"y1\":3.496315789473683,\"y2\":4.39,\"y3\":4.932631578947368,\"y5\":5.8336842105263145,\"y7\":6.26,\"y10\":6.6,\"y30\":7.341578947368421},{\"time\":\"1993-02-28T00:00:00.000Z\",\"m3\":2.9926315789473685,\"m6\":3.160526315789474,\"y1\":3.3857894736842105,\"y2\":4.09842105263158,\"y3\":4.578947368421052,\"y5\":5.428947368421054,\"y7\":5.868947368421054,\"y10\":6.258947368421054,\"y30\":7.0894736842105255},{\"time\":\"1993-03-31T00:00:00.000Z\",\"m3\":3.0143478260869565,\"m6\":3.1456521739130436,\"y1\":3.3330434782608696,\"y2\":3.9495652173913043,\"y3\":4.401304347826087,\"y5\":5.194782608695653,\"y7\":5.655652173913044,\"y10\":5.975217391304348,\"y30\":6.821739130434783},{\"time\":\"1993-04-30T00:00:00.000Z\",\"m3\":2.9304761904761905,\"m6\":3.0628571428571427,\"y1\":3.2442857142857147,\"y2\":3.837619047619048,\"y3\":4.302380952380951,\"y5\":5.1328571428571435,\"y7\":5.593809523809523,\"y10\":5.969523809523809,\"y30\":6.854285714285714},{\"time\":\"1993-05-31T00:00:00.000Z\",\"m3\":3.025,\"m6\":3.1655000000000006,\"y1\":3.3634999999999997,\"y2\":3.9769999999999994,\"y3\":4.4045000000000005,\"y5\":5.1979999999999995,\"y7\":5.659000000000001,\"y10\":6.0355,\"y30\":6.919},{\"time\":\"1993-06-30T00:00:00.000Z\",\"m3\":3.144545454545454,\"m6\":3.294545454545455,\"y1\":3.536363636363637,\"y2\":4.163636363636364,\"y3\":4.530909090909091,\"y5\":5.216818181818181,\"y7\":5.611818181818181,\"y10\":5.962727272727272,\"y30\":6.807272727272727},{\"time\":\"1993-07-31T00:00:00.000Z\",\"m3\":3.11095238095238,\"m6\":3.2576190476190483,\"y1\":3.4747619047619045,\"y2\":4.071904761904762,\"y3\":4.42952380952381,\"y5\":5.0909523809523805,\"y7\":5.476190476190475,\"y10\":5.805238095238097,\"y30\":6.6257142857142854},{\"time\":\"1993-08-31T00:00:00.000Z\",\"m3\":3.0904545454545445,\"m6\":3.235454545454545,\"y1\":3.4436363636363634,\"y2\":4.001363636363636,\"y3\":4.363636363636364,\"y5\":5.0249999999999995,\"y7\":5.353181818181818,\"y10\":5.677727272727274,\"y30\":6.323181818181819},{\"time\":\"1993-09-30T00:00:00.000Z\",\"m3\":3.008571428571428,\"m6\":3.1509523809523805,\"y1\":3.356190476190476,\"y2\":3.8471428571428583,\"y3\":4.165238095238095,\"y5\":4.734761904761904,\"y7\":5.076190476190477,\"y10\":5.36,\"y30\":5.997142857142857},{\"time\":\"1993-10-31T00:00:00.000Z\",\"m3\":3.092,\"m6\":3.219,\"y1\":3.3920000000000003,\"y2\":3.8745,\"y3\":4.175000000000001,\"y5\":4.707000000000001,\"y7\":5.054,\"y10\":5.333999999999999,\"y30\":5.938999999999999},{\"time\":\"1993-11-30T00:00:00.000Z\",\"m3\":3.1795,\"m6\":3.3614999999999995,\"y1\":3.5790000000000006,\"y2\":4.1555,\"y3\":4.498,\"y5\":5.063,\"y7\":5.446999999999999,\"y10\":5.724000000000001,\"y30\":6.210000000000001},{\"time\":\"1993-12-31T00:00:00.000Z\",\"m3\":3.127727272727273,\"m6\":3.3354545454545454,\"y1\":3.6072727272727274,\"y2\":4.212272727272729,\"y3\":4.54,\"y5\":5.146818181818182,\"y7\":5.484090909090909,\"y10\":5.7740909090909085,\"y30\":6.251818181818181},{\"time\":\"1994-01-31T00:00:00.000Z\",\"m3\":3.0444999999999993,\"m6\":3.2529999999999992,\"y1\":3.5425000000000004,\"y2\":4.14,\"y3\":4.478999999999999,\"y5\":5.087,\"y7\":5.430999999999999,\"y10\":5.750500000000001,\"y30\":6.2909999999999995},{\"time\":\"1994-02-28T00:00:00.000Z\",\"m3\":3.3305263157894736,\"m6\":3.534736842105264,\"y1\":3.86578947368421,\"y2\":4.474210526315789,\"y3\":4.832105263157895,\"y5\":5.395263157894736,\"y7\":5.719473684210527,\"y10\":5.9731578947368416,\"y30\":6.490526315789474},{\"time\":\"1994-03-31T00:00:00.000Z\",\"m3\":3.5908695652173903,\"m6\":3.914782608695653,\"y1\":4.3191304347826085,\"y2\":4.995217391304348,\"y3\":5.395652173913043,\"y5\":5.941304347826086,\"y7\":6.28,\"y10\":6.482608695652175,\"y30\":6.906521739130435},{\"time\":\"1994-04-30T00:00:00.000Z\",\"m3\":3.7805263157894737,\"m6\":4.247368421052633,\"y1\":4.815789473684211,\"y2\":5.549473684210528,\"y3\":5.99421052631579,\"y5\":6.52421052631579,\"y7\":6.8042105263157895,\"y10\":6.972105263157893,\"y30\":7.2689473684210535},{\"time\":\"1994-05-31T00:00:00.000Z\",\"m3\":4.267619047619048,\"m6\":4.785714285714287,\"y1\":5.314285714285714,\"y2\":5.968095238095238,\"y3\":6.3361904761904775,\"y5\":6.779999999999999,\"y7\":7.006190476190476,\"y10\":7.183333333333333,\"y30\":7.412380952380951},{\"time\":\"1994-06-30T00:00:00.000Z\",\"m3\":4.24909090909091,\"m6\":4.719545454545455,\"y1\":5.267272727272728,\"y2\":5.931363636363637,\"y3\":6.2681818181818185,\"y5\":6.695454545454546,\"y7\":6.906818181818181,\"y10\":7.101363636363635,\"y30\":7.395},{\"time\":\"1994-07-31T00:00:00.000Z\",\"m3\":4.4565,\"m6\":4.9535,\"y1\":5.4765,\"y2\":6.129999999999999,\"y3\":6.475999999999999,\"y5\":6.9094999999999995,\"y7\":7.124499999999999,\"y10\":7.298,\"y30\":7.578999999999999},{\"time\":\"1994-08-31T00:00:00.000Z\",\"m3\":4.611739130434784,\"m6\":5.081739130434784,\"y1\":5.562173913043479,\"y2\":6.177391304347825,\"y3\":6.495652173913044,\"y5\":6.877826086956523,\"y7\":7.062173913043479,\"y10\":7.236086956521739,\"y30\":7.486086956521742},{\"time\":\"1994-09-30T00:00:00.000Z\",\"m3\":4.751428571428572,\"m6\":5.240000000000001,\"y1\":5.762857142857142,\"y2\":6.392380952380951,\"y3\":6.69285714285714,\"y5\":7.083333333333333,\"y7\":7.283333333333334,\"y10\":7.4571428571428555,\"y30\":7.712380952380952},{\"time\":\"1994-10-31T00:00:00.000Z\",\"m3\":5.101999999999999,\"m6\":5.6209999999999996,\"y1\":6.114500000000001,\"y2\":6.728500000000001,\"y3\":7.041500000000001,\"y5\":7.402999999999999,\"y7\":7.5815,\"y10\":7.744,\"y30\":7.9350000000000005},{\"time\":\"1994-11-30T00:00:00.000Z\",\"m3\":5.449,\"m6\":5.975,\"y1\":6.539999999999999,\"y2\":7.1485,\"y3\":7.44,\"y5\":7.717500000000001,\"y7\":7.830000000000001,\"y10\":7.955,\"y30\":8.081500000000002},{\"time\":\"1994-12-31T00:00:00.000Z\",\"m3\":5.7647619047619045,\"m6\":6.504761904761905,\"y1\":7.1361904761904755,\"y2\":7.58952380952381,\"y3\":7.70952380952381,\"y5\":7.776190476190478,\"y7\":7.801428571428572,\"y10\":7.813809523809524,\"y30\":7.871428571428571},{\"time\":\"1995-01-31T00:00:00.000Z\",\"m3\":5.9014999999999995,\"m6\":6.5059999999999985,\"y1\":7.050500000000001,\"y2\":7.506999999999998,\"y3\":7.6625,\"y5\":7.7559999999999985,\"y7\":7.791500000000001,\"y10\":7.779499999999999,\"y30\":7.846500000000001},{\"time\":\"1995-02-28T00:00:00.000Z\",\"m3\":5.939473684210526,\"m6\":6.30842105263158,\"y1\":6.696842105263157,\"y2\":7.111578947368422,\"y3\":7.247368421052631,\"y5\":7.365789473684211,\"y7\":7.440526315789474,\"y10\":7.469473684210527,\"y30\":7.6115789473684226},{\"time\":\"1995-03-31T00:00:00.000Z\",\"m3\":5.910434782608696,\"m6\":6.1726086956521735,\"y1\":6.431739130434783,\"y2\":6.775652173913042,\"y3\":6.892173913043479,\"y5\":7.047391304347829,\"y7\":7.142608695652172,\"y10\":7.204782608695651,\"y30\":7.447826086956522},{\"time\":\"1995-04-30T00:00:00.000Z\",\"m3\":5.837894736842105,\"m6\":6.0463157894736845,\"y1\":6.265789473684211,\"y2\":6.567894736842104,\"y3\":6.684210526315789,\"y5\":6.860000000000002,\"y7\":6.951052631578947,\"y10\":7.06263157894737,\"y30\":7.360526315789475},{\"time\":\"1995-05-31T00:00:00.000Z\",\"m3\":5.847727272727274,\"m6\":5.930454545454546,\"y1\":5.997727272727274,\"y2\":6.170909090909091,\"y3\":6.268636363636362,\"y5\":6.414545454545456,\"y7\":6.503181818181818,\"y10\":6.632727272727272,\"y30\":6.9499999999999975},{\"time\":\"1995-06-30T00:00:00.000Z\",\"m3\":5.63909090909091,\"m6\":5.661818181818183,\"y1\":5.6422727272727276,\"y2\":5.715909090909092,\"y3\":5.795909090909091,\"y5\":5.928636363636364,\"y7\":6.047272727272727,\"y10\":6.168181818181818,\"y30\":6.57318181818182},{\"time\":\"1995-07-31T00:00:00.000Z\",\"m3\":5.592999999999999,\"m6\":5.618499999999999,\"y1\":5.593999999999999,\"y2\":5.779999999999999,\"y3\":5.8854999999999995,\"y5\":6.008500000000001,\"y7\":6.199000000000001,\"y10\":6.2780000000000005,\"y30\":6.721000000000001},{\"time\":\"1995-08-31T00:00:00.000Z\",\"m3\":5.565652173913042,\"m6\":5.650434782608695,\"y1\":5.752608695652173,\"y2\":5.980869565217391,\"y3\":6.102608695652172,\"y5\":6.24391304347826,\"y7\":6.411739130434783,\"y10\":6.488260869565219,\"y30\":6.860434782608695},{\"time\":\"1995-09-30T00:00:00.000Z\",\"m3\":5.434,\"m6\":5.536999999999999,\"y1\":5.62,\"y2\":5.805999999999999,\"y3\":5.891,\"y5\":6.0015,\"y7\":6.131499999999999,\"y10\":6.1975,\"y30\":6.5489999999999995},{\"time\":\"1995-10-31T00:00:00.000Z\",\"m3\":5.444285714285714,\"m6\":5.5647619047619035,\"y1\":5.590476190476191,\"y2\":5.6971428571428575,\"y3\":5.7719047619047625,\"y5\":5.862857142857143,\"y7\":5.967142857142859,\"y10\":6.044761904761906,\"y30\":6.374761904761904},{\"time\":\"1995-11-30T00:00:00.000Z\",\"m3\":5.5180952380952375,\"m6\":5.505714285714285,\"y1\":5.432857142857143,\"y2\":5.478571428571428,\"y3\":5.56952380952381,\"y5\":5.694285714285714,\"y7\":5.83,\"y10\":5.930476190476189,\"y30\":6.262857142857142},{\"time\":\"1995-12-31T00:00:00.000Z\",\"m3\":5.2940000000000005,\"m6\":5.349000000000001,\"y1\":5.307,\"y2\":5.3245000000000005,\"y3\":5.386500000000001,\"y5\":5.513499999999999,\"y7\":5.6315,\"y10\":5.711499999999999,\"y30\":6.062500000000001},{\"time\":\"1996-01-31T00:00:00.000Z\",\"m3\":5.150476190476191,\"m6\":5.132857142857142,\"y1\":5.0876190476190475,\"y2\":5.112380952380952,\"y3\":5.204761904761903,\"y5\":5.362380952380953,\"y7\":5.539047619047619,\"y10\":5.652380952380953,\"y30\":6.051904761904763},{\"time\":\"1996-02-29T00:00:00.000Z\",\"m3\":4.9645,\"m6\":4.966499999999999,\"y1\":4.941999999999999,\"y2\":5.025499999999999,\"y3\":5.143000000000001,\"y5\":5.3795,\"y7\":5.638,\"y10\":5.8055,\"y30\":6.242000000000001},{\"time\":\"1996-03-31T00:00:00.000Z\",\"m3\":5.097619047619047,\"m6\":5.158571428571429,\"y1\":5.342380952380952,\"y2\":5.66095238095238,\"y3\":5.785714285714285,\"y5\":5.9661904761904765,\"y7\":6.18952380952381,\"y10\":6.268571428571428,\"y30\":6.604285714285714},{\"time\":\"1996-04-30T00:00:00.000Z\",\"m3\":5.087727272727273,\"m6\":5.267727272727273,\"y1\":5.537727272727275,\"y2\":5.957272727272727,\"y3\":6.107727272727273,\"y5\":6.300909090909091,\"y7\":6.48,\"y10\":6.511363636363637,\"y30\":6.794090909090909},{\"time\":\"1996-05-31T00:00:00.000Z\",\"m3\":5.153636363636366,\"m6\":5.33090909090909,\"y1\":5.636818181818182,\"y2\":6.095,\"y3\":6.2713636363636365,\"y5\":6.483181818181818,\"y7\":6.656818181818181,\"y10\":6.736818181818182,\"y30\":6.927727272727273},{\"time\":\"1996-06-30T00:00:00.000Z\",\"m3\":5.2315,\"m6\":5.462000000000001,\"y1\":5.8100000000000005,\"y2\":6.296999999999999,\"y3\":6.484999999999999,\"y5\":6.689499999999998,\"y7\":6.834000000000001,\"y10\":6.911999999999999,\"y30\":7.059000000000002},{\"time\":\"1996-07-31T00:00:00.000Z\",\"m3\":5.298181818181818,\"m6\":5.524090909090909,\"y1\":5.85090909090909,\"y2\":6.270000000000001,\"y3\":6.453636363636362,\"y5\":6.635909090909092,\"y7\":6.75818181818182,\"y10\":6.865454545454546,\"y30\":7.033181818181819},{\"time\":\"1996-08-31T00:00:00.000Z\",\"m3\":5.189090909090909,\"m6\":5.341363636363637,\"y1\":5.666818181818183,\"y2\":6.029090909090908,\"y3\":6.206363636363636,\"y5\":6.38909090909091,\"y7\":6.515000000000001,\"y10\":6.6354545454545475,\"y30\":6.841818181818183},{\"time\":\"1996-09-30T00:00:00.000Z\",\"m3\":5.237500000000002,\"m6\":5.453500000000001,\"y1\":5.833,\"y2\":6.234,\"y3\":6.407499999999999,\"y5\":6.5969999999999995,\"y7\":6.7299999999999995,\"y10\":6.831999999999999,\"y30\":7.025999999999999},{\"time\":\"1996-10-31T00:00:00.000Z\",\"m3\":5.123181818181818,\"m6\":5.316363636363636,\"y1\":5.549999999999999,\"y2\":5.912727272727273,\"y3\":6.078636363636363,\"y5\":6.270454545454546,\"y7\":6.420000000000002,\"y10\":6.533636363636364,\"y30\":6.808636363636364},{\"time\":\"1996-11-30T00:00:00.000Z\",\"m3\":5.169473684210526,\"m6\":5.273684210526316,\"y1\":5.4231578947368435,\"y2\":5.7015789473684215,\"y3\":5.818421052631578,\"y5\":5.973157894736842,\"y7\":6.097368421052631,\"y10\":6.203684210526316,\"y30\":6.481578947368421},{\"time\":\"1996-12-31T00:00:00.000Z\",\"m3\":5.0404761904761894,\"m6\":5.243333333333334,\"y1\":5.471904761904762,\"y2\":5.7819047619047605,\"y3\":5.906666666666668,\"y5\":6.068095238095237,\"y7\":6.199047619047618,\"y10\":6.302380952380952,\"y30\":6.552380952380953},{\"time\":\"1997-01-31T00:00:00.000Z\",\"m3\":5.165714285714286,\"m6\":5.307619047619049,\"y1\":5.612380952380951,\"y2\":6.008095238095239,\"y3\":6.155714285714287,\"y5\":6.333333333333332,\"y7\":6.471428571428571,\"y10\":6.579047619047619,\"y30\":6.826666666666666},{\"time\":\"1997-02-28T00:00:00.000Z\",\"m3\":5.1421052631578945,\"m6\":5.265263157894737,\"y1\":5.525263157894737,\"y2\":5.898421052631579,\"y3\":6.032631578947368,\"y5\":6.198947368421052,\"y7\":6.318947368421052,\"y10\":6.419473684210526,\"y30\":6.687894736842104},{\"time\":\"1997-03-31T00:00:00.000Z\",\"m3\":5.2844999999999995,\"m6\":5.479,\"y1\":5.795499999999999,\"y2\":6.222,\"y3\":6.378499999999999,\"y5\":6.536999999999999,\"y7\":6.653499999999999,\"y10\":6.6945,\"y30\":6.932499999999997},{\"time\":\"1997-04-30T00:00:00.000Z\",\"m3\":5.304545454545456,\"m6\":5.595,\"y1\":5.988181818181817,\"y2\":6.448181818181817,\"y3\":6.605,\"y5\":6.75909090909091,\"y7\":6.86,\"y10\":6.885454545454547,\"y30\":7.092727272727273},{\"time\":\"1997-05-31T00:00:00.000Z\",\"m3\":5.196666666666668,\"m6\":5.527619047619047,\"y1\":5.86952380952381,\"y2\":6.276666666666666,\"y3\":6.421428571428571,\"y5\":6.567619047619049,\"y7\":6.658571428571429,\"y10\":6.71095238095238,\"y30\":6.935714285714285},{\"time\":\"1997-06-30T00:00:00.000Z\",\"m3\":5.070952380952381,\"m6\":5.338571428571429,\"y1\":5.691904761904762,\"y2\":6.094761904761905,\"y3\":6.237142857142858,\"y5\":6.375238095238096,\"y7\":6.458095238095237,\"y10\":6.493809523809525,\"y30\":6.772380952380952},{\"time\":\"1997-07-31T00:00:00.000Z\",\"m3\":5.1945454545454535,\"m6\":5.329545454545455,\"y1\":5.541818181818181,\"y2\":5.8909090909090915,\"y3\":6.001363636363635,\"y5\":6.120909090909091,\"y7\":6.201818181818182,\"y10\":6.220454545454545,\"y30\":6.51},{\"time\":\"1997-08-31T00:00:00.000Z\",\"m3\":5.279523809523808,\"m6\":5.401428571428572,\"y1\":5.564761904761905,\"y2\":5.93904761904762,\"y3\":6.059523809523809,\"y5\":6.159999999999999,\"y7\":6.29047619047619,\"y10\":6.298571428571426,\"y30\":6.578571428571429},{\"time\":\"1997-09-30T00:00:00.000Z\",\"m3\":5.084761904761905,\"m6\":5.295714285714285,\"y1\":5.523809523809523,\"y2\":5.881904761904762,\"y3\":5.975714285714285,\"y5\":6.106190476190474,\"y7\":6.200952380952381,\"y10\":6.208571428571428,\"y30\":6.495238095238094},{\"time\":\"1997-10-31T00:00:00.000Z\",\"m3\":5.112727272727273,\"m6\":5.299090909090908,\"y1\":5.456363636363636,\"y2\":5.771818181818182,\"y3\":5.83909090909091,\"y5\":5.928181818181819,\"y7\":6.054090909090909,\"y10\":6.029545454545456,\"y30\":6.326363636363637},{\"time\":\"1997-11-30T00:00:00.000Z\",\"m3\":5.2811111111111115,\"m6\":5.376666666666667,\"y1\":5.457222222222222,\"y2\":5.712777777777778,\"y3\":5.754999999999999,\"y5\":5.803888888888888,\"y7\":5.901666666666667,\"y10\":5.874999999999999,\"y30\":6.109444444444446},{\"time\":\"1997-12-31T00:00:00.000Z\",\"m3\":5.304545454545454,\"m6\":5.451363636363637,\"y1\":5.5249999999999995,\"y2\":5.715,\"y3\":5.741818181818181,\"y5\":5.7731818181818175,\"y7\":5.825000000000002,\"y10\":5.8086363636363645,\"y30\":5.99},{\"time\":\"1998-01-31T00:00:00.000Z\",\"m3\":5.179,\"m6\":5.230500000000001,\"y1\":5.244499999999999,\"y2\":5.356999999999999,\"y3\":5.375,\"y5\":5.416,\"y7\":5.5305,\"y10\":5.544500000000001,\"y30\":5.811000000000002},{\"time\":\"1998-02-28T00:00:00.000Z\",\"m3\":5.23,\"m6\":5.274210526315789,\"y1\":5.308421052631579,\"y2\":5.417894736842104,\"y3\":5.4342105263157885,\"y5\":5.4926315789473685,\"y7\":5.603157894736842,\"y10\":5.574736842105264,\"y30\":5.8910526315789475},{\"time\":\"1998-03-31T00:00:00.000Z\",\"m3\":5.16181818181818,\"m6\":5.248181818181817,\"y1\":5.3895454545454555,\"y2\":5.561363636363636,\"y3\":5.566818181818181,\"y5\":5.611818181818183,\"y7\":5.709090909090909,\"y10\":5.647272727272727,\"y30\":5.948181818181817},{\"time\":\"1998-04-30T00:00:00.000Z\",\"m3\":5.082857142857142,\"m6\":5.2628571428571425,\"y1\":5.379047619047619,\"y2\":5.564285714285712,\"y3\":5.580952380952383,\"y5\":5.611904761904762,\"y7\":5.695714285714286,\"y10\":5.637619047619048,\"y30\":5.923809523809524}];\n", "beakerx.time = [633744000000,636163200000,638841600000,641433600000,644112000000,646704000000,649382400000,652060800000,654652800000,657331200000,659923200000,662601600000,665280000000,667699200000,670377600000,672969600000,675648000000,678240000000,680918400000,683596800000,686188800000,688867200000,691459200000,694137600000,696816000000,699321600000,702000000000,704592000000,707270400000,709862400000,712540800000,715219200000,717811200000,720489600000,723081600000,725760000000,728438400000,730857600000,733536000000,736128000000,738806400000,741398400000,744076800000,746755200000,749347200000,752025600000,754617600000,757296000000,759974400000,762393600000,765072000000,767664000000,770342400000,772934400000,775612800000,778291200000,780883200000,783561600000,786153600000,788832000000,791510400000,793929600000,796608000000,799200000000,801878400000,804470400000,807148800000,809827200000,812419200000,815097600000,817689600000,820368000000,823046400000,825552000000,828230400000,830822400000,833500800000,836092800000,838771200000,841449600000,844041600000,846720000000,849312000000,851990400000,854668800000,857088000000,859766400000,862358400000,865036800000,867628800000,870307200000,872985600000,875577600000,878256000000,880848000000,883526400000,886204800000,888624000000,891302400000,893894400000];\n", "beakerx.m3 = [7.898095238095237,8.002105263157894,8.17,8.0405,8.006818181818183,7.986666666666668,7.8747619047619075,7.694347826086955,7.597894736842105,7.4,7.2905,6.9495000000000005,6.4104761904761896,6.116315789473683,6.0935,5.825454545454547,5.633636363636363,5.7509999999999994,5.750909090909092,5.497727272727273,5.373500000000001,5.144090909090909,4.689473684210525,4.184285714285713,3.906190476190477,3.9500000000000006,4.138636363636364,3.8390476190476193,3.7190000000000003,3.745,3.2795454545454534,3.1990476190476187,2.968571428571428,2.932857142857143,3.2057894736842103,3.291363636363637,3.0710526315789473,2.9926315789473685,3.0143478260869565,2.9304761904761905,3.025,3.144545454545454,3.11095238095238,3.0904545454545445,3.008571428571428,3.092,3.1795,3.127727272727273,3.0444999999999993,3.3305263157894736,3.5908695652173903,3.7805263157894737,4.267619047619048,4.24909090909091,4.4565,4.611739130434784,4.751428571428572,5.101999999999999,5.449,5.7647619047619045,5.9014999999999995,5.939473684210526,5.910434782608696,5.837894736842105,5.847727272727274,5.63909090909091,5.592999999999999,5.565652173913042,5.434,5.444285714285714,5.5180952380952375,5.2940000000000005,5.150476190476191,4.9645,5.097619047619047,5.087727272727273,5.153636363636366,5.2315,5.298181818181818,5.189090909090909,5.237500000000002,5.123181818181818,5.169473684210526,5.0404761904761894,5.165714285714286,5.1421052631578945,5.2844999999999995,5.304545454545456,5.196666666666668,5.070952380952381,5.1945454545454535,5.279523809523808,5.084761904761905,5.112727272727273,5.2811111111111115,5.304545454545454,5.179,5.23,5.16181818181818,5.082857142857142];\n", "beakerx.y10 = [8.206666666666667,8.473157894736843,8.588636363636365,8.7855,8.758181818181818,8.480000000000002,8.471428571428573,8.752608695652174,8.893157894736841,8.719545454545454,8.392,8.075,8.091904761904763,7.854736842105262,8.110000000000001,8.039090909090909,8.067727272727272,8.284000000000002,8.272727272727272,7.8999999999999995,7.650000000000001,7.527272727272727,7.417368421052631,7.088571428571428,7.032380952380953,7.337894736842106,7.542272727272726,7.480476190476191,7.392000000000001,7.26181818181818,6.844545454545455,6.585714285714286,6.415238095238097,6.589047619047619,6.873157894736842,6.769999999999999,6.6,6.258947368421054,5.975217391304348,5.969523809523809,6.0355,5.962727272727272,5.805238095238097,5.677727272727274,5.36,5.333999999999999,5.724000000000001,5.7740909090909085,5.750500000000001,5.9731578947368416,6.482608695652175,6.972105263157893,7.183333333333333,7.101363636363635,7.298,7.236086956521739,7.4571428571428555,7.744,7.955,7.813809523809524,7.779499999999999,7.469473684210527,7.204782608695651,7.06263157894737,6.632727272727272,6.168181818181818,6.2780000000000005,6.488260869565219,6.1975,6.044761904761906,5.930476190476189,5.711499999999999,5.652380952380953,5.8055,6.268571428571428,6.511363636363637,6.736818181818182,6.911999999999999,6.865454545454546,6.6354545454545475,6.831999999999999,6.533636363636364,6.203684210526316,6.302380952380952,6.579047619047619,6.419473684210526,6.6945,6.885454545454547,6.71095238095238,6.493809523809525,6.220454545454545,6.298571428571426,6.208571428571428,6.029545454545456,5.874999999999999,5.8086363636363645,5.544500000000001,5.574736842105264,5.647272727272727,5.637619047619048];\n", "beakerx.spread = [0.3085714285714296,0.4710526315789494,0.4186363636363648,0.745000000000001,0.7513636363636351,0.49333333333333407,0.5966666666666658,1.0582608695652196,1.2952631578947367,1.3195454545454535,1.1014999999999997,1.1254999999999988,1.6814285714285733,1.7384210526315789,2.0165000000000015,2.213636363636362,2.4340909090909086,2.533000000000003,2.5218181818181797,2.4022727272727264,2.2765000000000004,2.3831818181818187,2.7278947368421056,2.904285714285715,3.1261904761904757,3.3878947368421053,3.4036363636363625,3.6414285714285715,3.673000000000001,3.51681818181818,3.5650000000000013,3.3866666666666676,3.446666666666669,3.6561904761904764,3.6673684210526316,3.4786363636363618,3.5289473684210524,3.266315789473685,2.9608695652173913,3.039047619047618,3.0105,2.818181818181818,2.6942857142857166,2.587272727272729,2.3514285714285723,2.2419999999999987,2.544500000000001,2.6463636363636356,2.7060000000000013,2.642631578947368,2.8917391304347846,3.191578947368419,2.9157142857142846,2.852272727272725,2.8415,2.6243478260869555,2.7057142857142837,2.6420000000000003,2.5060000000000002,2.0490476190476192,1.8779999999999992,1.5300000000000011,1.2943478260869554,1.2247368421052647,0.7849999999999975,0.5290909090909084,0.6850000000000014,0.9226086956521771,0.7634999999999996,0.6004761904761917,0.4123809523809516,0.41749999999999865,0.5019047619047621,0.8410000000000002,1.1709523809523805,1.4236363636363638,1.5831818181818162,1.6804999999999994,1.5672727272727283,1.446363636363638,1.5944999999999974,1.410454545454546,1.03421052631579,1.2619047619047628,1.4133333333333322,1.277368421052632,1.4100000000000001,1.580909090909091,1.5142857142857116,1.4228571428571444,1.0259090909090913,1.019047619047618,1.1238095238095234,0.9168181818181829,0.5938888888888876,0.5040909090909107,0.3655000000000008,0.3447368421052639,0.48545454545454714,0.5547619047619063];\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var x = [1, 4, 6, 8, 10]\n", "var y = [3, 6, 4, 5, 9]\n", "var pp = new beakerx.Plot({title: 'Bars, Lines, Points and 2nd yAxis', \n", " xLabel: \"xLabel\", \n", " yLabel: \"yLabel\", \n", " legendLayout: beakerx.LegendLayout.HORIZONTAL,\n", " legendPosition: beakerx.LegendPosition.RIGHT,\n", " omitCheckboxes: true})\n", "pp.add(new beakerx.YAxis({label: \"Right yAxis\"}))\n", "pp.add(new beakerx.Bars({displayName: \"Bar\", \n", " x: [1,3,5,7,10], \n", " y: [100, 120,90,100,80], \n", " width: 1}))\n", "pp.add(new beakerx.Line({displayName: \"Line\", \n", " x: x, \n", " y: y, \n", " width: 6, \n", " yAxis: \"Right yAxis\"}))\n", "pp.add(new beakerx.Points({x: x, \n", " y: y, \n", " size: 10, \n", " shape: beakerx.ShapeType.DIAMOND,\n", " yAxis: \"Right yAxis\"}))\n", "\n", "pp.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var ch = new beakerx.Crosshair({color: beakerx.prefs.theme.plotColors[0], width: 2, style: beakerx.StrokeType.DOT})\n", "var plot = new beakerx.Plot({crosshair: ch});\n", "var y1 = [4, 8, 16, 20, 32]\n", "var base = [2, 4, 8, 10, 16];\n", "var cs = [beakerx.Color.black, beakerx.Color.orange, beakerx.Color.gray, beakerx.Color.yellow, beakerx.Color.pink]\n", "var ss = [beakerx.StrokeType.SOLID, \n", " beakerx.StrokeType.SOLID, \n", " beakerx.StrokeType.DASH, \n", " beakerx.StrokeType.DOT, \n", " beakerx.StrokeType.DASHDOT, \n", " beakerx.StrokeType.LONGDASH]\n", "plot.add(new beakerx.Area({y: y1, base: base, color: new beakerx.Color(255, 0, 0, 50)}))\n", "plot.add(new beakerx.Stems({y: y1, base: base, color: cs, style: ss, width: 5}))\n", "\n", "plot.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var POSITIVE_INFINITY = 1.0 / 0.0;\n", "var NEGATIVE_INFINITY = -1.0 / 0.0;\n", "var p = new beakerx.Plot()\n", "p.add(new beakerx.Line({y: [-3, 1, 3, 4, 5]}))\n", "p.add(new beakerx.ConstantBand({x: [NEGATIVE_INFINITY, 0.5], color: new beakerx.Color(128, 128, 128, 50)}))\n", "p.add(new beakerx.ConstantLine({x: 0.5, style: beakerx.StrokeType.DOT, color: beakerx.Color.blue}))\n", "p.add(new beakerx.ConstantLine({y: -1, style: beakerx.StrokeType.DASHDOT, color: beakerx.Color.blue}))\n", "p.add(new beakerx.ConstantLine({x: 3, y: 4, color: beakerx.Color.gray, width: 5, showLabel: true}))\n", "p.add(new beakerx.ConstantBand({x: [1, 2], y: [1, 3]}))\n", "p.add(new beakerx.ConstantBand({x: [4, POSITIVE_INFINITY], color: new beakerx.Color(128, 128, 128, 50)}))\n", "\n", "p.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var POSITIVE_INFINITY = 1.0 / 0.0;\n", "var NEGATIVE_INFINITY = -1.0 / 0.0;\n", "var p = new beakerx.Plot() \n", "p.add(new beakerx.Line({x: [-3, 1, 2, 4, 5], y: [4, 2, 6, 1, 5]}))\n", "p.add(new beakerx.ConstantBand({x: [NEGATIVE_INFINITY, 1], color: new beakerx.Color(128, 128, 128, 50)}))\n", "p.add(new beakerx.ConstantBand({x: [1, 2]}))\n", "p.add(new beakerx.ConstantBand({x: [4, POSITIVE_INFINITY]}))\n", "\n", "p.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var today = new Date();\n", "var millis = today.getTime();\n", "var hour = 1000 * 60 * 60;\n", "var xs = [];\n", "var ys = [];\n", "for(var i=0; i <= 10; i++){\n", " xs.push(millis + hour * i);\n", " ys.push(i);\n", "}\n", "\n", "var plot = new beakerx.TimePlot({timeZone: \"America/New_York\"});\n", "//list of milliseconds\n", "plot.add(new beakerx.Points({x: xs, y: ys, size: 10, displayName: \"milliseconds\"}));\n", "\n", "plot.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var today = new Date()\n", "var millis = today.getTime()\n", "var nanos = millis * 1000 * 1000\n", "var xs = [];\n", "var ys = [];\n", "for(var i=0; i <= 10; i++){\n", " xs.push(new Big(nanos).plus(7 * i).toString());\n", " ys.push(i);\n", "}\n", "var np = new beakerx.NanoPlot()\n", "np.add(new beakerx.Points({x: xs, y: ys}))\n", "\n", "np.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var y1 = [1,5,3,2,3]\n", "var y2 = [7,2,4,1,3]\n", "var p = new beakerx.Plot({title: 'Plot with XYStacker', initHeight: 200})\n", "var a1 = new beakerx.Area({y: y1, displayName: 'y1'})\n", "var a2 = new beakerx.Area({y: y2, displayName: 'y2'})\n", "p.add(beakerx.XYStacker.stack([a1, a2]))\n", "\n", "p.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var plot = new beakerx.SimpleTimePlot(beakerx.rates, [\"y1\", \"y10\"]);\n", "\n", "plot.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var plot = new beakerx.SimpleTimePlot(beakerx.rates, [\"y1\", \"y10\"], // column names\n", " {timeColumn : \"time\", // time is default value for a timeColumn\n", " yLabel: \"Price\", \n", " displayNames: [\"1 Year\", \"10 Year\"],\n", " colors : [[216, 154, 54], beakerx.Color.lightGray],\n", " displayLines: false, // no lines (true by default)\n", " displayPoints: true}) // show points (false by default))\n", "\n", "plot.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "%%javascript\n", "\n", "var lehmanDate = Date.parse(\"2008 Sep 15\")\n", "var bubbleBottomDate = Date.parse(\"2002 Oct 09\")\n", "var inversion1 = [Date.parse(\"2000 Jul 22\"), Date.parse(\"2001 Feb 16\")]\n", "var inversion2 = [Date.parse(\"2006 Aug 01\"), Date.parse(\"2007 Jun 07\")]\n", "\"ok\"\n", "// The CombinedPlot allows for stacked plots with linked X axis.\n", "var c = new beakerx.CombinedPlot({title: \"US Treasuries\", initWidth: 1000})\n", "var ch = new beakerx.Crosshair({color: beakerx.Color.gray, width: 2, style: beakerx.StrokeType.DOT})\n", "\n", "// The top plot has 2 lines.\n", "var p1 = new beakerx.TimePlot({yLabel: \"Interest Rate\", crosshair: ch})\n", "p1.add(new beakerx.Line({x: beakerx.time, y: beakerx.m3, displayName: \"3 month\"}))\n", "p1.add(new beakerx.Line({x: beakerx.time, y: beakerx.y10, displayName: \"10 year\"}))\n", "\n", "// The bottom plot has an area filled in.\n", "var p2 = new beakerx.TimePlot({yLabel: \"Spread\", crosshair: ch})\n", "p2.add(new beakerx.Area({x: beakerx.time, y: beakerx.spread, color: new beakerx.Color(120, 60, 0)}))\n", "\n", "// Highlight the inversion intervals\n", "var b1 = new beakerx.ConstantBand({x: inversion1, color: new beakerx.Color(240, 100, 100, 55)})\n", "var b2 = new beakerx.ConstantBand({x: inversion2, color: new beakerx.Color(240, 100, 100, 55)})\n", "\n", "// Add notation and line for Lehman Bankruptcy.\n", "p1.add(new beakerx.Text({x: lehmanDate, y: 7.5, text: \"Lehman Brothers Bankruptcy\"}))\n", "var l1 = new beakerx.ConstantLine({x: lehmanDate, style: beakerx.StrokeType.DOT, color: beakerx.Color.gray})\n", "\n", "// Add notation and line for Stocks Nadir.\n", "p1.add(new beakerx.Text({x: bubbleBottomDate, y: 5.75, text: \"Stocks Hit Bottom\"}))\n", "var l2 = new beakerx.ConstantLine({x: bubbleBottomDate, style: beakerx.StrokeType.DOT, color: beakerx.Color.gray})\n", "\n", "// add the notations and highlight bands to both plots\n", "p1.add(l1).add(l2).add(b1).add(b2)\n", "p2.add(l1).add(l2).add(b1).add(b2)\n", "\n", "// add both plots to the combined plot, and including their relative heights.\n", "c.add(p1, 3)\n", "c.add(p2, 1)\n", "\n", "c.display(this);" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.4" } }, "nbformat": 4, "nbformat_minor": 2 }