This was another week that was mostly split between Mapping Metaphor and the Burns projects. The launch of the Burns Highland Tour map for Burns Night last week went down very well and there was quiet a sizable spike in visitors to the website. I started to investigate always visible labels on the map last week but ran into a few problems getting them to actually display the pop-ups when clicked on. I spent a few hours this week trying to get to the bottom of this problem.
The static label in the leaflet.label example page wasn’t working as a clickable label because the leaflet.label CSS file specifies labels with ‘pointer-events: none;’. The plugin has an option ‘clickable: true’ (the default is false) but setting this to ‘true’ doesn’t seem to override the pointer-events setting so I had to manually remove it from the CSS file.
Setting ‘clickable: true’ doesn’t seem to do anything anyway, even when pointer events are allowed. I had to add in an ‘onclick’ event within the label contents to trigger anything. Even though this event was firing and the leaflet openPopup function was being triggered (causing the map to reposition to make room for the popup) no popup was being displayed.
What I realised is that the onclick event was executing before the popup contents could be processed. I added in a ‘setTimeout’ before executing openPopup and now the pop-ups appear (at least they do on my PC – it’s possibly not so good relying on the timeout as a slower PC may still not have processed the popup even after the timeout).
The end result uses markers rather than circles (using circles would require another hack of leaflet.marker as documented here http://stackoverflow.com/questions/15543141/label-for-circle-marker-in-leaflet) . Labels are visible at all zoom levels, which does make things rather cluttered when zoomed out. I investigated whether it would be easy to specify a zoom level beyond which the labels are visible, but the author of the plugin advises against this (see here: https://github.com/Leaflet/Leaflet.label/issues/83). My test map with static labels and markers can be viewed here: http://burnsc21.glasgow.ac.uk/nls-maps/highland-labels.html (note that this is a temporary URL and may stop working at some point. Note also that not all pop-ups contain much in the way of content in this version of the map). I still need to speak to Pauline to see whether she actually wants this version of the map to replace the current version.
I also started working on the interface for Pauline’s new ‘Bawdry in Scottish Chapbooks’ project. She had emailed me a page image featuring a thistle that I’ve managed to build an interface around. It’s only a first draft and it didn’t take long to make. The website isn’t live yet and I will include the URL in one of these posts once it’s publicly available.
The rest of my week was spent on Mapping Metaphor duties. There was a project meeting on Monday at which I demonstrated the new timeline interface. People were generally quite positive about it and gave some good feedback and suggestions, which I acted upon in the days following the meeting. It was agreed that the timeline columns should have some sort of count visible so I added a total above each column, which is a really useful addition. People were getting confused by the use of 6 different colours for the timeline dots (e.g. cyan was used for connections between a category in the external world (green) and the mental world (blue). It was decided that just the already established three colours (red, green and blue) should be used, with each marker given a colour based on the target category only. It was also agreed that the aggregate view data should not appear in the same timeline as individual metaphorical connections as this was just confusing things.
I reached the conclusion that the aggregate timeline view was misleading and really quite useless. What each square represents is the fact that there is one or more metaphorical connection from a level 3 category within the level 2 category that the user is currently looking at (e.g. 2D Emotion) and a level 3 category within another level 2 category that appears in the label (e.g. that 2D14 Pride has 5 strong connections to categories within 1N Movement). The position of the square in a time period means that the earliest of the connections between that specific level 3 category and the other categories takes place within that time period. So with the above example, the square for 2D14 and 5 connections within 1N appears in the OE column but this doesn’t mean there are 5 connections from 2D14 that were first noted in the OE period, just that that’s when the first was noted. Clicking on the square brings up the aggregate metaphor card view with the option to expand 1N movement. This then presents the timeline with all of the connections from 2D and 1N plotted on it, with the 5 for 2D14 appearing within this across the different periods without any highlighting or anything. This is all very confusing and Ellen and I spent some time trying to think how this could be handled better.
On Thursday Ellen, Marc and I had a meeting to discuss the aggregate timeline view, but unfortunately it didn’t go very well and instead went off on a tangent about the validity of the timeline view in general. After the meeting Ellen and I agreed that we would drop the aggregate timeline view entirely (for the time being at least) and only present a timeline view when Level 3 categories are being viewed. I do still want to try and come up with a top-level timeline view that can maybe represent all of the level three connections over time, but that is still going to need a lot of further consideration.
Also this week I updated the metaphor card pop-up and the metaphor card view to replace the in-card timeline with a version that uses the same time periods as the timeline view. I’ve had to update the layout as the text was too long to fit in the old layout (previously the points were individual years e.g. 1250 whereas now we have a range e.g. 1250-1299). The new layout also has ‘Old English’ covering everything pre 1150. It’s possible that the new version is too prominent or it may look like you should be able to click on or drag the highlighted period so it may need further work.
I also noticed that the tabular view of the data was still displaying specific years rather than a period so I updated this too. It is still possible to order the table by the date column and have ‘Old English’ appear first, even though alphabetically / numerically it no longer is (getting that working took a little time).
I also spent a bit of time working with the metaphor data. At Monday’s meeting Marc had suggested that the SAMUELS ‘thematic headings’ for each metaphor category could be appended to the ‘keywords’ column for each category so I wrote a little script that extracted these headings, checked the keywords field to see if the heading was present or not and then appended the heading if it wasn’t already there. I encountered some problems with the categories that were previously classed as ‘H27’, which have now been split into several categories. The thematic headings were all being added to one of the new categories instead of being split across them all. Thankfully Ellen noted which heading should belong to which category and I managed to address the issue. I also made a start with replacing all of the metaphor connection data with the updated data that I’d created for Flora and Ellen just before Christmas, but again ran into some ‘H27’ issues. Ellen is still working through these but hopefully next week I’ll get the new data.