Comments (4)
In GGity I approach this by just inserting an embedded stylesheet by default. The user can specify no stylesheet if they want to use an external one. Here that could be something like Plot.default_style(plot, false)
or Plot.attributes(plot, default_style: false),
in which case nothing gets inserted.
This isn't in GGity master yet. I made it more complicated than it probably needs to be in order to support constructing styles via the API (a la ggplot2 themes), and that part is not yet ready. Implementing the simple "default or nothing" approach above is a lot more straightforward, and I can probably repackage what I have already done into a PR if you are interested.
from contex.
Thanks @srowley - makes sense. I'm thinking of the following:
- Just enough default styling that things don't disappear if no CSS added
- Option to switch off default style
- Try to organise default styles so that they are overridden if CSS is provided but default styles aren't switched off. I'm sure there are some specificity gotchas when combining embedded css with external, and I'm sure there different depending on browser...
from contex.
With that in mind, the key constraint is that a given selector in the embedded style is always going to override the same selector in an external sheet. If the goal is to minimize the defaults and make it easy for them to be overridden even if the default is still on, I would think you can literally just insert:
<style type="text/css">
<![CDATA[
text {
fill: black
}
line {
stroke: black
}
]]>
</style>
and all of the labels and tick-marks would show up. Any selector that uses a class (e.g. exc-tick text
) in an external sheet would override that, so you don't have to make your external styles any more specific for them to override the default.
If that makes sense I'll send a PR; that's an easy one.
from contex.
Perfect. That’s pretty well what I had in mind...
from contex.
Related Issues (20)
- Fix up test for line charts
- SVG font is changed when transforming to PNG HOT 4
- Click event on a pie wedge HOT 3
- ❓ [QUESTION] What is the best way to handle long text in legend? HOT 7
- Legend not appearing HOT 1
- Support for empty data sets? HOT 3
- Trailing space after sparkline HOT 1
- A few examples for new users HOT 3
- Details not appearing on mouse-hover with PieChart HOT 4
- Long legend text truncated HOT 4
- Log scale HOT 6
- Tests failing with elixir 1.14.3 HOT 1
- Examples as ExDocs HOT 5
- Tooltip on a line chart HOT 1
- OHLC Candlestick chart HOT 6
- Radar charts HOT 1
- BarChart 0 is not 0 HOT 3
- Axes and axes related enhancements for the OHLC chart HOT 5
- Problem with negative values for barchart HOT 1
- Possibility to style svg
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contex.