Skip to content

D3 tick generation can be frustrating #474

Description

@SamWDataVis

This is from a SM clustered bar chart today. I found specifying the number of ticks I wanted on the x axis frustrating, as D3 rounds a bit too nicely at times. I tweaked my config to accept the following options, and the script accordingly:

// Specify tick values myself, or automate with d3
	"xTicksMethod": "specified", // either "specified" for actualXTicks, or "auto" for "xAxisTicks", which d3 calculates.
// set the specific ticks I want to show
	"actualXTicks": {
		"sm": [-25, 0, 25, 50],
		"md": [-25, 0, 25, 50],
		"lg": [-25, 0, 25, 50],
	},
// or D3 generates this number of ticks:
	"xAxisTicks": {
		"sm": 4,
		"md": 4,
		"lg": 4
	},

Would we want to adopt this more broadly for band / numeric axes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions