d3scatter icon indicating copy to clipboard operation
d3scatter copied to clipboard

Ability to define scatter colors

Open kppk33 opened this issue 3 years ago • 0 comments

d3scatter with filters (using bscols) is extremely close to showing what I need without shiny. The only thing I am having an issue with is the ability, if it exists, to define the color to use for a certain value of the key.

This statement gives me the proper graph that has all the ability I need to filter but the static color of blue, orange and green don't visually work for the 3 status fields that I want them to represent.

d3scatter(shared_demo, ~Age.at.Report, ~Pensionable_Service, x_label = "Age", y_label = "YOS", color=~Status)

If I change the "color=~Status" to "color=c("#474d56","#64c3e8","#fcb334")" I lose the ability to see the data properly.

Any suggestions on how I might be able to use the d3scatter with crosstalk and get the colors the way I want them? Thanks

This is a snippet of how I am using this: bscols(widths = c(3,NA), list( filter_checkbox("OplGroup", "Discipline", shared_demo, ~OplGroup, inline = TRUE), filter_checkbox("FIR", "FIR", shared_demo, ~FIR, inline = TRUE), filter_checkbox("Specialty.Type", "Unit Type", shared_demo, ~Specialty.Type, inline = TRUE), filter_checkbox("Status", "Status", shared_demo, ~Status, inline = TRUE), filter_checkbox("Age.Group", "Age Band", shared_demo, ~Age.Group, inline = TRUE), filter_checkbox("YOS.Group", "YOS Band", shared_demo, ~YOS.Group, inline = TRUE), filter_select("Unit", "Unit", shared_demo, ~Unit, multiple = TRUE) ), d3scatter(shared_demo, ~Age.at.Report, ~Pensionable_Service, x_label = "Age", y_label = "YOS", color=~Status) #d3scatter(shared_demo, ~Age.at.Report, ~Pensionable_Service, x_label = "Age", y_label = "YOS", color = c("#474d56","#64c3e8","#fcb334")) )

kppk33 avatar Apr 12 '21 16:04 kppk33