csgoh / processpiper

An open source python library to generate business process diagram using code or plain text.
https://github.com/csgoh/processpiper
MIT License
148 stars 10 forks source link

Diagram not printing correctly #12

Closed AccidentalGenius101 closed 1 year ago

AccidentalGenius101 commented 1 year ago

First of all its a very great library you built! My issue is that when I save my diagram it misses content on the right. The output image is 3642x1095

csgoh commented 1 year ago

Can you provide your code to reproduce the issue? And what platform you are running your code on?

AccidentalGenius101 commented 1 year ago

Yes for sure! And I am running the code on window in vscode

from processpiper import ProcessMap, EventType, ActivityType, GatewayType

with ProcessMap(
    "Title", colour_theme="BLUEMOUNTAIN") as my_process_map:
    with my_process_map.add_pool("Pool") as pool1:
        with pool1.add_lane("Lane 1") as lane1:
            receive_request1 = lane1.add_element("Receive request", ActivityType.TASK)
            analyse_request = lane1.add_element("Analyse request", ActivityType.TASK)
            are_clarifications_needed = lane1.add_element("Are clarifications needed?", GatewayType.EXCLUSIVE)
            approve_request = lane1.add_element("Approve request", ActivityType.TASK)
            allocate_subject = lane1.add_element("Allocate schema/subject area", ActivityType.TASK)
            submit_request = lane1.add_element("Submit request for schema/subject area and group", ActivityType.TASK)
            end = lane1.add_element("Close ticket", EventType.END)

        with pool1.add_lane("Lane 2") as lane2:
            receive_request2 = lane2.add_element("Receive request", ActivityType.TASK)
            review_request1 = lane2.add_element("Review request", ActivityType.TASK)
            are_changes_needed = lane2.add_element("Are changes needed?", GatewayType.EXCLUSIVE)
            approve_final1 = lane2.add_element("Approve final version", ActivityType.TASK)

        with pool1.add_lane("Lane 3") as lane3:
            start = lane3.add_element("Request new subject area", EventType.START)
            notify1 = lane3.add_element("Notify", EventType.MESSAGE)
            update_request = lane3.add_element("Update request", ActivityType.TASK)
            review_changes = lane3.add_element("Review changes", ActivityType.TASK)
            apply_changes = lane3.add_element("Apply changes", ActivityType.TASK)
            notify2 = lane3.add_element("Notify", EventType.MESSAGE)

        with pool1.add_lane("Lane 4") as lane4:
            create_group = lane4.add_element("Create group", ActivityType.TASK)
            create_subject = lane4.add_element("Create schema/subject area", ActivityType.TASK)

        with pool1.add_lane("Lane 5") as lane5:
            notify3 = lane5.add_element("Notify", EventType.MESSAGE)
            approve_final2 = lane5.add_element("Approve final version", ActivityType.TASK)

    start.connect(receive_request1).connect(notify1).connect(analyse_request).connect(are_clarifications_needed)
    are_clarifications_needed.connect(approve_request, "No")
    are_clarifications_needed.connect(update_request, "Yes").connect(analyse_request)
    approve_request.connect(receive_request2).connect(review_request1).connect(are_changes_needed)
    are_changes_needed.connect(apply_changes, "Yes").connect(review_changes)
    are_changes_needed.connect(approve_final1, "No")
    review_changes.connect(approve_final1).connect(notify3).connect(approve_final2)
    approve_final2.connect(submit_request).connect(create_group).connect(create_subject)
    create_subject.connect(allocate_subject).connect(notify2).connect(end)

    my_process_map.set_footer("Generated by ProcessPiper")
    my_process_map.draw()
    my_process_map.save("output/test.png")
csgoh commented 1 year ago

@AccidentalGenius101 This is an easy fix. Just add width argument to the ProcessMap parameter. See code below:

with ProcessMap(
    "Title", colour_theme="BLUEMOUNTAIN", width=4800) as my_process_map:
    with my_process_map.add_pool("Pool") as pool1:

The default width is just 3200, you can always extend it.

AccidentalGenius101 commented 1 year ago

Cool thank you for the quick help!