CSS animation is something I have yet to explore, I suppose I have not found any use for it yet. So I’m not saying anything specific, more theoretical.
Your back-end scripting will be able to plot the points on the chart to draw the svg line.
A simple way to get the reveal effect of the line may be to have some kind of animated rectangular mask, to block out the lines initially and reveal as it moves/shrinks horizontally.
When I looked at this last night I thought you meant the hover tooltips and thought, animated?? .
But now I get what you mean.
The Y reference lines don’t have any X reference ticks so I think SamA74’s mask idea could work.
If you can create an identical chart “fragment” with only the reference lines I think it could be placed over the real chart, and position slid, over-flow hidden somehow?
If not that, narrowing width, align right?
I think if you wanted to animate properly you would need to automate it with js otherwise you would have to set up keyframe animations for every point in that svg with delays and timings to match. I am not familiar with svg animations but I;m guessing that if you are drawing each segment then you would need to have the animation on each segment and therefore really needs to be automated via js even if using css for the animation.
You could do what Sam suggested and just blank out the whole chart and then reveal it with a keyframe rule. This would be quite simple and the basic code would be this.
Your suggestions and script does a splendid job. It is absolutely excellent, not only does it work but discovered no need to display the SVG along with umpteen individual lines, points, circles, titles, etc. The server now reads from the database, creates both a SVG file and a single image. Image is downloaded and displayed with the browser. And also the page size has shrunk tremendously. Making it ideal for mobiles!!!
Now only to debug and find out why it works in FireFox but the animation goes on forever with Chrome. It is now late here so will have another go tomorrow.
Many thanks once again, I had an 'Orrible feeling I would have to use pages of JavaScript to create the same effect.
I have made most of the changes, tested on the live server and discovered there was a clash with the third-party Cloud Server. Animation did not work no doubt due to caching
I updated the above site with a link to another site not using a CDN.
If the original link is not redirecting correctly then here is a site link (with no CDN):
Sorry, I don;t know anything about servers but are you sure the animation is not just running before the page has loaded?
In my example I put in an animation delay of 1s just to give it a chance but you could increase that delay to allow the page to load. I don’t know if it will solve that server issue though
Delighted to say it is possible to animate a SVG file without using JavaScript. It was not easy to find the relevant documentation it seems JavaScript Libraries are far more popular for some unknown reason.
If anyone looks at the HTML, SVG or Style-sheet, please excuse the code as I am now busy with the last 5% before optisation
The SVG learning curve is long and steep but well worth the effort. If time is short then there are numerous JavaScript libraries available which can easily be copied and pasted. Result will be slower so not as good for mobile viewing.
[off-topic]
Why is Pingdom showing a zero file size for the SVG logo? Is it because the file is embedded and will it not be cached?