{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "barsPlot = new Plot(useToolTip: false);\n", "barsPlot << new Bars(x: (1..5), y: [5, 2, 4, 3, 7], )\n", " .onKey(KeyboardCodes.SHIFT, {info -> info.graphics.y[info.index]++})\n", " .onKey(\"T\", \"tag1\")\n", " .onKey(\"U\", {info -> info.graphics.y[info.index]--;\n", " beakerx.runByTag(\"tag1\")\n", " })" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag1" ] }, "outputs": [], "source": [ "def details = barsPlot.details\n", "def item = details.graphics\n", "def index = details.index\n", "println (item.x[index] + \":\" + item.y[index])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "barsPlot2 = new Plot(useToolTip: false);\n", "barsPlot2 << new Bars(x: (1..5), y: [5, 2, 4, 3, 7], )\n", " .onClick({info -> info.graphics.y[info.index]++;\n", " beakerx.runByTag(\"tag2\")\n", " })" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag2" ] }, "outputs": [], "source": [ "def details2 = barsPlot2.details\n", "def item2 = details2.graphics\n", "def index2 = details2.index\n", "println (item2.x[index2] + \":\" + item2.y[index2])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "barsPlot3 = new Plot(useToolTip: false);\n", "barsPlot3 << new Bars(x: (1..5), y: [5, 2, 4, 3, 7], ).onClick(\"tag3\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag3" ] }, "outputs": [], "source": [ "def details3 = barsPlot3.details\n", "def item3 = details3.graphics\n", "def index3 = details3.index\n", "println (item3.x[index3] + \":\" + item3.y[index3])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "barsPlot4 = new Plot(useToolTip: false);\n", "barsPlot4 << new Bars(x: (1..5), y: [12, 6, 8, 4, 8], )" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cplot5 = new CombinedPlot()\n", "def plot5_1 = new Plot(useToolTip: false);\n", "plot5_1 << new Bars(x: (1..5), y: [5, 2, 4, 3, 7]).onClick({info -> info.graphics.y[info.index]++;}) \n", "cplot5.add(plot5_1)\n", "\n", "def plot5_2 = new Plot(useToolTip: false);\n", "plot5_2 << new Bars(x: (1..5), y: [12, 6, 8, 4, 8], color: new Color(200, 55, 55)).onClick(\"tag52\")\n", "cplot5.add(plot5_2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag52" ] }, "outputs": [], "source": [ "println (cplot5.subplots[1])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cplot6 = new CombinedPlot()\n", "def plot6_1 = new Plot(useToolTip: false);\n", "plot6_1 << new Bars(x: (1..5), y: [12, 6, 8, 4, 8])\n", " .onClick({info -> info.graphics.y[info.index]--; beakerx.runByTag(\"tag61\"); }) \n", "cplot6.add(plot6_1)\n", "\n", "def plot6_2 = new Plot(useToolTip: false);\n", "plot6_2 << new Bars(x: (1..5), y: [5, 2, 4, 3, 7], color: new Color(55, 200, 55))\n", " .onClick({ beakerx.runByTag(\"tag62\"); })\n", "cplot6.add(plot6_2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag61" ] }, "outputs": [], "source": [ "def details61 = cplot6.subplots[0].details\n", "def item61 = details61.graphics\n", "def index61 = details61.index\n", "println (item61.x[index61] + \":\" + item61.y[index61])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag62" ] }, "outputs": [], "source": [ "println (cplot6.subplots[1])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cplot7 = new CombinedPlot()\n", "def plot7_1 = new Plot(useToolTip: false);\n", "plot7_1 << new Bars(x: (1..5), y: [5, 2, 4, 3, 7]).onKey(KeyboardCodes.SHIFT, { info -> info.graphics.y[info.index]++; }) \n", "cplot7.add(plot7_1)\n", "\n", "def plot7_2 = new Plot(useToolTip: false);\n", "plot7_2 << new Bars(x: (1..5), y: [12, 6, 8, 4, 8], color: new Color(200, 55, 55)).onKey(\"T\", \"tag72\")\n", "cplot7.add(plot7_2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag72" ] }, "outputs": [], "source": [ "println (cplot7.subplots[1])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "cplot8 = new CombinedPlot()\n", "def plot8_1 = new Plot(useToolTip: false);\n", "plot8_1 << new Bars(x: (1..5), y: [12, 6, 8, 4, 8])\n", " .onKey(KeyboardCodes.SHIFT,{info -> info.graphics.y[info.index]--; beakerx.runByTag(\"tag81\"); }) \n", "cplot8.add(plot8_1)\n", "\n", "def plot8_2 = new Plot(useToolTip: false);\n", "plot8_2 << new Bars(x: (1..5), y: [5, 2, 4, 3, 7], color: new Color(55, 200, 55))\n", " .onKey(\"U\", { beakerx.runByTag(\"tag82\"); })\n", "cplot8.add(plot8_2)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag81" ] }, "outputs": [], "source": [ "def details81 = cplot8.subplots[0].details\n", "def item81 = details81.graphics\n", "def index81 = details81.index\n", "println (item81.x[index81] + \":\" + item81.y[index81])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "tag82" ] }, "outputs": [], "source": [ "println (cplot8.subplots[1])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "Groovy", "language": "groovy", "name": "groovy" }, "language_info": { "codemirror_mode": "groovy", "file_extension": ".groovy", "mimetype": "", "name": "Groovy", "nbconverter_exporter": "", "version": "2.4.3" } }, "nbformat": 4, "nbformat_minor": 2 }