Placement of tick marks in x axis

20 views
Skip to first unread message

Paul Maural

unread,
Jun 25, 2017, 5:55:14 AM6/25/17
to google-visua...@googlegroups.com
Hi,

I appreciate if someone can point me right approach to have specific number of ticks in x axis.

I am using below code to generate the same :

Basically I want to have fixed 6 number of ticks for x axis. Surprisingly, below code generates correct number of ticks for y axis but not for x axis

Dummy_DF = data.frame('x' = 0:60, 'y' = runif((1 + 60), 1, 90))

plot(gvisLineChart(Dummy_DF, xvar = "x", yvar = "y",

            options = list(width = 940, height = 500, legend = 'none', title = "", 
                  series = "[{color:'#e8cec5', lineWidth: 1}]",
                  hAxes = paste("[{title:'", "Days", "', ticks: [", 
                        paste(sort(unique(round(c(seq(0, 60, length.out = 6), 60), 0))), collapse = ','), 
                              "], titleTextStyle: { italic: false}, minValue:", 0, ", maxValue:", 60, "}]", sep = ""),
            vAxes = paste("[{title:'", "", "', ticks: [", 
                        paste(round(sort(unique(c(seq(0, 100, length.out = 11), 100))), 0), collapse = ','), 
                  "], format:'#.#', titleTextStyle: { italic: false}, minValue:", 0, 
                  ", textPosition: 'out', maxValue:", 100, "}]", sep = ""))))

Where am I doing wrong?

Daniel LaLiberte

unread,
Jun 25, 2017, 12:29:37 PM6/25/17
to Google Visualization API
I can't tell from the script used to generate JavaScript, but if you could instead show us the JavaScript results from running this, that would help.

I see you are trying to use the explicit ticks option, which is the best way to specify exactly what ticks you will get.  But how the options are interpreted also depends on the chart type, so please specify that as well.  

It is best to give us a link to the resulting web page, so we can see all the code and what it does.

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAMnpynQ60k30VKP0AqTkUx2o2cDNCSBYCkT5AzokE1h3Xzz2ag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages