jaraco / svg.charts

SVG Charting Library for Python
MIT License
30 stars 10 forks source link

Style customization should be more straightforward #3

Open jaraco opened 10 years ago

jaraco commented 10 years ago

Originally reported by: Jason R. Coombs (Bitbucket: jaraco, GitHub: jaraco)


The current implementation makes it very difficult to customize the styles of the charts. The current graph interface is very limited.

It should be very easy, for example, to change the color scheme for the lines in a graph.


shaun-ba commented 8 years ago

The docs don't work, and i can't figure out how i'm supposed to use the CSS module? How do i style a line chart?

jaraco commented 8 years ago

The docs don't work.

This library does have some rough edges. If you have a specific concern, please elaborate on it and perhaps investigate and send a pull request with a proposed improvement.

How do I style a line chart?

If the docs don't get you started, then read the code, which is what I just did. Looks like you can subclass your Line chart and merge your styles into the stylesheet like so:

class StyledLine(svg.charts.line.Line):
    def get_stylesheet(self):
        ss = super(StyledLine, self).get_stylesheet()
        my_styles = load_my_styles() # returns a cssutils style sheet.
        ss.add(my_styles)
        return ss

Then use that class to generate your line chart.

I acknowledge that the style customization interface is clumsy, which is why this ticket exists. This project is very generous with accepting user contributions, so do please if you can think of a better way, please share it and we'll get it into the next release.

shaun-ba commented 8 years ago

I'll take a look at the method you propose, but i'm looking for a working library unfortunately, i don't have time to code it myself.

As for the docs, its not a suggestion, they simply don't work on the page linked from pypi, and readthedocs is empty for this module https://svgcharts.readthedocs.io/en/latest/svg.charts.html#module-svg.charts.css

best, shaun

jaraco commented 7 years ago

they simply don't work on the page linked from pypi

That's right. The support for pythonhosted got removed. I've updated the link in e5d0e00.

pedromorgan commented 3 years ago

Re Documentaion // its easy when u know how..

Pyspread is probably a good example as it required pyqt5 installation to even generate the docs.. https://pyspread.gitlab.io/pyspread/

It uses sphinx which is a pain in the butt, but the only effective way to do it also..

Note github actio is probably similar to gitlab.ci.. havent looked at it as I dont used github that much..

jaraco commented 3 years ago

@pedromorgan If you wish to change the way that docs are hosted, please file a bug and/or submit a PR to jaraco/skeleton in such a way that all projects can adopt the strategy.