Material Line Chart with vAxis Ticks

1,059 views
Skip to first unread message

Jack Scotson

unread,
Jun 2, 2015, 8:40:26 AM6/2/15
to google-visua...@googlegroups.com
HTML:
     <script type="text/javascript"
            'modules':[{
              'name':'visualization',
              'version':'1',
              'packages':['line']
            }]
          }"></script>  

<div id="curve_chart" style="width: 750px; height: 500px"></div>


Javascript:
    function drawChart() {
        var table = new google.visualization.DataTable();
        table.addColumn('string', 'Date');
        table.addColumn('number', 'Rating');
        table.addRows([["Test", 5], ["Test2", 10], ["Test3",15], ["Test4", 20]]);
        var options = {
            vAxis: {
                ticks: [10,20,40, 80, 160]
            }
        };
        var chart = new google.charts.Line(document.getElementById('curve_chart'));
        chart.draw(table, google.charts.Line.convertOptions(options));
    }
    google.setOnLoadCallback(drawChart);

Hello,
With the code above, I'd expect to see 4 different plots of data on my chart ranging from 5 to 20, but with the Y axis having ticks going from 10, to 160.

If I were to not use the Material line chart and use the 'normal' corechart, this would display correctly with the vAxis ticks displaying correctly.
Using it in the state it is in, the vAxis goes from 4-20. Is there a reason for the vAxis ticks not taking effect when using the Material Line chart?

Thanks.

Daniel LaLiberte

unread,
Jun 2, 2015, 9:13:23 AM6/2/15
to google-visua...@googlegroups.com
Hi Jack,

The material charts don't yet support many of the options supported by the corecharts, including the explicit ticks option.  If you want the material style (at least the fonts and colors) with the corecharts, you can add this option:  { theme: 'material' }


--
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-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlaliberte@Google.com   5CC, Cambridge MA
daniel.laliberte@GMail.com 9 Juniper Ridge Road, Acton MA

Jack Scotson

unread,
Jun 2, 2015, 9:20:43 AM6/2/15
to google-visua...@googlegroups.com
Hi Daniel,
Thanks for your reply.

I see, I'll just go back to using corecharts and keep track on further developments with the material charts as I'm looking forward to using them a fair bit within my site.

Cheers
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-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.



--
dlali...@Google.com   5CC, Cambridge MA
daniel.l...@GMail.com 9 Juniper Ridge Road, Acton MA
Reply all
Reply to author
Forward
0 new messages