-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set minimum/maximum domain for circle packing #460
Conversation
I'm not a fan of changing this default behavior to zero. If you'd like to make a publically accessable variable to change the domain mins and max that's fine. What might help you in the interim is changing the default minimum radius of the size scale (it defaults to 3): .size({"scale": {"min": 10}}) Additionally, if you'd like to make the minimum dependent on other things like the available size, reference the current default maximum: https://github.com/alexandersimoes/d3plus/blob/master/src/viz/methods/size.coffee#L13-L14 |
4bbcd29
to
671e12d
Compare
I have revised the commit to make the domain min and max available as an option like so: domain { |
@davelandry would you mind taking a look at this again? :) |
Getting close! I don't think this warrants having it's own I would nest it inside of the scale method, moving the current "min" and "max" keys under a new "range" key. The new size.coffee would look something like this: filter = require "../../core/methods/filter.coffee"
module.exports =
accepted: [false, Function, Number, Object, String]
dataFilter: true
deprecates: ["value", "value_var"]
mute: filter(true)
scale:
accepted: [Function]
deprecates: "size_scale"
domain:
max:
accepted: [false, Number]
value: false
min:
accepted: [false, Number]
value: false
range:
max:
accepted: [Function, Number]
value: (vars) ->
Math.floor d3.max [d3.min([vars.width.viz,vars.height.viz])/15, 6]
min:
accepted: [Function, Number]
value: 3
value: d3.scale.sqrt()
solo: filter(true)
threshold:
accepted: [Boolean, Function, Number]
value: false
value: false |
@davelandry, I have amended it, thanks for your quick response. |
Great work @bryanph, I've updated the documentation to clarify this new change: https://github.com/alexandersimoes/d3plus/wiki/Visualizations#size |
Changes the current behavior, which is to select the minimum value in the data as the minimum domain.
This causes problems when data is close together, like for example consider the values: [90, 100, 110, 120]. In this case 90 would be drawn as the minimum circle size and 120 as the max circle size.
It might perhaps be useful to also add a custom parameter to change the minimum domain.