Skip to content

Add ability to use CSS classes on SVG charts #107

@LordMike

Description

@LordMike

Hey,

I was wondering if it was possible to replace this:

<span data-peity='{ "fill": ["red", "#eeeeee"],    "innerRadius": 10, "radius": 40 }'>1/7</span>

With perhaps this:

<span data-peity='{ "class": "my-class",    "innerRadius": 10, "radius": 40 }'>1/7</span>
.. or
<span data-peity='{ "class": ["my-class", "my-class2"],    "innerRadius": 10, "radius": 40 }'>1/7</span>

This way I can move all my colors etc. to other systems, like SASS.

I checked the code, and it seems like there explicitly isn't a way to add attributes to the rendered SVG elements, so I can't even workaround it :). Also, I noted that SVG is optional, so of course classes wouldn't work if Peity fell back to canvas rendering.. but I'm willing to lose that support :).

Mike.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions