Damn, man. Sorry to hear about that. Those situations are never fun...
My own experience comes from when my family were on a vacation in Uruguay. One of our trips took us to a war museum, unfortunately located on a hill in one of the poorer parts of the country.
As we were walking back to our car, there were a couple guys around the parking area. One of them seemed about 18-20, the other one was younger by at least a few years.
The older one started walking up to us, asked for our cameras (my older brother was asked first) and pulled out a rather big chef's knife. My brother refused, the guy made a grab for his camera but missed as my brother pulled away.
At this point, seeing the miss (and due to what I later learned from my Mum was that she picked up on how the guy was acting, standing, how he missed the grab, etc., my Mum figured he was rather new at this), my Mum started yelling/swearing at the guy.
Seeing my mum start this up, I put my own camera away and started walking slowly towards the guy, not breaking eye contact. My brother did the same. My mum kept yelling and moving with us.
The guy started backing off, beginning to look a little scared/confused (this obviously wasn't the direction he expected the encounter to go in haha), still brandishing the knife. After we backed him away about 5-10 metres from the car he stopped, swung around the knife a little more, then bolted off down the hill. When we turned back around to the car, and the other kid was no where to be seen.
So, a little shaken but soon alright again, we got back in the car and headed off to our next destination...
As for advice I can offer from my own situation... Unfortunately, it was rather unique. I mean, there's always the advice to act as one group, since if people try to handle it in different ways in your group it could just lead to confusion and simply make the whole situation worse...
E.g., the only reason we were able to scare off a knife-wielding mugger is because my older brother and I followed my Mum's lead once she started moving towards him, yelling and swearing, etc. We acted as one, which would have made it all the more intimidating for the mugger.
If my brother and Mum, instead, thought it best to go along with it... Well, I wouldn't be happy with it (not that I'm saying they would be happy with it), but I would go along with that too.
The people you're with, your own confidence/skill, the antagonist's skill/experience, etc... All these things make every situation unique, so I'm not sure there are many hard and fast rules to go by.
There are several methods of learning how to defend yourself though, which I do feel is good advice, but it does depend on the area too.
It was easy enough to scare away the guy who came at us, since ultimately, despite his big knife, he was just an older teen who had probably only tried this on squeamish tourist-y types who didn't fight back, if he had even done this before at all. But I know not to try this at all in certain areas I know, because the muggers in those areas are a lot harder, and a lot less conservative with just how they might use their knife if you don't co-operate.
So, I guess... Street-smarts go a long way, too?