{ "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(\"K\", {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": [] }, { "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 }