Skip to content

Commit

Permalink
Updates to show tooltips properly in Pygal 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmatthes committed Mar 3, 2016
1 parent 0bf8572 commit 44a464a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
9 changes: 7 additions & 2 deletions UPDATES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ Some of the libraries featured in the book have been updated recently, which is
Chapter 15
---

Pygal has been updated to version 2. You can install a version of Pygal that runs the code exactly as it's written in the book, or you can install the latest version of Pygal and modify what's in the book slightly. See [installing Pygal](chapter_15/README.md#installing-pygal), and see the [updates to Chapter 15](chapter_15/README.md#updates).
Pygal has been updated to version 2. You can install a version of Pygal that runs the code exactly as it's written in the book, or you can install the latest version of Pygal and modify what's in the book slightly. See [installing Pygal](chapter_15/README.md#installing-pygal), and see the [updates to Chapter 15](chapter_15/README.md#updates) to make tooltips appear on charts.

Chapter 16
---

Pygal's world map and internationalization features have been moved to a separate module. See the section on [installing Pygal](chapter_15/README.md#installing-pygal), and see the specific updates for [Chapter 16](chapter_16/README.md).
Pygal's world map and internationalization features have been moved to a separate module. See the section on [installing Pygal](chapter_15/README.md#installing-pygal), and see the specific [updates for Chapter 16](chapter_16/README.md#updates).

Chapter 17
---

The [updates to Chapter 17](chapter_17/README.md#updates) allow tooltips to show on charts generated with Pygal.
18 changes: 14 additions & 4 deletions chapter_16/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You can easily [install a version of Pygal](chapter_15/README.md#installing-pyga

The first part of this update will tell you what to look for as you work through the section **Mapping Global Data Sets: JSON Format**, which begins on page 362. The second part will give you a page by page update. You can see the updated code files [here](pygal2_update/).

Overall updates
Updates
---

### The `pygal_maps_world` package
Expand Down Expand Up @@ -36,6 +36,15 @@ In the line that creates the world map, change `Worldmap` to `World`:

wm = World()

### Rendering tooltips correctly

As you probably saw in [Chapter 15](chapter_15/README.md#updates), you need to add a line each time you make a chart in order to render tooltips correctly:

<pre>
wm = World()
<b>wm.force_uri_protocol = 'http'</b>
</pre>

Page by page updates
---

Expand All @@ -49,16 +58,17 @@ Use **`from pygal.maps.world import COUNTRIES`** instead of `from pygal.i18n imp

Use **`from pygal.maps.world import World`** instead of `import pygal`.

Use **`wm = World()`** instead of `wm = pygal.Worldmap()`.
Use **`wm = World()`** instead of `wm = pygal.Worldmap()`. Then add the line **`wm.force_uri_protocol = 'http'`**.

### p. 368, *na_populations.py*

Use **`from pygal.maps.world import World`** instead of `import pygal`.

Use **`wm = World()`** instead of `wm = pygal.Worldmap()`.
Use **`wm = World()`** instead of `wm = pygal.Worldmap()`. Then add the line **`wm.force_uri_protocol = 'http'`**.

### p. 369-370, *world_populations.py*

Use **`from pygal.maps.world import World`** instead of `import pygal`.

Use **`wm = World()`** instead of `wm = pygal.Worldmap()`.
Use **`wm = World()`** instead of `wm = pygal.Worldmap()`. Then add the line **`wm.force_uri_protocol = 'http'`**.s

26 changes: 26 additions & 0 deletions chapter_17/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
Chapter 17
===

Updates
---

As you probably saw in [Chapter 15](chapter_15/README.md#updates) and [Chapter 16](chapter_16/README.md#updates), you'll need to add a line each time you make a chart in order to render tooltips correctly:

<pre>
chart = pygal.Bar()
<b>chart.force_uri_protocol = 'http'</b>
</pre>

Page by page updates
---

### p. 384-385, python_repos.py

<pre>
chart = pygal.Bar(style=my_style, x_label_rotation=45, show_legend=False)
<b>chart.force_uri_protocol = 'http'</b>
</pre>

### p. 387-388, bar_descriptions.py

<pre>
chart = pygal.Bar(style=my_style, x_label_rotation=45, show_legend=False)
<b>chart.force_uri_protocol = 'http'</b>
</pre>

0 comments on commit 44a464a

Please sign in to comment.