sverweij / mscgen_js

text => sequence charts
https://mscgen.js.org
GNU General Public License v3.0
206 stars 25 forks source link

Ability to hide sequence raw text until graph is completed. #245

Closed daledude closed 7 years ago

daledude commented 7 years ago

I have some graphs that are kind of complicated and big. I currently see the msc code before the graph is completed. It would be nice to have the ability to set an option to hide the raw graph code and then display after graph is completed.

A javascript function that I can set, possibly via data- attribute, to be called by mscgen_js after it finished creating the graph so I can change the "display" css from "none" or a data- attribute to set option to initially hide. Maybe even a simple "loading" displayed in the center.

sverweij commented 7 years ago

You can use the <script> tag for this. You can use the same data-* attributes as in other elements. Could you try and see if that covers your needs?

<!DOCTYPE html>
<html>
  <head>
    <meta content='text/html;charset=utf-8' http-equiv='Content-Type'>
    <script src='https://sverweij.github.io/mscgen_js/mscgen-inpage.js' defer></script>
  </head>
  <body>
  <p>
    There's a sequence chart below this line.
  </p>
  <hr>
  <script type="text/x-mscgen">
msc {
  wordwraparcs=true;

  bw [label="BlueWeb"],
  ci [label="Check-in groups API"],
  as [label="ancillary shop API"];

  bw =>> ci [label="check in"];
  ci >> bw [label="check in response (including link to ancillary shop)"];
  bw =>> as [label="GET shop"];
  bw alt as [label="seatmap available"] {
    as >> bw [label="shop response\n link to seatmap"];
    bw =>> as [label="GET seatmap"];
    bw rbox bw [label="render seatmap"];
    --- [label="no seatmap available"];
    as >> bw [label="shop response\nNO link to a seatmap"];
    bw rbox bw [label="tell customer seatmap is not available (or just don't show the seatmap)"];
  };
}
  </script>
  <hr>
  <p>
    There's a sequence chart above this line.
  </p>
  </body>
</html>
daledude commented 7 years ago

When I use the script tag the width=auto no longer works.

sverweij commented 7 years ago

Hmm. Wonder why that is... I'll check tomorrow.

On Fri, Mar 31, 2017, 13:25 Dale Dude notifications@github.com wrote:

When I use the script tag the width=auto no longer works.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sverweij/mscgen_js/issues/245#issuecomment-290687763, or mute the thread https://github.com/notifications/unsubscribe-auth/AEmWRWNWZ31AuHVPzgVYwaTJEW4k7WBQks5rrOLEgaJpZM4MvQxc .

daledude commented 7 years ago

I can wrap the script in a <div style="width:100%"></div> and it works. My complex page with splitters and panels, etc is the culprit.

Thanks.