{ "cells": [ { "cell_type": "markdown", "id": "65983341", "metadata": {}, "source": [ "# Tooltip Customization API: `disableSplitting()`\n", "\n", "New function `disableSplitting()` allows to hide side tooltips.\n", "\n", "By default, this function moves all side tooltips to the general tooltip. If the content of a general tooltip is specified with the `line()` functions, the general tooltip will get the given lines, and the side tooltips will be hidden." ] }, { "cell_type": "code", "execution_count": 1, "id": "72876cea", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "DataFrame: rowsCount = 5, columnsCount = 12
\n", " \n", " \n", " " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "var mpgDf = DataFrame.readCSV(\"https://raw.githubusercontent.com/JetBrains/lets-plot-kotlin/master/docs/examples/data/mpg.csv\")\n", "val mpgData = mpgDf.toMap()\n", "mpgDf.head()" ] }, { "cell_type": "markdown", "id": "ddd23d1b", "metadata": {}, "source": [ "#### 1. Default Tooltips" ] }, { "cell_type": "code", "execution_count": 4, "id": "686825cd", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "letsPlot(mpgData) {x=\"class\"; y=\"hwy\"} + geomBoxplot()" ] }, { "cell_type": "markdown", "id": "5174606d", "metadata": {}, "source": [ "#### 2. `disableSplitting()`\n", "\n", "The function moves all side tooltips to the general tooltip." ] }, { "cell_type": "code", "execution_count": 5, "id": "ea287310", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "letsPlot(mpgData) {x=\"class\"; y=\"hwy\"} + geomBoxplot(tooltips = layerTooltips().disableSplitting())" ] }, { "cell_type": "markdown", "id": "5f0912b0", "metadata": {}, "source": [ "#### 3. `disableSplitting()` and Configure \"Tooltip Lines\"\n", "\n", "All side tooltips are hidden, the general tooltip gets the specified lines." ] }, { "cell_type": "code", "execution_count": 6, "id": "07fc18d4", "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "letsPlot(mpgData) {x=\"class\"; y=\"hwy\"} + geomBoxplot(tooltips = layerTooltips()\n", " .line(\"@|^middle\")\n", " .disableSplitting())" ] } ], "metadata": { "kernelspec": { "display_name": "Kotlin", "language": "kotlin", "name": "kotlin" }, "language_info": { "codemirror_mode": "text/x-kotlin", "file_extension": ".kt", "mimetype": "text/x-kotlin", "name": "kotlin", "nbconvert_exporter": "", "pygments_lexer": "kotlin", "version": "1.8.20" } }, "nbformat": 4, "nbformat_minor": 5 }