veghdev commited on
Commit
955dcbf
1 Parent(s): aa6bd2a

Update ipyvizzustory_demo.ipynb

Browse files
Files changed (1) hide show
  1. ipyvizzustory_demo.ipynb +24 -50
ipyvizzustory_demo.ipynb CHANGED
@@ -46,16 +46,22 @@
46
  "from ipyvizzustory import Story # or\n",
47
  "# from ipyvizzustory.env.ipy.story import Story\n",
48
  "\n",
49
- "from IPython.display import display as display_html, HTML"
50
- ]
51
- },
52
- {
53
- "cell_type": "code",
54
- "execution_count": null,
55
- "id": "1a26e2e9",
56
- "metadata": {},
57
- "outputs": [],
58
- "source": [
 
 
 
 
 
 
59
  "# create data and initialize Story with the created data\n",
60
  "\n",
61
  "data = Data()\n",
@@ -75,16 +81,8 @@
75
  "# )\n",
76
  "# data.add_data_frame(df)\n",
77
  "\n",
78
- "story = Story(data=data)"
79
- ]
80
- },
81
- {
82
- "cell_type": "code",
83
- "execution_count": null,
84
- "id": "27b1d972",
85
- "metadata": {},
86
- "outputs": [],
87
- "source": [
88
  "# create Slides and Steps and add them to the Story\n",
89
  "\n",
90
  "slide1 = Slide(\n",
@@ -99,40 +97,16 @@
99
  " Config({\"color\": \"Foo\", \"x\": \"Baz\", \"geometry\": \"circle\"}),\n",
100
  " )\n",
101
  ")\n",
102
- "story.add_slide(slide2)"
103
- ]
104
- },
105
- {
106
- "cell_type": "code",
107
- "execution_count": null,
108
- "id": "2e06c121",
109
- "metadata": {},
110
- "outputs": [],
111
- "source": [
112
  "# you can set the width and height (CSS style)\n",
113
  "\n",
114
- "story.set_size(width=\"800px\", height=\"480px\")"
115
- ]
116
- },
117
- {
118
- "cell_type": "code",
119
- "execution_count": null,
120
- "id": "e06ff4de",
121
- "metadata": {},
122
- "outputs": [],
123
- "source": [
124
  "# you can get the html Story as a string\n",
125
  "\n",
126
- "html = story.to_html()"
127
- ]
128
- },
129
- {
130
- "cell_type": "code",
131
- "execution_count": null,
132
- "id": "1ab7ece9",
133
- "metadata": {},
134
- "outputs": [],
135
- "source": [
136
  "if \"animation\" in selected:\n",
137
  " story.play()\n",
138
  "if \"code\" in selected:\n",
 
46
  "from ipyvizzustory import Story # or\n",
47
  "# from ipyvizzustory.env.ipy.story import Story\n",
48
  "\n",
49
+ "from IPython.display import display as display_html, HTML\n",
50
+ "\n",
51
+ "import mercury as mr\n",
52
+ "\n",
53
+ "\n",
54
+ "# setup Mercury App\n",
55
+ "app = mr.App(\n",
56
+ " title=\"ipyvizzu-story demo\", description=\"ipyvizzu-story demo with mercury\"\n",
57
+ ")\n",
58
+ " \n",
59
+ "# add widget\n",
60
+ "selected = mr.Select(\n",
61
+ " label=\"Select what you want to see\", choices=[\"animation\", \"code\"], multi=True\n",
62
+ ")\n",
63
+ "\n",
64
+ "\n",
65
  "# create data and initialize Story with the created data\n",
66
  "\n",
67
  "data = Data()\n",
 
81
  "# )\n",
82
  "# data.add_data_frame(df)\n",
83
  "\n",
84
+ "story = Story(data=data)\n",
85
+ "\n",
 
 
 
 
 
 
 
 
86
  "# create Slides and Steps and add them to the Story\n",
87
  "\n",
88
  "slide1 = Slide(\n",
 
97
  " Config({\"color\": \"Foo\", \"x\": \"Baz\", \"geometry\": \"circle\"}),\n",
98
  " )\n",
99
  ")\n",
100
+ "story.add_slide(slide2)\n",
101
+ "\n",
 
 
 
 
 
 
 
 
102
  "# you can set the width and height (CSS style)\n",
103
  "\n",
104
+ "story.set_size(width=\"800px\", height=\"480px\")\n",
105
+ "\n",
 
 
 
 
 
 
 
 
106
  "# you can get the html Story as a string\n",
107
  "\n",
108
+ "html = story.to_html()\n",
109
+ "\n",
 
 
 
 
 
 
 
 
110
  "if \"animation\" in selected:\n",
111
  " story.play()\n",
112
  "if \"code\" in selected:\n",