bramp / js-sequence-diagrams

Draws simple SVG sequence diagrams from textual representation of the diagram
https://bramp.github.io/js-sequence-diagrams/
BSD 2-Clause "Simplified" License
7.82k stars 1.08k forks source link

Can I use duplicate note name? #106

Open suhyunjeon opened 9 years ago

suhyunjeon commented 9 years ago

Can I use duplicate note name? I want to connect links each note like A->B, B->C, C<-B. They recognized that unique notes. 'C', 'C<', 'B', 'B<'. It is same. They changed note names.

Title: SBC Call Flow Diagram
A->B: INVITE SDP
B->C: INVITE SDP
C<-B: 180 Ringing
C->B: 180 Ringing
B-A: 180 Ringing
B<-C: 200 OK
B->C: 200 OK
B<-C: 200 OK

Image of Yaktocat

bramp commented 9 years ago

If I understand you correctly, I think you just need to flip your arrows.

Instead of C<-B, write B->C.

suhyunjeon commented 9 years ago

Hello @bramp. Thank you for your reply. It is same to result. I changed source code from sequence-diagram-min.js.

    Diagram.prototype.getActor = function(alias, name) {
        alias = alias.replace("<", "");
        alias = alias.trim();

It solved problem.

bramp commented 9 years ago

Would you show me the resulting image with your change. I would like to understand what you were trying to achieve.

Thanks

suhyunjeon commented 9 years ago

OK.

//////////////// Before //////////////// Image of Yaktocat

//////////////// After ////////////////

Image of Yaktocat

bramp commented 9 years ago

Hey @suhyunjeon that 2nd diagram doesn't look quite right. The 180 Ringing arrow is going in the wrong direction, acording to your text.

Either way, I think you just need to rework your text to always have arrows pointing right. For example:

192.168.12.154->192.168.13.223: INVITE SDP
192.168.13.223->192.168.13.224: INVITE SDP
192.168.13.223->192.168.13.224: 180 Ringing
192.168.13.224->192.168.13.223: 180 Ringing
192.168.12.154->192.168.13.223: 180 Ringing
192.168.12.42->192.168.13.223: 200 OK
192.168.13.223->192.168.13.224: 200 OK
192.168.13.224->192.168.13.223: 200 OK

makes: screen shot 2015-05-24 at 1 03 22 pm

which has arrows going both left and right in the image.

suhyunjeon commented 9 years ago

I was upload wrong result pic. It it right yours. Anyway it need to modify code( sequence-diagram-min.js) what I want to do.