I am hosting a graph with rCharts on a website and want to change the x-axis title. I am using this:
d1$setTemplate(afterScript = "
<script>
myChart.draw()
myChart.axes[0].titleShape.text('x-axis title')
myChart.axes[1].titleShape.text('y-axis title')
myChart.svg.append('text')
.attr('x', 40)
.attr('y', 20)
.style('text-anchor','beginning')
.style('font-size', '100%')
</script>
")
However, this does not seem to work. Now the name of the variables is shown as axis label on the website. But when I run the whole Rscript in Rstudio, it does change the axis titles.
The question is: how can I fix this.
Thanks in advance.
Eddy
I solved this today. The exact problem I do not know, however, this script i tried to run in R which works fine. But since the graph is hosted on a page, i placed the script between the html code which is more logical in my opinion and it works.
Eddy