Awesome, thanks! 
That got the axes working correctly, but now the bars are green instead of 
orange. Any idea why that might be?

On Thursday, October 20, 2016 at 10:39:14 AM UTC-7, Daniel LaLiberte wrote:
>
> Hi Chris,
>
> You are missing the convertOptions call.  See this example:  
> https://jsfiddle.net/dlaliberte/jeowryh7/
>
>
> On Thu, Oct 20, 2016 at 1:00 PM, Chris Randall <[email protected] 
> <javascript:>> wrote:
>
>> Hey everyone, 
>> I've set up a material bar chart going off the documentation and have run 
>> in to an issue; the axis titles that are displayed aren't what I'm setting 
>> them to.
>>
>> Here's my code:
>> function drawGoogleBarChart(parentID, width, height, json) {
>>     var bcd = JSON.parse(json);
>>     var bars = bcd.Bars;
>>     var colors = [];
>>
>>     var data = new google.visualization.DataTable();
>>     data.addColumn('string', 'Name');
>>     for (var i = 0; i < bars[0].Segments.length; ++i) {
>>         data.addColumn('number', bars[0].Segments[i].Name);
>>         data.addColumn({ type: 'string', role: 'style' });
>>         colors.push(rgbToHex(bars[0].Segments[i].Color.R, 
>> bars[0].Segments[i].Color.G, bars[0].Segments[i].Color.B));
>>     }
>>     for (var i = 0; i < bars.length; ++i) {
>>         var row = [];
>>         row.push(bars[i].Label);
>>         for (var j = 0; j < bars[i].Segments.length; ++j) {
>>             row.push(bars[i].Segments[j].Count);
>>             row.push(rgbToHex(bars[i].Segments[j].Color.R, 
>> bars[i].Segments[j].Color.G, bars[i].Segments[j].Color.B));
>>         }
>>         data.addRow(row);
>>     }
>>
>>     var xTitle = bcd.XAxis != null ? bcd.XAxis.Title : "";  // set to 
>> "Task Count"
>>     var yTitle = bcd.YAxis != null ? bcd.YAxis.Title : "";  // set to ""
>>
>>     var options = {
>>         isStacked: true,
>>         animation: {
>>             startUp: true,
>>             duration: 500,
>>             easing: 'out'
>>         },
>>         hAxis: {
>>             title: xTitle,
>>             minValue: 0,
>>         },
>>         vAxis: {
>>             title: yTitle
>>         },
>>         colors: colors,
>>
>>         bars: 'horizontal',
>>         width: width,
>>         height: height
>>     };
>>     var material = new 
>> google.charts.Bar(document.getElementById(parentID));
>>     material.draw(data, options);
>> }
>>
>> And here's what my bar chart looks like. The vAxis, which should have no 
>> title, is set to "Name", and the hAxis, which should say "Task Count" is 
>> empty.
>>
>> <https://lh3.googleusercontent.com/-jUG720v7Sbk/WAj32c4WApI/AAAAAAAADLs/V4z8sPBIYlk-ertHAn6QPRdIb48hCSShQCLcB/s1600/Capture.PNG>
>>
>> Many Thanks!
>>
>> -- 
>> 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] 
>> <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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/c1477088-b0a6-40c3-98bb-eb6dbae37fae%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-visualization-api/c1477088-b0a6-40c3-98bb-eb6dbae37fae%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] <javascript:>   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/ec9cd5e2-5144-4be0-bac5-6c6fc412fbb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to