Blog2020 ≫ Popex got better graphs

I updated the graphs, this is the third iteration of popex graphs.

First I used SVG1 lines, this is great but generates quite a lot of code on a busy graph, and I'm very mean about the amount of code I want to create. A nice looking page might have lots of html code to get it there, and that all means extra storage, extra processing, extra bandwidth. All this means extra cost to me2 and extra slowness at your end when your browser tries to build the page. These pages of mine are fast and efficient and I want to keep them that way. So step two of the graphs was to use an SVG path, seemed sensible, much less code, though makes a bit of a chunky graph the way I did it. You can do curves with a path, but I don't know the maths for making "price went up by 0.1p" into a sensible curve, so I did step up, step down. Looks like this:

<path points="m 60 72 h 1 v 2 h 1 v -2 h 1 v 1 h 2 v 2" />

Instead what I really wanted was the nicer spikey looking graphs you see on real financial sites. So the answer is a polyline3, it looks more like this:

<polyline points="60,72 62,72 63,74 64,75 65,77 66,77 959,230 960,230" fill="none" />

And that's what I'm going with now. It's even less work for me as the pairs of numbers are the actual positions of the points, which is easier to relate to my original price data. The path needed the difference between the new point and the last. Man I love SVG. The visual difference shows up on a graph with not much action on yet, like one of the new acts I just added Billie Eilish. I don't really now who that is but they did the new bond theme and are in the album charts and it's fine I'm sure.

I realise now I am just procrastinating and delaying putting this live. I should get it out there and let people try and break it and if it doesn't work out just shut it down again. It's going to cost me less than I thought based on the estimated costs for the popbitch thing so far. Prices have come down a bit since I last used this kind of server. So I might get people I don't know trading on this before the end of the weekend. The last thing for me to actually build is the regular payment of dividends to players, including the "you earn a percentage of the dividends the people you signed up earned" which was important in the original game.

Looking like a lovely day for the VE Day anniversary bank holiday here, shame there is not much going out.

🕵️

⬅️ :: ➡️

Paul Clarke's weblog - I live in Hythe in Kent. Wed + dad to two, I am a full stack web engineer, + I do js / Node, some ruby, other languages etc. I like pubbing, running, eating, home-automation and other diy jiggery-pokery, history, genealogy, TV, squirrels, pirates, lego, and TIME TRAVEL.