Skip navigation.

Slightly ajar

Updated SVG map

, ,

Since the previous post, I've updated the Opera market share map somewhat. Now instead of having an automatically playing list of data, you can access the data by hovering over the specific country, and the country in question will also highlight.

For the country highlight I used mouse events on the country’s path element. I added a set element as a child of the path element which changes the class attribute to active. To add the mouse events, I added the code begin="mouseover" end="mouseout", which is fairly self-explanatory. For displaying the market share data it is slightly more complicated, as I wanted the action to happen on a different element to the active element – in this case the text elements. This also isn't too difficult when you know how. On the set and animate elements used by the text elements, I also used mouse events, but had to say which element triggers the animation. In the case of Belarus, I used code such as begin="by.mouseover" end="by.mouseout" which says to begin the animation when the element with the ID by has a mouse over event and ends when the same element has a mouse out event. I chain a number of animations. The first (where the code sample is from) is a set element to set the visibility of the text element, and the next two are animate elements to fade in and fade out the text element by changing the opacity value. You can chain as many of the different animation elements as you'd like. If you are wondering what the difference is between set and animate, set only changes the value once and happens without interpolation (i.e. is on or off, black or white), while with animate, there can be a series of value changes and it animates between the values (so opacity 0 to 1 will animate through each step from 0 to 1, instead of fully transparent to fully opaque).

As well as changing the interaction, I also compressed the file using GZip and changed the extension to svgz. This reduces the file size and tells the browser to decompress the file before passing it to the SVG engine for rendering. Many web servers may not be set up to handle svgz files (so the browser will get confused), so you may have to add the HTTP Header to your configuration file. In Apache I did this using the following instructions. This allows Opera and Safari to know the data is GZip compressed, but doesn't seem to work for Firefox at the moment. I'm not 100% sure why yet.

[DEMO] Opera Eastern/Central Europe market share map in SVG.

Opera market share map

Comments

Chas4 21. April 2009, 15:13

very :cool:

tomassplatch 22. April 2009, 07:33

that's some real falsh alternative! very nice!

agony 22. April 2009, 08:40

that looks pretty awesome :eek:

Anonymous 22. April 2009, 10:31

Maulkin writes:

I'm the Annon from your post, and great work here!

There's one minor thing to fix, Russia is currently in two part, but those are not interdependent as are the two part of Azerbaidjan.

Also maybe you could add numbers to the scale of red. Maybe add 0===100% [=== symbolize the scale of red], it would be more "visual".

An other suggestion would be to put the indicatives of the country on the map, and when hovering giving the full name to read. Now it's really difficult, if you don't know well your geography, to read Armenia or Moldavia. Or just change to full name country everywhere. Or maybe add the full name when hovering+the indicative like this: "Moldavia [MD]".



dstorey 22. April 2009, 15:26

Maulkin: I've fixed the Russia bug by putting a g element (stands for group) around both of the Russian path elements, and moving the set element to be a child of the g instead. Unfortunately this now makes a bug in Safari (its SMIL/Animation support seems to be quite buggy) where the highlight flashes on and off for Russia, Kazakhstan, Armenia, Georgia and Azerbaijan. Sometimes the highlight will work. All very strange.

dstorey 22. April 2009, 15:48

I've done a quick update to the key too, but I'm not 100% happy with it yet

FataL 22. April 2009, 17:03

:cool:

FataL 22. April 2009, 20:31

BTW, it's a pity that Opera can't print in vector (as Firefox, Chrome and even IE do).
Also Opera 10 print this map in very buggy way. Regression from 9.6?

IceArdor 28. April 2009, 06:25

Amazing that something that pretty was hand-made in notepad and can be rendered on the fly. 10 years ago the Web only knew about animated gifs.

AOTEAROAnz 28. April 2009, 06:55

Thanks!
One query: am i seeing the full image?

dstorey 28. April 2009, 20:44

Yes, that is the full image so far AOTEAROAnz

AOTEAROAnz 29. April 2009, 00:01

Thankyou, sorry to plonk it here. It was as small as i could post it. Thanks verymuch!

dantesoft 29. April 2009, 06:13

Maybe the scale should be 0%, 25%, 50%. Belarus now has a much-more-than-51% colour.

kamalesh 12. May 2009, 22:21

Very cool SVG map for Opera share, David. :smile:

DanielHendrycks 21. October 2009, 12:14

:cool:

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies