{ "cells": [ { "cell_type": "code", "id": "13e9db2e", "metadata": { "ExecuteTime": { "end_time": "2025-04-21T17:15:58.487048Z", "start_time": "2025-04-21T17:15:58.470104Z" } }, "source": [ "%useLatestDescriptors\n", "%use kandy-echarts" ], "outputs": [], "execution_count": 1 }, { "cell_type": "code", "id": "90760de9", "metadata": { "ExecuteTime": { "end_time": "2025-04-21T17:15:58.596916Z", "start_time": "2025-04-21T17:15:58.494383Z" } }, "source": [ "val dataset = mapOf(\n", " \"days_of_week\" to listOf(\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"),\n", " \"evaporation\" to listOf(2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6),\n", " \"precipitation\" to listOf(2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6),\n", " \"temp\" to listOf(2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3)\n", ")" ], "outputs": [], "execution_count": 2 }, { "cell_type": "code", "id": "4caa8a34", "metadata": { "ExecuteTime": { "end_time": "2025-04-21T17:15:58.930405Z", "start_time": "2025-04-21T17:15:58.600346Z" } }, "source": [ "plot(dataset) {\n", " x(\"days_of_week\"())\n", "\n", " bars {\n", " name = \"Precipitation\"\n", " y(\"precipitation\"()) { scale = continuous(0.0..200.0) }\n", " color(\"temp\"()) { scale = continuous(range = Color.GREY..Color.BLUE) }\n", " label {\n", " position = LabelPosition.TOP\n", " formatter = \"{@precipitation} ml\"\n", " }\n", " }\n", "\n", " line {\n", " name = \"Evaporation\"\n", " y(\"evaporation\"())\n", " symbol = Symbol.diamond(20.0)\n", " }\n", "\n", " layout {\n", " title.text = \"Precipitation and evaporation per week\"\n", " legend {\n", " left = 50.pct\n", " bottom = 0.px\n", " }\n", " }\n", "}" ], "outputs": [ { "data": { "text/html": [ "
" ] }, "execution_count": 3, "metadata": { "text/html": { "isolated": true } }, "output_type": "execute_result" } ], "execution_count": 3 } ], "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-Beta" }, "ktnbPluginMetadata": { "projectDependencies": [ "kandy.kandy-echarts.main" ], "projectLibraries": false } }, "nbformat": 4, "nbformat_minor": 5 }