stevej2608 / dash-svg

SVG support library for Plotly/Dash
Other
15 stars 3 forks source link

Add general attributes #3

Closed jowlo closed 1 year ago

jowlo commented 1 year ago

This PR manually adds some general attributes such as transform, x and y that apply to all elements afaik. Most helpful for many cases might also be the addition of the style attribute in the same way that it is used in other dash components, allowing to pass a dictionary. It also adds some rect specific attributes, ie size, fill, stroke and border radius.

Now, something like this works:

import dash_svg as dsvg

dsvg.Svg([
  dsvg.G(
    dsvg.Text(
      f"Hello Dash",
      x=16, y=-8,
      style={'font-size': '.75em'}
    ),
    transform="translate(15, 20)"
  )
])

There are probably a lot more attributes missing that are not picked up by the scraper, but these are the ones that i needed for a project.

I also added some minor fixes for an empty attribute lists and fixed an issue with \r\n line endings showing up in attribute names when working on linux.

stevej2608 commented 1 year ago

@jowlo, thanks for the update. Cheers.

jowlo commented 1 year ago

Thanks for setting up the project in the first place!

Would you mind doing a new release on PyPi? I already bumped the version to 0.0.10 in the first commit.

Cheers!

stevej2608 commented 1 year ago

I've updated PyPi.

I'll add some pytest tests and a GH workflow definition. I'm a bit busy at the moment, hopefully I'll be able to do it next week.

Cheers

On Tue, 8 Nov 2022 at 13:43, Jonas @.***> wrote:

Thanks for setting up the project in the first place!

Would you mind doing a new release on PyPi? I already bumped the version to 0.0.10 in the first commit.

Cheers!

— Reply to this email directly, view it on GitHub https://github.com/stevej2608/dash-svg/pull/3#issuecomment-1307242768, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGWJHSHDJ3ZXLIGSIZZLU3WHJKG5ANCNFSM6AAAAAARUILYIQ . You are receiving this because you modified the open/close state.Message ID: @.***>

dbowmansqc commented 1 year ago

I needed this exact functionality and was about to try to add it myself. Thanks so much!