ramnathv / rCharts

Interactive JS Charts from R
http://rcharts.io
Other
1.19k stars 654 forks source link

x and y-axis labels? #215

Open tcash21 opened 11 years ago

tcash21 commented 11 years ago

I've searched through the Rickshaw code examples and rCharts code but have not been able to find any documentation on adding x and y-axis labels or main chart titles?

Is this possible within the Rickshaw chart object itself since adding text in R shiny is a bit clunky and requires a bunch of CSS formatting?

ramnathv commented 11 years ago

Here is an example on how to add custom x-axis labels in Rickshaw. You can use ViewSource to check out the underlying code.

In rCharts, the basic idea would be to pass a tickFormat function, which would then adjust the labels accordingly. I will try to post an example later, but this should get you started on the right track.

tcash21 commented 11 years ago

Thanks, I saw that but was hoping there was just a simple x and y-axis title parameter. I'll give this a try though!

ramnathv commented 11 years ago

I am reopening this issue so that it serves me as a reminder to provide a simpler mechanism to specify axis labels. It should be fairly straightforward to generate the javascript formatter function from a vector of labels specified by the user.

tcash21 commented 11 years ago

Cool, thanks. I was hoping for a way to provide custom tick labels but also just a generic label specifying what the measure actually is, but as far as I can tell Rickshaw only lets you label the ticks.

ramnathv commented 11 years ago

You might want to post a question on the github repo for Rickshaw, asking what is the best way to add a title. Once we figure that out, it should be straightforward to integrate into rCharts.

hexicle commented 10 years ago

They purposely didn't put in axis labels. You're supposed to do it on your own. Google Visualization API allows easy addition of axis labels but it isn't open source and you can't host it on your own server.

ramnathv commented 10 years ago

Thanks @Raindrop11. This is good to know. Any thoughts on how to implement this with Rickshaw? Once we figure out the JS side of things, I can incorporate it into rCharts.

hexicle commented 10 years ago

It depends on how you want the axis labels to look like. I'm guessing that the best example would be how Google Visualization API does it, because I'm sure their talented designers spent time and energy to design it well. Example of Google Visualization API's axis labels: image