lumean / svg-graph2

SVG:::Graph is a pure Ruby library for generating charts, which are a type of graph where the values of one axis are not scalar. SVG::Graph has a verry similar API to the Perl library SVG::TT::Graph, and the resulting charts also look the same. This isn't surprising, because SVG::Graph started as a loose port of SVG::TT::Graph.
Other
50 stars 20 forks source link

dataPointLabel styling issues #21

Closed marnen closed 3 years ago

marnen commented 4 years ago

It looks like Graph#make_datapoint_text writes each datapoint's text twice, once on top of the other, to provide a background and help the text stand out. Unfortunately, one text object uses the class .dataPointLabel, while the other uses .dataPointLabel plus some inline styling to make the background. This is a problem for those of us who use our own CSS to style the SVG graphs, because the inline styling (which, BTW, has the background hard-coded to white) means that it's difficult or impossible to customize the backgrounds to do the right thing.

What I propose, then, is the following (and I'll make a pull request for it hopefully in the next day or so): keep .dataPointLabel on the foreground element, but create a new class called something like .dataPointLabelBackground for the background element, and put the styling there instead of inline. This should keep the graph's current behavior with the default CSS, but make custom CSS easier to apply. Sound good?

marnen commented 4 years ago

(Also, not sure why the camelCase in the class name. It's idiomatic neither for CSS nor for Ruby. But that's a minor point.)

lumean commented 4 years ago

thanks for the input, PR is welcome.Also feel free to change the camelCase.