Histogram: How to make it so that my columns are not divided individually?

44 views
Skip to first unread message

Yves De Jesus

unread,
Nov 18, 2019, 8:16:12 PM11/18/19
to Google Visualization API


In addition, how can I start adding x,y-labels?

Thanks in advance,

Ray Thomas

unread,
Nov 19, 2019, 12:19:15 AM11/19/19
to Google Visualization API
You can hide the individual column elements by setting the histogram.hideBucketItems option to true. In your options, use

     histogram: { hideBucketItems: true },

For the titles and and legends you need to go to https://developers.google.com/chart/interactive/docs/gallery/histogram#configuration-options and look through what you can do with this type of chart.

Ray

Yves De Jesus

unread,
Nov 19, 2019, 12:31:47 AM11/19/19
to google-visua...@googlegroups.com
Hi Ray,

I'm not getting histogram: { hideBucket/items: true },

hAxis doesn't appear to be working as well: hAxistitle: 'Energy-use per square ft.'

--
You received this message because you are subscribed to a topic in the Google Groups "Google Visualization API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-visualization-api/MSgoWpNsTq4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-visualizati...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/c6f4eb2a-fce3-45b9-ad6c-887af24139c5%40googlegroups.com.


--
Yves

Ray Thomas

unread,
Nov 19, 2019, 9:07:05 PM11/19/19
to Google Visualization API
It all works but the documentation is a little difficult to understand in places.

There's another way of drawing the graphs and that uses an object called ChartWrapper - https://developers.google.com/chart/interactive/docs/reference#chartwrapperobject 

In that, you can set the options using dot notation as in setOption(key, value) so you can use things like setOption('hAxis.slantedText', 'true')

var options uses bracket notation but in the list of available options dot notation is used. You just need to realize how to change the dot notation to bracket notation.

In the histogram documentation one of the options is given as histogram.hideBucketItems but you cannot use that. It has to be changed to histogram: {hideBucketItems: true},

Likewise for hAxis.title that has to be changed to hAxis: { title: 'Energy-use per square ft.'},

Here's your new options:

var options = {
          title: 'Efficiency of East Bank Buildings',
          legend: { position: 'none' },
          colors: ['gold'],
  hAxis: { title: 'Energy-use per square ft.'},
  histogram: {hideBucketItems: true},
 };


Ray





Pat Ng

unread,
Nov 20, 2020, 2:33:23 PM11/20/20
to Google Visualization API
#Yves,  I was looking for the same and this works.
          histogram: {
          bucketSize: 0.25,
          maxNumBuckets: 15,
          minValue: 0,
          maxValue: 300,
          hideBucketItems: 'true'
        }

Reply all
Reply to author
Forward
0 new messages