Hi Neha,
You are mixing the classic chart with the material chart options. The
material chart doesn't support combining bars and lines, so you will have
to stick with the classic charts and specify the left of right sides with
the series 'targetAxisIndex' option.
series: {
0: {targetAxisIndex: 0, type: 'bars'},
1: {targetAxisIndex: 1, type: 'line'}
},
On Tue, Jan 3, 2017 at 8:39 AM, Neha Wattamwar <[email protected]>
wrote:
> Hi,
> I want to display a chart where one Set of values is used plotting left
> Y-axis and the other set of values is marked on the right-hand Y-axis.
> Attaching a mockup. Could someone suggest how to plot it.
>
> This the code am trying for the required mockup.
> <html>
> <head>
> <script type="text/javascript" src="https://www.gstatic.com/c
> harts/loader.js"></script>
> <script type="text/javascript">
> google.charts.load('current', {'packages':['corechart']});
> google.charts.setOnLoadCallback(drawStuff);
>
> function drawStuff() {
> var data = new google.visualization.arrayToDataTable([
> ['Galaxy', 'Distance', 'Brightness'],
> ['Canis Major Dwarf', 8000, 23.3],
> ['Sagittarius Dwarf', 24000, 4.5],
> ['Ursa Major II Dwarf', 30000, 14.3],
> ['Lg. Magellanic Cloud', 50000, 0.9],
> ['Bootes I', 60000, 13.1]
> ]);
>
> var options = {
> width: 900,
> chart: {
> title: 'Nearby galaxies',
> subtitle: 'distance on the left, brightness on the right'
> },
>
> series: {
> 0: { type : 'bars' , axis: 'distance' }, // Bind series 0 to
> an axis named 'distance'.
> 1: { type: 'line',axis: 'brightness' } // Bind series 1 to an
> axis named 'brightness'.
> },
> axes: {
> y: {
> distance: {label: 'parsecs'}, // Left y-axis.
> brightness: {side: 'right', label: 'apparent magnitude'} //
> Right y-axis.
> }
> }
> };
>
> var chart = new google.visualization.ComboChar
> t(document.getElementById('dual_y_div'));
> chart.draw(data, options);
> };
> </script>
> </head>
> <body>
> <div id="dual_y_div" style="width: 900px; height: 500px;"></div>
> </body>
> </html>
>
> --
> 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 [email protected].
> To post to this group, send email to google-visualization-api@googl
> egroups.com.
> Visit this group at https://groups.google.com/grou
> p/google-visualization-api.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/google-visualization-api/d75bd757-8f65-4ed0-9c1c-ca5764
> 896829%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/d75bd757-8f65-4ed0-9c1c-ca5764896829%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]> 5CC, Cambridge MA
--
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 [email protected].
To post to this group, send email to [email protected].
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/CAOtcSJOr-Sz3Dv1uSNgnQ9_JOdbFPFUzY5XTEYXs69O25K9B%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.