Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

color by group in line_with_focus #13

Open
lcolladotor opened this issue Apr 4, 2013 · 2 comments
Open

color by group in line_with_focus #13

lcolladotor opened this issue Apr 4, 2013 · 2 comments

Comments

@lcolladotor
Copy link

If you have groups of data that you want to color by group in the line_with_focus ractive, well, you might want to look at the line_with_focus2 I have here https://github.com/lcolladotor/ballgownR-devel/tree/master/clickme-test

Basically, I changed things a tiny bit to add a color parameter that specifies an array that is then used by nv.utils.defaultColor from the utils.js file

It was my first attempt at building upon a ractive and seeing if I could customize something to my liking. Thanks for the wiki info!

By the way, that was my first time looking at javascript code and D3. It was more intuitive than what I expected, but it still took me some time to do this small hack.

Maybe you could add these changes to your own line_with_focus and make the color call more robust. I would probably do that inside the translate() function in the translator.R file.

Stuff changed: utils.js line 56, template_config.yml line 28, template.Rmd line 13

@lcolladotor
Copy link
Author

@nachocab
Copy link
Owner

nachocab commented Apr 4, 2013

Hey Leonardo,

Thanks for contributing a ractive. I'm still working on making them easier to share and install (sometime in the near future). Please tell me if you found something in the documentation that needs a rewrite.

I like the idea of adding colors, but I try to avoid modifying the original JS code in established libraries like nvd3. I'm sure there is a way to specify what color palette will be used when generating one of their graphs. This could be done in the template.Rmd. Something like chart.palette(ballgowncolors) (although palette is not the right function, I'm not an nvd3 expert).

I'm in the middle of a big rewrite of clickme which will make it more intuitive and flexible. The file formats will change a bit so stay tuned.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants