Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Legend not working #13

Open
dax006 opened this issue Dec 20, 2021 · 1 comment
Open

Legend not working #13

dax006 opened this issue Dec 20, 2021 · 1 comment

Comments

@dax006
Copy link

dax006 commented Dec 20, 2021

Cannot figure out how to get legend working.

I have this code:
legendGraph = GvGen("Legend")
a = legendGraph.newItem(" ")
legendGraph.styleAppend("entry1","color","green")
legendGraph.styleAppend("entry1","shape","rectangle")
legendGraph.styleApply("entry1", a)

and I get this result:
image

How do I put text in the box? This code:
legendGraph.styleApply("entry1", "some text")

Gives me an error "does not support item assignment"

@dax006 dax006 closed this as completed Dec 20, 2021
@dax006 dax006 reopened this Dec 20, 2021
@stricaud
Copy link
Owner

It seems you are missing to execute the function legendAppend(STYLE_NAME, DESCRIPTION, IS_LABEL_IN), such as:

legendGraph.styleAppend("entry1","color","green")
legendGraph.styleAppend("entry1","shape","rectangle")
legendGraph.styleApply("entry1", a)

legendGraph.legendAppend("entry1", "This is the text for the item", 1)

legendGraph.dot()

Which makes:
image

Is this what you want?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants